This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bootloader CDC ACM and BLE transport layers

I'm having some trouble setting up 2 transports (BLE + USB CDC ACM) with the secure_bootloader example. The changes I made were:

- Increased flash size for code space in the linker script

- Activated the POWER, CLOCK, APP_USBD, CDC etc. from the sdk_config.h file from pca10056_usb_debug and compiled the appropriate files. 

I am able to get the BLE transport to work when it's the only transport. However, when I manually prevent initialization of the BLE transport and only activate the USB transport (with the SOFTDEVICE_PRESENT), I get flash write and erase errors (NRF_INTERNAL_ERROR) during the DFU process. I also get error 0x92 (NRF_ERROR_IO_PENDING) in reading from CDC: <warning> nrf_dfu_serial_usb: Could not read from CDC. Error: 0x92.

Then I tried getting both transports running since I thought maybe the flash operations require SD initialization. Now when the BLE transport is  initialized first it would trigger nrf_drv_power_on_sd_enable() but ofcourse power module isn't initialized at this point so that causes an assert error. To fix this, I manually call nrf_drv_power_init() before initializing any transport. I also had to modify the VERIFY_SUCCESS(err_code) after nrf_drv_power_init() inside nrf_dfu_serial_usb.c to ignore the NRF_ERROR_MODULE_ALREADY_INITIALIZED error code. Now the two transports are initialized and BLE transport works as before but when attempting a USB DFU using nrfutil, I still get the CDC read error 0x92 and there is an attempt to shutdown the BLE transport which hangs at nrf_sdh_disable_request() as in my previous post.

Has anyone successfully combined the two transports? If so, could you please share how?

Thanks

Related