From 4c0f897953aa8d478f3c941e75d3b2eb5611531d Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 7 May 2023 18:24:34 +0200 Subject: Power optimization - Improve SPI sleep mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensure that all pins are set to their default configuration during sleep mode. Disable the workaround for FTPAN58 (SPI freezes when transfering a single byte) at the end of the transfer. This disables the resources needed for the workaround. Those changes reduce the power usage by 430-490µA. --- src/drivers/SpiMaster.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/drivers/SpiMaster.cpp') diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp index 234884ab..1a2fab9c 100644 --- a/src/drivers/SpiMaster.cpp +++ b/src/drivers/SpiMaster.cpp @@ -204,6 +204,9 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size) { ; nrf_gpio_pin_set(this->pinCsn); currentBufferAddr = 0; + + DisableWorkaroundForFtpan58(spiBaseAddress, 0, 0); + xSemaphoreGive(mutex); } -- cgit v1.2.3-70-g09d2