We're working on a board with an nRF52840 running BLE with softdevice S140 and SDK 17. The board has an external SPI flash, and when we realized that SPIM3 can be run at higher speeds than the other SPIM instances, we thought we'd use that to speed up all of our transfers. But we immediately noticed lots of intermittent bit errors when reading or writing our external SPI flash on SPIM3 at 32MHz. There were also errors at 16MHz, but they generally seemed to be less. We looked at the signal and it didn't seem to be an obvious signal integrity issue, and after lots of testing it really seemed to be a timing issue, and we tracked it down to being an issue when BLE was actively in use (such as when scanning for advertisements).
Then I happened to check the errata, and I noticed anomaly 244. "QSPI: External flash and QSPI returns erroneous data when the SoftDevice is running."
We're not using it in QSPI mode but I bet that it applied to non-QSPI SPIM3 too, and I think I was right. Now when we prepare to do any SPIM3 transfer, we call sd_clock_hfclk_is_running() to see if HFCLK is "running" (which I think actually means it's using HFXO), and if it's not running, we call sd_clock_hfclk_request(). This seems to have fixed the issue, but I just wanted to make sure I'm approaching the workaround correctly.
- Is it expected that this anomaly would apply to SPIM3 in single SPI mode and not just QSPI?
- Does this workaround sound like the right approach?
- Are there any drawbacks to using this workaround? Is power consumption higher when HFCLK is running on HFXO?
- Should we call sd_clock_hfclk_release() at the end of SPI activity, or might we be interrupting some other process that needs HFCLK? (Do we need to manually coordinate HFCLK status with the rest of our application to make sure nothing else needs it before we turn it off?)
Thanks.