This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

using spi in bootloader

Hi,

i'm doing my own bootloader and i want to use external flash to download image trough a spi. The bootloader project based on example from SDK11, now just an external flash interface is added by me.The problem is that spi only works if softdevice is already enabled ( calling nrf_drv_spi_xfer(); before ble_stack_init(!app_reset); hangs system and no spi activity on oscilloscope). Is my suggestion true? If so, how to enable spi functionality without the softdevice?

Parents
  • No it's not true - the spi driver does not need the softdevice. You can see that for yourself just by looking through the c code, there are no sd_ calls in there. That driver works just fine standalone.

    So your problem may have something else to do with the fact it's compiled for use with a softdevice but it's not the spi driver.

    So hit break in your debugger and find out where you are, possibly you asserted or an error code was returned and you're sitting in a spin loop in an error handler.

  • Hi, RK

    I understand the spi does not require SD but in this my experience it doesn't work without properly enabled SD, and i wonder why. Yes, the project uses SD, it is a bootloader for DFU via BLE.

    nrf_drv_spi.c, line 495, while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){} In that line the program is looped. That means we are waiting for an ending flag. In debugger all NRF_SPI1 module registers settings seems to be correct, but no any physical activity on spi pins. Direct write in debugger in NRF_SPI1->START_TASK also has no effect. It seems like there is no any clock source for the spi module.

Reply
  • Hi, RK

    I understand the spi does not require SD but in this my experience it doesn't work without properly enabled SD, and i wonder why. Yes, the project uses SD, it is a bootloader for DFU via BLE.

    nrf_drv_spi.c, line 495, while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){} In that line the program is looped. That means we are waiting for an ending flag. In debugger all NRF_SPI1 module registers settings seems to be correct, but no any physical activity on spi pins. Direct write in debugger in NRF_SPI1->START_TASK also has no effect. It seems like there is no any clock source for the spi module.

Children
No Data
Related