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

Using SPI after disable SD

Hello,

I have got a problem with use SPI. I get hard fault after call spi_master_open(), exactly when sd_nvic_ClearPendingIRQ function is call. This situation is so specific because i use SD at the begining and after that i disable it and try to use SPI. How should i work with spi after disable SD?

Regards Michal,

Parents
  • You use SD API calls (the ones that begin with sd_) only when your softdevice is enabled. If you disable your softdevice, you should use non-sd ones, so something like NVIC_ClearPendingIRQ in this case.

  • Probably because you were using the nosd stubs for those functions which are provided in the SDK for simple source compatibility when a softdevice isn't in use and just call the NVIC_ routines directly. Now you're actually using a softdevice you'll be calling the real sd_ ones from one of the softdevice header files and, as Wojtek correctly says, those you cannot call when the softdevice is disabled as they actually call into it via a SVC call.

    So either don't disable the softdevice, it doesn't do very much if there's no BTLE stuff going on, or change the code to call the NVIC_ function directly, either conditionally on whether the softdevice is enabled or not, or just call it in all cases.

Reply
  • Probably because you were using the nosd stubs for those functions which are provided in the SDK for simple source compatibility when a softdevice isn't in use and just call the NVIC_ routines directly. Now you're actually using a softdevice you'll be calling the real sd_ ones from one of the softdevice header files and, as Wojtek correctly says, those you cannot call when the softdevice is disabled as they actually call into it via a SVC call.

    So either don't disable the softdevice, it doesn't do very much if there's no BTLE stuff going on, or change the code to call the NVIC_ function directly, either conditionally on whether the softdevice is enabled or not, or just call it in all cases.

Children
No Data
Related