I tried to follow the u-blox guide on YouTube to update firmware. The guide was created for the u-blox EVK-X20P evaluation kit, so I tried to follow it the best I could. I can’t get it to work.
I connected the USB-C port on the pHat to a USB-A port on my laptop running Windows 11. I can receive satellites. When I try to update firmware, I get a warning after a few seconds that COM5 is disconnected. I see more error messages, and then an traceback for an uncaught JavaScript exception. The only way I can reconnect is to power down the Pi completely and restart.
The ZED-X20P can only be updated via UART1. Sadly, it is not possible to update via its built-in USB port. This is a quirk of the X20P, other u-blox modules can be updated via USB.
The easiest solution is to buy the new Flex Breakout - at the link below - transfer your ZED-X20P Flex module to that and update using the “UART” USB connection. Channel A of the CH342 provides direct access to the ZED UART1.
It is possible to update the X20P while it is mounted on the pHAT, but it is much more involved:
Remove the pHAT from the Raspberry Pi
Connect pHAT USB-C to a power source (computer port, wall wart or battery pack)
Use a male-male jumper wire to link the 2x20-way GPIO header Pin 2 (5V) to Pin 1 (normally 3.3V)
This enables the main 3.3V regulator on the pHAT, providing 3.3V power to the ZED
Don’t connect anything to Pin 17 (normally 3.3V) as this will now be 5V
Use a 3.3V FTDI USB-UART cable or breakout and jumper wires to interface to:
GPIO Pin 8 (normally GPIO14/TXD) : this is connected to ZED RXD1
GPIO Pin 10 (normally GPIO15/RXD) : this is connected to ZED TXD1
GPIO Pin 6 : GND
Sorry for the inconvenience. Let me know if you need more help - or diagrams.
On GPS-28871, you need to connect a 3.3V “FTDI” (USB-UART) cable or breakout to the UART1 breakout pins and perform the upgrade using that. Please see the suggestions below.
It is not possible to upgrade over the X20P’s built-in USB connection. The USB-C connector on GPS-28871 can not be used for firmware upgrades.
It is OK to power the GPS-28871 via the USB-C for the upgrade
Connect GND on the X20P Breakout to GND / 0V on your FTDI Breakout
Connect TX1 on the X20P Breakout to the RX In pin on your FTDI Breakout
Connect RX1 on the X20P Breakout to the TX Out pin on your FTDI Breakout
The FTDI chip will appear as a COM port in u-center. Connect at 38400 Baud. Then follow the procedure in the video to upgrade.
Both will work for the Firmware upgrade. The only differences are price, drivers and connectors. You may need to install different drivers for the FTDI Breakout (micro-B) vs. the CH340C Breakout (USB-C).
You should be able to use any 3.3V USB-UART converter. Those are the two I would recommend from SparkFun.
It is possible to update the X20P via I2C. But, you need a board to act as the USB to I2C interface, emulating a UART interface. And you need to be careful with the I2C bus speed and hence the emulated Baud rate. The following worked for me:
Replace the start of setup() with the following, to select 38400 Baud and 100kHz bus speed:
void setup()
{
delay(2000); // Wait for ESP32 and GNSS to start up
mySerial.begin(38400); // Baud rate for u-center
myWire.begin(); // Start I2C
myWire.setClock(100000); // 100kHz
Connect the Thing Plus to your Windows PC over USB
Upload the modified sketch onto the Thing Plus - using the Arduino IDE
Use a Qwiic cable to connect the Thing Plus to the X20P Breakout
Be careful with I2C pull-ups. The X20P has built-in active pull-ups on the I2C bus. Additional external pull-ups can cause problems.
If you open a serial console / terminal emulator at 38400 Baud, you should see the standard NMEA stream from the X20P. You may need to reset the ESP32 before you see any NMEA. Close the serial console / terminal emulator afterwards!
Run the u-blox UBX Firmware Update executable (ubxfwupdate.exe) from a command prompt. ubxfwupdate.exe is installed with u-center.
I have the Thing Plus connected as COM10. I called ubxfwupdate.exe with:
----------CMD line arguments-----------
Image file: C:\Users\pc235\Documents\GNSS\UBX_20_HPG_202_ZED_F20P.329facb56ce18631d607fe15177834dc.bin
Flash: <compiled-in>
Fis: flash.xml
Port: \\.\COM10
Baudrates: 38400/38400/38400
Safeboot: 1
Reset: 1
AutoBaud: 0
Verbose: 2
Erase all: 1
Erase only: 0
Training sequence: 0
Chip erase: 1
Merging FIS: 1
Update RAM: 0
Use USB alt: 0
---------------------------------------
0.0 u-blox Firmware Update Tool version 24.11
0.0 Updating Firmware 'C:\Users\pc235\Documents\GNSS\UBX_20_HPG_202_ZED_F20P.329facb56ce18631d607fe15177834dc.bin' of receiver over '\\.\COM10'
0.0 - Opening and buffering image file
0.0 - Verifying image
0.0 - Got an encrypted image with footer info
0.0 - CRC Value : 737F7768
0.0 - Footer Version : 1
0.0 - Number of Images : 2
0.0 - Footer Size : 28
0.0 - Image Config Size : 40
0.0 - Image 0 Size : 668336
0.0 - Image 1 Size : 426320
0.0 - Trying to open port \\.\COM10
0.0 - Setting baudrate to 38400
0.3 - Received Version information
0.3 - Receiver currently running SW 'ROM LDR 1.00 (d225d8)'
0.3 - Receiver HW '000B0000', Generation 20.0
0.3 - Sending ROM CRC Poll
0.3 ROM CRC: 0x22018AE9
0.3 u-blox20 ROM1.00 hardware detected (0x22018AE9)
0.3 Getting Port connection to receiver
2.2 - Connected port is: I2C
2.2 Starting LDR TSK
2.2 - LDR TSK started successfully
2.2 Identify flash loader
2.3 - Uploader version 5.3 detected
2.3 Detecting Flash manufacturer and device IDs
2.3 - Flash ManId: 0x009D DevId: 0x6016
2.4 - Not merging anything
2.4 - Flash size: 4194304
2.4 - Flash block: 1024 x 4096
2.4 Stable clock enabled successfully
2.5 - Setting baudrate to 38400
2.8 Start Flash retention
3.9 - flash retention success
3.9 Chip erase started
3.9 Receiver info collected, downloading to flash...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
max retries: e: 0( 0) w: 0( 0)
311.2 FW download complete
311.2 Verifying Image on hardware
313.6 Firmware Verification and Flash update complete
313.6 Verify Flash retention
313.6 flash retention success
313.6 Rebooting receiver
313.6 Firmware Update SUCCESS
313.6 - Transfer time duration: 313.639404 sec
Like I say, this is purely for interest. I’m not recommending you update your X20P this way. I’m just saying that it is possible. It could be useful if I2C is your only option.
If anything goes wrong during the update, turn the GNSS off and back on again, and start again. The process is very robust. The GNSS will only apply the firmware update if it passes verification.