Description
Operating System
Windows 11
IDE version
Arduino 2.3.4
Board
Feather nRF52840 Express
BSP version
1.6.1
Sketch
SD/listfiles
I'm using the Adafruit ADAlogger FeatherWing - SD and RTC
The card select needs to be set to 10.
What happened ?
My project is using the nRF52840 Express and a Adafruit lipo battery (500mAHr) and attempting to reduce current to extend the battery between charges. Discovered about 1mA increase of current from before SD.begin() and after its complete. Using the Nordic PPK2. Here is the current before the SD.begin (see the windowed area).
And the current after SD.begin is complete
I've determind this problem to be Nordics hardware errata: #195 but the suggested errata fix is buried into code found in 1.6.1\cores\nRF5\nordic\nrfx\drivers\src\nrfx_spim.c as shown below
void nrfx_spim_uninit(nrfx_spim_t const * p_instance) {
...
#ifdef USE_WORKAROUND_FOR_ANOMALY_195
if (p_spim == NRF_SPIM3)
{
*(volatile uint32_t *)0x4002F004 = 1;
}
#endif
...
}
but apparently the #define is not defined when this library function is compiled. If I manually add this code at some time after the file listing is complete, current reduces to the before SD.begin value. nrfx_spim_uninit() is called in the spi_transaction_end() function as each individual SPI transaction occurs, hence allowing me to use multiple SPI devices. Can the USE_WORKAROUND_FOR_ANOMALY_195 be defined when this library is compiled?
I see from Adafruit design guides that use of SPIM3 on battery powered projects is not recommended. Section "Using nRF52840 SPI on Battery Power". Can the guide suggest solutions other than circuitpython solutions.
For a temporary fix, I've followed the solution of switching to SPIM2 by defining #define SPI_32MHZ_INTERFACE 1 in my .ino file.
How to reproduce ?
- Run the example listfiles while monitoring with PPK2.
Debug Log
No response
Screenshots
No response