2021-09-13 06:10 AM
Hi there!
In the S2-LP datasheet it is stated that the typical delay is 40 us:
Does this mean that the host microcontroller must use a CSn low delay of at least 40 us when the S2-LP is in STANDBY or SLEEP mode and it wants to send an SPI command to put the S2-LP into the READY mode?
What is the consequence if a delay of 3 us is used? Must this delay of 40 us be respected on all SPI commands until the S2-LP is in READY state?
Thanks in advance,
Pieter
2021-09-15 08:37 PM
Thank you for bringing this up! I've been having weird issues with my S2-LP while trying to enter and exit STANDBY. I would send an SPI command without any delay while in the STANDBY state and came across all sorts of weird behaviour. Then I read your question and decided to give it a go, and everything is working smoothly again! So to answer your question, yes it appears you need the 40us delay, otherwise the transceiver can enter an unintended state.
2021-09-16 03:11 AM
Hi @RLind.3
Thanks for confirming my suspicion 😀 My customised version of the code strobed the READY command and waited for the READY IRQ instead of polling MC_STATUS. Under very rare circumstances the IRQ READY IRQ did not fire and my code locked up, waiting forever. I have updated my code to use 40 us delay and I'm polling MC_STATUS again as done in the X-CUBE-SUBG2 code:
void RadioPowerON(void)
{
S2LP_CMD_StrobeReady();
do{
/* Delay for state transition */
for(volatile uint8_t i=0; i!=0xFF; i++);
/* Reads the MC_STATUS register */
S2LP_RefreshStatus();
}
while(g_xStatus.MC_STATE!=MC_STATE_READY);
}
Interestingly, the X-CUBE-SUBG2 code has two #defines in s2868a1.h line 96 & 97 but they are never used as far as I can tell:
#define CS_TO_SCLK_DELAY 0x0200
#define CLK_TO_CS_DELAY 0x0200
Kind regards,
Pieter
2021-09-16 03:13 AM
P.S. It would be great if an ST support person would confirm this 😀