This article demonstrates how to use an external MCU to upgrade Silabs Bluetooth devices under NCP mode. It aims to provide a base code, which is as simple as possible, to make it can be easily migrated to the real use case. Before starting with this article, please have a look at the below resources.
Above resources could be a good starting point, you can get information such as what is NCP mode, how to generate gbl file, how to do a simple DFU and verify it, etc.
SDK – Simplicity Studio, 32-bit MCU and Bluetooth SDK (The latest version to the date is always recommanded)
Kits – EFM32PG(SLSTK3401) acts as NCP HOST and any Bluetooth compatiable EFR32 board acts as NCP TARGET
Baud rate: 115200
Data bits: 8
Stop bit: 1
Flow control: False
Both kits are powered by USB. The connection between them is shown as below table.
|Expansion header on EFM32PG||Expansion header on EFR32BG|
|Pin 9 (PD10) - UART TX||Pin 14 (PA1) - UART RX|
|Pin 11 (PD11) - UART RX||Pin 12 (PA0) - UART RX|
A simple way to verify the UART DFU is to program a firmware firstly, then use the host device to upgrade it with another firmware. Use the difference between these 2 firmwares to identify the success of UART DFU.
To use the UART DFU functionality, make sure you have flashed the "BGAPI UART DFU Bootloader" to your board.
NOTE: the UART settings of the gecko bootloader project should align with the NCP target. Follow below steps to create and program the Gecko bootloader to your board.
A simple way to identify the success of device firmware update is by the device name. The default device name in the "NCP target - Empty" project is "BLE Device", we will firstly program the board with this name, then generate a GBL file with a different name. Finally, we use the EFM32PG board to upgrade it, and use the name to verify if it succeeds. Follow below steps to create and flash the NCP target for the EFR32BG board.
#define HAL_UARTNCP_FLOW_CONTROL HAL_UART_FLOW_CONTROL_NONE #define HAL_VCOM_ENABLE (0)
The host application will read the GBL file as stream, then send it to the NCP target device after it is booted into DFU mode. Programming the gbl file to its unused area of flash is the simplest way for a host application to read it out.
#define GBL_FILE_START_ADDR 0x7800 #define GBL_FILE_SIZE 0x27AD0
The GBL_FILE_START_ADDR is the starting address you program the full.bin to, and the GBL_FILE_SIZE is the recorded file size in the previous step 6. 4. Use Simplicity Commander to flash the full.bin file with offset GBL_FILE_START_ADDR. See figure 1. 5. Build and flash the EFM32PG board.
Figure 1. Simplicity Commander
Figure 2. Serial Terminal Output
I want to do reverse of what you explained above. My client has a requirement of upgrading bootloader and firmware of MCU Tiny Gacko family EFM32TG11 using Radio board as host.
So according to my understanding BGlib and BGApi will not work. Can you please refer some code where migthy gecko uses USART0/USART1 to flash an Tiny/Gaint gecko MCU's.