Hi,
I'm working on a bootloader that combines both the BLE and UART transport layers. We have custom hardware containing the nRF52832 chip running on SDK 15.3, and we're using softdevice s132 v6.1.1.
I started with the secure BLE bootloader example pca10040_ble_debug and then slowly added in the UART transport layer. I did this by first adding the file nrf_dfu_serial_uart.c to the project and then working through any errors when building in SES. Roughly, from memory, I think it involved the following additional changes to the project:
- Added these additional files:
- nrf_dfu_serial.c
- nrf_drv_uart.c
- nrfx_uart.c
- nrfx_uarte.c
- nrfx_prs.c
- slip.c
- Added these additional include paths:
- ../../../../../components/libraries/slip
- ../../../../../integration/nrfx/legacy
- ../../../../../modules/nrfx/drivers/include
-
../../../../../modules/nrfx/drivers/src/prs
- Merging the sdk_config.h files from both the pca10040_ble_debug and pca_10040_uart_debug example projects.
The project builds without errors, but when running, I do not see dfu_targ advertising, and timed out when trying to perform a DFU over UART using nrfutil. Debugging through the issue, the error occurs when trying to enable the softdevice when initializing the BLE DFU transport layer. I get the following debug printout:
<info> app: Entering DFU mode. <debug> app: Initializing transports (found: 2) <debug> nrf_dfu_ble: Initializing BLE DFU transport <debug> nrf_dfu_ble: Setting up vector table: 0x00072000 <debug> nrf_dfu_ble: Enabling SoftDevice. <debug> app: Failed to initialize transport 0, error 4096 <error> app: Could not initalize DFU transport: 0x00001000 <error> app: Received an error: 0x00000003!
Error code 4096 is "NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN" which is "unknown LFCLK source". However, I don't think this is really the issue since it is set up the same way as always when bootloaders, softdevices, applications have had no issue running. Also, to further debug, I removed the file nrf_dfu_serial_uart.c from the project, cleaned, and then built again and the softdevice enabled without issue. I even saw dfu_targ advertising. Which means that the issue is with adding in the additional transport layer, but I don't know why it would cause an unknown LFCLK source error to occur.
Wondering if it was a global issue with having multiple transport layers, I edited the project file to list nrf_dfu_serial_uart.c first so it would be the first transport layer initialized and it initialized successfully with the following debug printout:
<info> app: Entering DFU mode. <debug> app: <debug> nrf_dfu_serial_uart: serial_dfu_transport_init() <debug> nrf_dfu_serial_uart: serial_dfu_transport_init() completed <debug> nrf_dfu_ble: Initializing BLE DFU transport <debug> nrf_dfu_ble: Setting up vector table: 0x00072000 <debug> nrf_dfu_ble: Enabling SoftDevice. <debug> app: <error> app: Could not initalize DFU transport: 0x00001000 <error> app: Received an error: 0x00000003!
Lastly, after doing a lot of research online, I noticed that a lot of other people's issues stemmed from FLASH or RAM size / placement. I tried changing the values but it did not have any effect. Nor do I think it's the issue since there was no suggesting in the debug printouts to change any of the RAM or FLASH values. But for the record, here are my values:
FLASH_PH_START=0x0 FLASH_PH_SIZE=0x80000 RAM_PH_START=0x20000000 RAM_PH_SIZE=0x10000 FLASH_START=0x72000 FLASH_SIZE=0xc000 RAM_START=0x200057b8 RAM_SIZE=0xa848
**NOTE: I also tried running the project on a DK board and the same issue happens.
Any suggestions or help would be much appreciated. Thanks.