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

Can not get SPI control back after PPI?

Hello,

I am trying to implement a clean shutdown process, but running into some issues. The flow of the SPI use is as listed here:

  1. Initialize SPI instance and program connected peripheral device via SPI. The calls being used are nrf_drv_spi_init and nrf_drv_spi_transfer with interrupt handler to check spi_tx_done flag. This works fine.

  2. Switch to PPI after everything is setup, the interrupts of the SPI instance is disabled using nrf_spim_int_disable. Transfer is started and held using nrf_drv_spi_xfer with the no_event and on_hold flags. PPI channel assigned and enabled. This also works fine.

  3. I'd like to issue a shutdown command to the peripheral device for a clean system power down.

3a) So first I disconnected all BLE connections, and stopped some ble services.
3b) Then I disabled the PPI channels, trigger sources and some timers used.
3c) Then I try to enable the interrupts and get back the CS control (CS is fine), but anything else I do with this SPI instance hangs the system (as I have a checker in the main loop), and system shutdown is commented out currently, for example, enabling interrupts back hangs the system, do a spi transfer hangs the system even bypassing while(!spi_tx_done) with a delay, uninitialization and initialization of the SPI does not hang the system, and appears to be working, since the enabled interrupts are at default if the instance is uninitialized. What could causing issues for this usage? What should I check into?

Any help is greatly appreciated.

Thanks

FI

Related