mirror of
https://github.com/clockworkpi/uConsole.git
synced 2026-07-19 22:47:59 +02:00
How-to-downgrade-4G-extension-firmware
This commit is contained in:
BIN
Bin/4G/LE20B06SIM7600G22_cpi_arm64.tar.gz
Normal file
BIN
Bin/4G/LE20B06SIM7600G22_cpi_arm64.tar.gz
Normal file
Binary file not shown.
14
Bin/uconsole_keyboard_flash/Makefile
Normal file
14
Bin/uconsole_keyboard_flash/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
CC=gcc
|
||||
CFLAGS=-I.
|
||||
DEPS =
|
||||
OBJ = upload-reset/upload-reset.o
|
||||
|
||||
%.o: %.c $(DEPS)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
upload-reset.elf: $(OBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS)
|
||||
|
||||
|
||||
clean:
|
||||
rm upload-reset/*.o upload-reset.elf
|
||||
14
Bin/uconsole_keyboard_flash/Makefile.aarch64
Normal file
14
Bin/uconsole_keyboard_flash/Makefile.aarch64
Normal file
@@ -0,0 +1,14 @@
|
||||
CC=aarch64-linux-gnu-gcc
|
||||
CFLAGS=-I.
|
||||
DEPS =
|
||||
OBJ = upload-reset/upload-reset.o
|
||||
|
||||
%.o: %.c $(DEPS)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
upload-reset.elf: $(OBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS)
|
||||
|
||||
|
||||
clean:
|
||||
rm upload-reset/*.o upload-reset.elf
|
||||
14
Bin/uconsole_keyboard_flash/Makefile.amd64
Normal file
14
Bin/uconsole_keyboard_flash/Makefile.amd64
Normal file
@@ -0,0 +1,14 @@
|
||||
CC=gcc
|
||||
CFLAGS=-I.
|
||||
DEPS =
|
||||
OBJ = upload-reset/upload-reset.o
|
||||
|
||||
%.o: %.c $(DEPS)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
upload-reset.elf: $(OBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS)
|
||||
|
||||
|
||||
clean:
|
||||
rm upload-reset/*.o upload-reset.elf
|
||||
14
Bin/uconsole_keyboard_flash/Makefile.armhf
Normal file
14
Bin/uconsole_keyboard_flash/Makefile.armhf
Normal file
@@ -0,0 +1,14 @@
|
||||
CC=arm-linux-gnueabihf-gcc
|
||||
CFLAGS=-I.
|
||||
DEPS =
|
||||
OBJ = upload-reset/upload-reset.o
|
||||
|
||||
%.o: %.c $(DEPS)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
upload-reset.elf: $(OBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS)
|
||||
|
||||
|
||||
clean:
|
||||
rm upload-reset/*.o upload-reset.elf
|
||||
8
Bin/uconsole_keyboard_flash/README.md
Normal file
8
Bin/uconsole_keyboard_flash/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
use maple\_upload to manually flash the stm32duino bin file into STM32/GD32/CKS32 chip
|
||||
|
||||
the bin file must be generated by selecting the upload method to be stm32duino-bootloader
|
||||
|
||||
so that the start address will be at 0x08002000
|
||||
|
||||
|
||||
BIN
Bin/uconsole_keyboard_flash/deb_packages/aarch64/upload-reset.elf
Executable file
BIN
Bin/uconsole_keyboard_flash/deb_packages/aarch64/upload-reset.elf
Executable file
Binary file not shown.
BIN
Bin/uconsole_keyboard_flash/deb_packages/armhf/upload-reset.elf
Executable file
BIN
Bin/uconsole_keyboard_flash/deb_packages/armhf/upload-reset.elf
Executable file
Binary file not shown.
BIN
Bin/uconsole_keyboard_flash/deb_packages/riscv64/upload-reset.elf
Executable file
BIN
Bin/uconsole_keyboard_flash/deb_packages/riscv64/upload-reset.elf
Executable file
Binary file not shown.
3
Bin/uconsole_keyboard_flash/flash.sh
Executable file
3
Bin/uconsole_keyboard_flash/flash.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo ./maple_upload ttyACM0 2 1EAF:0003 uconsole_keyboard.ino.bin
|
||||
71
Bin/uconsole_keyboard_flash/maple_upload
Executable file
71
Bin/uconsole_keyboard_flash/maple_upload
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -e
|
||||
|
||||
architecture="unknow"
|
||||
case $(uname -m) in
|
||||
x86_64) architecture="amd64" ;;
|
||||
armv7l) dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;;
|
||||
arm) dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;;
|
||||
aarch64) architecture="aarch64";;
|
||||
riscv64) architecture="riscv64";;
|
||||
esac
|
||||
|
||||
|
||||
if [ $architecture = "unknow" ]; then
|
||||
echo "unknow architecture,exiting..."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
echo "Usage: $0 $# <dummy_port> <altID> <usbID> <binfile>" >&2
|
||||
exit 1
|
||||
fi
|
||||
dummy_port="$1"; altID="$2"; usbID="$3"; binfile="$4"; dummy_port_fullpath="/dev/$1"
|
||||
if [ $# -eq 5 ]; then
|
||||
dfuse_addr="--dfuse-address $5"
|
||||
else
|
||||
dfuse_addr=""
|
||||
fi
|
||||
|
||||
|
||||
# Get the directory where the script is running.
|
||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
# ----------------- IMPORTANT -----------------
|
||||
# The 2nd parameter to upload-reset is the delay after resetting before it exits
|
||||
# This value is in milliseonds
|
||||
# You may need to tune this to your system
|
||||
# 750ms to 1500ms seems to work on my Mac
|
||||
#echo ${dummy_port_fullpath}
|
||||
|
||||
if [ $architecture == "amd64" ]; then
|
||||
"${DIR}/upload-reset.elf" ${dummy_port_fullpath} 750
|
||||
sleep 2
|
||||
"${DIR}/upload-reset.elf" ${dummy_port_fullpath} 750
|
||||
else
|
||||
"${DIR}/deb_packages/$architecture/upload-reset.elf" ${dummy_port_fullpath} 750
|
||||
sleep 2
|
||||
"${DIR}/deb_packages/$architecture/upload-reset.elf" ${dummy_port_fullpath} 750
|
||||
fi
|
||||
|
||||
DFU_UTIL=/usr/bin/dfu-util
|
||||
#DFU_UTIL=${DIR}/dfu-util/dfu-util
|
||||
if [ ! -x "${DFU_UTIL}" ]; then
|
||||
echo "$0: error: cannot find ${DFU_UTIL}" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R
|
||||
|
||||
"${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R
|
||||
|
||||
echo -n Waiting for ${dummy_port_fullpath} serial...
|
||||
dpkg --print-architecture
|
||||
COUNTER=0
|
||||
while [ ! -c ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
echo Done
|
||||
BIN
Bin/uconsole_keyboard_flash/uconsole_keyboard.ino.bin
Executable file
BIN
Bin/uconsole_keyboard_flash/uconsole_keyboard.ino.bin
Executable file
Binary file not shown.
BIN
Bin/uconsole_keyboard_flash/upload-reset.elf
Executable file
BIN
Bin/uconsole_keyboard_flash/upload-reset.elf
Executable file
Binary file not shown.
161
Bin/uconsole_keyboard_flash/upload-reset/upload-reset.c
Normal file
161
Bin/uconsole_keyboard_flash/upload-reset/upload-reset.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/* Copyright (C) 2015 Roger Clark <www.rogerclark.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Utility to send the reset sequence on RTS and DTR and chars
|
||||
* which resets the libmaple and causes the bootloader to be run
|
||||
*
|
||||
*
|
||||
*
|
||||
* Terminal control code by Heiko Noordhof (see copyright below)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Copyright (C) 2003 Heiko Noordhof <heikyAusers.sf.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Function prototypes (belong in a seperate header file) */
|
||||
int openserial(char *devicename);
|
||||
void closeserial(void);
|
||||
int setDTR(unsigned short level);
|
||||
int setRTS(unsigned short level);
|
||||
|
||||
|
||||
/* Two globals for use by this module only */
|
||||
static int fd;
|
||||
static struct termios oldterminfo;
|
||||
|
||||
|
||||
void closeserial(void)
|
||||
{
|
||||
tcsetattr(fd, TCSANOW, &oldterminfo);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
int openserial(char *devicename)
|
||||
{
|
||||
struct termios attr;
|
||||
|
||||
if ((fd = open(devicename, O_RDWR)) == -1) return 0; /* Error */
|
||||
atexit(closeserial);
|
||||
|
||||
if (tcgetattr(fd, &oldterminfo) == -1) return 0; /* Error */
|
||||
attr = oldterminfo;
|
||||
attr.c_cflag |= CRTSCTS | CLOCAL;
|
||||
attr.c_oflag = 0;
|
||||
if (tcflush(fd, TCIOFLUSH) == -1) return 0; /* Error */
|
||||
if (tcsetattr(fd, TCSANOW, &attr) == -1) return 0; /* Error */
|
||||
|
||||
/* Set the lines to a known state, and */
|
||||
/* finally return non-zero is successful. */
|
||||
return setRTS(0) && setDTR(0);
|
||||
}
|
||||
|
||||
|
||||
/* For the two functions below:
|
||||
* level=0 to set line to LOW
|
||||
* level=1 to set line to HIGH
|
||||
*/
|
||||
|
||||
int setRTS(unsigned short level)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (ioctl(fd, TIOCMGET, &status) == -1) {
|
||||
perror("setRTS(): TIOCMGET");
|
||||
return 0;
|
||||
}
|
||||
if (level) status |= TIOCM_RTS;
|
||||
else status &= ~TIOCM_RTS;
|
||||
if (ioctl(fd, TIOCMSET, &status) == -1) {
|
||||
perror("setRTS(): TIOCMSET");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int setDTR(unsigned short level)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (ioctl(fd, TIOCMGET, &status) == -1) {
|
||||
perror("setDTR(): TIOCMGET");
|
||||
return 0;
|
||||
}
|
||||
if (level) status |= TIOCM_DTR;
|
||||
else status &= ~TIOCM_DTR;
|
||||
if (ioctl(fd, TIOCMSET, &status) == -1) {
|
||||
perror("setDTR: TIOCMSET");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* This portion of code was written by Roger Clark
|
||||
* It was informed by various other pieces of code written by Leaflabs to reset their
|
||||
* Maple and Maple mini boards
|
||||
*/
|
||||
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
if (argc<2 || argc >3)
|
||||
{
|
||||
printf("Usage upload-reset <serial_device> <Optional_delay_in_milliseconds>\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
if (openserial(argv[1]))
|
||||
{
|
||||
// Send magic sequence of DTR and RTS followed by the magic word "1EAF"
|
||||
setRTS(false);
|
||||
setDTR(false);
|
||||
setDTR(true);
|
||||
|
||||
usleep(50000L);
|
||||
|
||||
setDTR(false);
|
||||
setRTS(true);
|
||||
setDTR(true);
|
||||
|
||||
usleep(50000L);
|
||||
|
||||
setDTR(false);
|
||||
|
||||
usleep(50000L);
|
||||
|
||||
write(fd,"1EAF",4);
|
||||
|
||||
closeserial();
|
||||
if (argc==3)
|
||||
{
|
||||
usleep(atol(argv[2])*1000L);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to open serial device.\n\r");
|
||||
}
|
||||
}
|
||||
BIN
Bin/uconsole_keyboard_flash/upload-reset/upload-reset.o
Normal file
BIN
Bin/uconsole_keyboard_flash/upload-reset/upload-reset.o
Normal file
Binary file not shown.
188
wiki/How-to-downgrade-4G-extension-firmware.md
Normal file
188
wiki/How-to-downgrade-4G-extension-firmware.md
Normal file
@@ -0,0 +1,188 @@
|
||||
# Precautions
|
||||
The following-mentioned flashing operation requires your familiarity with Linux and firmware flashing.
|
||||
**Please do not attempt to try it without sufficient experience!**
|
||||
**Please do not attempt to try it without sufficient experience!**
|
||||
**Please do not attempt to try it without sufficient experience!**
|
||||
|
||||
as we will not be held responsible for any consequences. Thank you for your understanding.
|
||||
|
||||
There are risks involved in flashing the 4g ext, and it is necessary for you to have a certain understanding of these background information. During the testing process, it is also not possible for me to test whether all SIM cards worldwide can easily connect to the internet.
|
||||
|
||||
# Purpose
|
||||
|
||||
To downgrade from 9011 to 9001.
|
||||
|
||||
# Power On 4G ext
|
||||
|
||||
we assume that you already know how to power on the 4G ext by https://github.com/clockworkpi/uConsole/wiki/How-to-use-the-4G-extension
|
||||
|
||||
if not ,these steps are not safe for your device
|
||||
|
||||
# Checking usb id
|
||||
```
|
||||
sudo lsusb
|
||||
|
||||
Bus 001 Device 009: ID 1e0e:9011 Qualcomm / Option SimTech, Incorporated
|
||||
```
|
||||
|
||||
OR AT COMMAND
|
||||
|
||||
```
|
||||
echo -en "AT+CUSBPIDSWITCH?\r\n" | sudo socat - /dev/ttyUSB2,crnl
|
||||
```
|
||||
|
||||
we expecting response contains **9011**, not 9001
|
||||
|
||||
# Flashing part
|
||||
|
||||
if you got **9011** from
|
||||
|
||||
```
|
||||
echo -en "AT+CUSBPIDSWITCH?\r\n" | sudo socat - /dev/ttyUSB2,crnl
|
||||
```
|
||||
|
||||
then you can try to downgrade firmware
|
||||
|
||||
**All processess done on uConsole CM4 or A06**
|
||||
|
||||
|
||||
## Process Summary:
|
||||
|
||||
Download whole package from
|
||||
|
||||
https://github.com/clockworkpi/uConsole/raw/master/Bin/4G/LE20B06SIM7600G22_cpi_arm64.tar.gz
|
||||
|
||||
and uncompress it of course
|
||||
|
||||
```
|
||||
tar zxvf LE20B06SIM7600G22_cpi_arm64.tar.gz
|
||||
cd LE20B06SIM7600G22_cpi_arm64
|
||||
```
|
||||
|
||||
First, send the command `AT+BOOTLDR` to **/dev/ttyUSB3** to put the device into bootloader mode. At this point, the LED on the back will not light up.
|
||||
|
||||
```
|
||||
echo -en "AT+BOOTLDR\r\n" |sudo socat - /dev/ttyUSB3,crnl
|
||||
```
|
||||
|
||||
Next, use `sudo ./fastboot/bin/fastboot devices` to ensure that the device is detected. It should display something like `MDM9607 fastboot`.
|
||||
If there is no device information, the operation must be halted.
|
||||
|
||||
Then, use `./flash.sh` from the compressed package to flash the firmware, which should take about **40** seconds.
|
||||
|
||||
here is the output of flash.sh
|
||||
|
||||
```
|
||||
cpi@raspberrypi:~/LE20B04SIM7600G22_cpi $ ./flash.sh
|
||||
sending 'aboot' (447 KB)...
|
||||
OKAY [ 0.018s]
|
||||
writing 'aboot'...
|
||||
OKAY [ 0.563s]
|
||||
finished. total time: 0.583s
|
||||
sending 'rpm' (156 KB)...
|
||||
OKAY [ 0.008s]
|
||||
writing 'rpm'...
|
||||
OKAY [ 0.064s]
|
||||
finished. total time: 0.072s
|
||||
sending 'sbl' (210 KB)...
|
||||
OKAY [ 0.010s]
|
||||
writing 'sbl'...
|
||||
OKAY [ 0.089s]
|
||||
finished. total time: 0.099s
|
||||
sending 'tz' (514 KB)...
|
||||
OKAY [ 0.020s]
|
||||
writing 'tz'...
|
||||
OKAY [ 0.175s]
|
||||
finished. total time: 0.195s
|
||||
sending 'modem' (36096 KB)...
|
||||
OKAY [ 1.143s]
|
||||
writing 'modem'...
|
||||
OKAY [ 11.450s]
|
||||
finished. total time: 12.593s
|
||||
sending 'boot' (5536 KB)...
|
||||
OKAY [ 0.179s]
|
||||
writing 'boot'...
|
||||
OKAY [ 1.744s]
|
||||
finished. total time: 1.925s
|
||||
sending 'system' (51072 KB)...
|
||||
OKAY [ 1.616s]
|
||||
writing 'system'...
|
||||
OKAY [ 17.308s]
|
||||
finished. total time: 18.924s
|
||||
sending 'recovery' (6010 KB)...
|
||||
OKAY [ 0.193s]
|
||||
writing 'recovery'...
|
||||
OKAY [ 1.893s]
|
||||
finished. total time: 2.086s
|
||||
sending 'recoveryfs' (10240 KB)...
|
||||
OKAY [ 0.328s]
|
||||
writing 'recoveryfs'...
|
||||
OKAY [ 3.229s]
|
||||
finished. total time: 3.558s
|
||||
rebooting...
|
||||
|
||||
finished. total time: 0.005s
|
||||
```
|
||||
|
||||
Once the flashing is completed, the device will automatically reboot, and the LED on the back will light up again.
|
||||
|
||||
At this point, run `sudo dmesg |tail` to check for the following output:
|
||||
```
|
||||
[ 1033.836166] option 1-1.3:1.2: GSM modem (1-port) converter detected
|
||||
[ 1033.836636] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB0
|
||||
[ 1033.837179] option 1-1.3:1.3: GSM modem (1-port) converter detected
|
||||
[ 1033.837597] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB1
|
||||
[ 1033.838125] option 1-1.3:1.4: GSM modem (1-port) converter detected
|
||||
[ 1033.838575] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2
|
||||
[ 1033.839506] option 1-1.3:1.5: GSM modem (1-port) converter detected
|
||||
[ 1033.840027] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB3
|
||||
[ 1033.840560] option 1-1.3:1.6: GSM modem (1-port) converter detected
|
||||
[ 1033.840949] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB4
|
||||
```
|
||||
|
||||
If you see this output, it means that the firmware has been successfully flashed and the module is not bricked.
|
||||
|
||||
```
|
||||
cpi@raspberrypi:~/LE20B06SIM7600G22_cpi_arm64 $ sudo lsusb
|
||||
Bus 001 Device 008: ID 1e0e:9001 Qualcomm / Option SimTech, Incorporated
|
||||
```
|
||||
|
||||
# Useful AT commands
|
||||
|
||||
* check firmware version
|
||||
```
|
||||
echo -en "AT+GMR\r\n" | sudo socat - /dev/ttyUSB2,crnl
|
||||
+GMR: LE20B06SIM7600G22
|
||||
OK
|
||||
|
||||
```
|
||||
|
||||
* check sim card status
|
||||
```
|
||||
echo -en "AT+cpin?\r\n" |sudo socat - /dev/ttyUSB2,crnl
|
||||
+CPIN: READY
|
||||
OK
|
||||
```
|
||||
* check signal quality
|
||||
```
|
||||
echo -en "AT+CSQ\r\n" |sudo socat - /dev/ttyUSB2,crnl
|
||||
+CSQ: 20,99
|
||||
|
||||
OK
|
||||
```
|
||||
|
||||
* get imei
|
||||
```
|
||||
echo -en "AT+CGSN\r\n" |sudo socat - /dev/ttyUSB2,crnl
|
||||
|
||||
86263605126xxxx
|
||||
|
||||
OK
|
||||
```
|
||||
```
|
||||
echo -en "AT+CIMI\r\n" |sudo socat - /dev/ttyUSB2,crnl
|
||||
46001341620xxxx
|
||||
|
||||
OK
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user