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

Very simple SPI bootloader

Hi,

I'm implementing a simple bootloader which will not use BLE.

  • Application will transfer the data from mobile devices using BLE and this data will be stored to external SPI flash memory. I've already managed to make writing/reading data over SPI.
  • Custom bootloader should only read and verify data from external SPI flash and write that data to nRF flash. Bootloader should be able to update any address on the chip except itself, meaning that we want this bootloader to be able to update SoftDevice also. After it flashes what it needs to flash, it should go into newly flashed application.

I have trouble understanding vector mapping and how to do it right. Can someone please give an example with a bit more explanation?

Thnx!

  • I've taken "serial single bank bootloader" as my project. When I create and run timer in it, it does not run. When I try to printf (UART put...) nothing happens. I believe SPI won't work either, didn't had the time to test it today.

    Any ideas why?

  • SPI hangs the entire bootloader when trying to initialize it @ spi_master_init_hw_instance(NRF_SPI0, SPI0_TWI0_IRQn, p_spi_instance, p_spi_master_config->SPI_DisableAllIRQ);

  • I would've based this on the OTA bootlaoder if you're planning to receive the image over BLE to SPI flash. SPI is not really the transport layer for the bootloader if I have understood you correctly.

    UART is used by the serial bootlaoder by default, so it's reinitialized after you have enabled app trace. Not sure why SPI did not work though. You can try to debug the bootloader to see what the reason may be.

  • Why OTA bootloader? I don't need BLE or UART in my bootloader. The application(normal application everyone has) will transfer the update to SPI flash when device is operating normally. Meaning I have SD (BLE usage) only in my app. When application transfers the file it raises the flags and restarts the nRF. Bootloader checks the flags and only uses SPI to transfer data from SPI flash to nRF flash. My bootloader must only have SPI driver for transfer, must be able to flash nRF, it should use timers for LED blinking and UART for debugging(printing on terminal). Bootloader does not use UART or BLE for file transfer, the application does the file transfer when in normal operation. Bootloader just flashes the data. At least that is the idea.

    For now, UART does not work, timer using scheduler does not work and SPI does not work. I'll try to debug SPI tomorrow and see what went wrong.

  • Ok I see, you want to only use the bootloader to load the images from SPI flash to the nRF51 that previously received over BLE in the application. Then it will be a entirely different implementation of the bootloader than the one we have in our SDK (simpler).

Related