Skip to content

Commit fb07b7a

Browse files
committed
STM32WL : add LORA robustness
Improvment to support extensive tests
1 parent f609a52 commit fb07b7a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,10 @@ void STM32WL_LoRaRadio::init_radio(radio_events_t *events)
605605
_tx_timeout = 0;
606606
_rx_timeout = 0;
607607

608+
hsubghz.Init.BaudratePrescaler = 0;
609+
hsubghz.ErrorCode = 0;
610+
hsubghz.State = HAL_SUBGHZ_STATE_RESET;
611+
608612
//call to HAL_SUBGHZ_Init() for MSPInit and NVIC Radio_IRQ setting
609613
error_value = HAL_SUBGHZ_Init(&hsubghz);
610614

@@ -766,16 +770,20 @@ void STM32WL_LoRaRadio::write_opmode_command(uint8_t cmd, uint8_t *buffer, uint1
766770
{
767771
HAL_StatusTypeDef error_value;
768772

773+
core_util_critical_section_enter();
769774
error_value = HAL_SUBGHZ_ExecSetCmd(&hsubghz, (SUBGHZ_RadioSetCmd_t)cmd, buffer, size);
770775
MBED_ASSERT(error_value == HAL_OK);
776+
core_util_critical_section_exit();
771777
}
772778

773779
void STM32WL_LoRaRadio::read_opmode_command(uint8_t cmd, uint8_t *buffer, uint16_t size)
774780
{
775781
HAL_StatusTypeDef error_value;
776782

783+
core_util_critical_section_enter();
777784
error_value = HAL_SUBGHZ_ExecGetCmd(&hsubghz, (SUBGHZ_RadioGetCmd_t)cmd, buffer, size);
778785
MBED_ASSERT(error_value == HAL_OK);
786+
core_util_critical_section_exit();
779787
}
780788

781789
void STM32WL_LoRaRadio::write_to_register(uint16_t addr, uint8_t data)

0 commit comments

Comments
 (0)