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.

  • "because softdevice restricts direct access to NVIC (and lots more) and you cannot use it directly."

    That's actually not true. The softdevice doesn't restrict access to the NVIC, and no-longer actually restricts access to much else since recent revisions. Calling via the sd_NVIC_* function just does an extra check that you're not trying to fiddle with an interrupt the softdevice is using. If you know you're not, and the SPI isn't used by the softdevice, it's fine to call the NVIC_ routines directly, and faster too.

Reply
  • "because softdevice restricts direct access to NVIC (and lots more) and you cannot use it directly."

    That's actually not true. The softdevice doesn't restrict access to the NVIC, and no-longer actually restricts access to much else since recent revisions. Calling via the sd_NVIC_* function just does an extra check that you're not trying to fiddle with an interrupt the softdevice is using. If you know you're not, and the SPI isn't used by the softdevice, it's fine to call the NVIC_ routines directly, and faster too.

Children
No Data
Related