Soon after the wakeup of the RAK4260, the USART interface does not works properly, throwing garbage over the serial. The only way to overcome this issue is to apply a long delay of 2000 ms after the wakeup, then it works normally. But this fix is not ideal, since my device is battery powered, and every wasted millisecond counts.
Before sleep, I set all peripherals down, including USART, I2C, ADC, HAL_RADIO, RF SWITCH POWER (SKY133373 on PA28) and the TCX0 (on PB03). The sleep mode works fine, with just some few uA of consumption.
I wonder if there is some other peripheral missing initialization, or any other clock that must be always on, since I expected the wakeup to be much more fast.
We are using the RAK4260 module in our custom board. It contains some I2C and SPI peripherals, USART interface, and a NFC chip. You can see the pins used on attached image.
The firmware was initialized based on RAK4260-LoRaNode-demo.
@beegee I think I found the problem here.
All the peripherals are using the main GCLK0 clock, generated by the DFLL.
The DFLL was feeded by the 32kHz clock generated from the XOSC32K oscillator.
But the XOSC32K was disabled during standby, so every wakeup it was necessary to wait for the STARTUP_TIME (65536 cycles, or 2 seconds).
Setting the CONF_CLOCK_XOSC32K_RUN_IN_STANDBY = true in “conf_clocks.h” solved the problem.