From 51f792a7cbd5edc3dff8b400891d26e6e4d892dc Mon Sep 17 00:00:00 2001 From: Maarten van der Schrieck Date: Sun, 16 Jul 2023 10:04:54 +0200 Subject: [PATCH] Fix register corruption due to colliding SPI transactions in FSK In FSK Tx, the Dio1 interrupt may already fire while the SPI transaction for SetOpMode is still in progress. This leads to registers 0x02 and further being overwritten with junk data. This is solved by disabling interrupts for this specific SetOpMode call. --- src/radio/sx1276/sx1276.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/radio/sx1276/sx1276.c b/src/radio/sx1276/sx1276.c index fa89bbaf9..c373d0dbd 100644 --- a/src/radio/sx1276/sx1276.c +++ b/src/radio/sx1276/sx1276.c @@ -1125,7 +1125,9 @@ static void SX1276SetTx( uint32_t timeout ) SX1276.Settings.State = RF_TX_RUNNING; TimerStart( &TxTimeoutTimer ); + CRITICAL_SECTION_BEGIN(); SX1276SetOpMode( RF_OPMODE_TRANSMITTER ); + CRITICAL_SECTION_END(); } void SX1276StartCad( void )