Skip to content

Commit

Permalink
STM32WL : add LORA robustness
Browse files Browse the repository at this point in the history
Improvment to support extensive tests
  • Loading branch information
jeromecoutant committed Nov 29, 2021
1 parent 2eb06e7 commit 51be1d4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Expand Up @@ -605,6 +605,10 @@ void STM32WL_LoRaRadio::init_radio(radio_events_t *events)
_tx_timeout = 0;
_rx_timeout = 0;

hsubghz.Init.BaudratePrescaler = 0;
hsubghz.ErrorCode = 0;
hsubghz.State = HAL_SUBGHZ_STATE_RESET;

//call to HAL_SUBGHZ_Init() for MSPInit and NVIC Radio_IRQ setting
error_value = HAL_SUBGHZ_Init(&hsubghz);

Expand Down Expand Up @@ -766,16 +770,20 @@ void STM32WL_LoRaRadio::write_opmode_command(uint8_t cmd, uint8_t *buffer, uint1
{
HAL_StatusTypeDef error_value;

core_util_critical_section_enter();
error_value = HAL_SUBGHZ_ExecSetCmd(&hsubghz, (SUBGHZ_RadioSetCmd_t)cmd, buffer, size);
MBED_ASSERT(error_value == HAL_OK);
core_util_critical_section_exit();
}

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

core_util_critical_section_enter();
error_value = HAL_SUBGHZ_ExecGetCmd(&hsubghz, (SUBGHZ_RadioGetCmd_t)cmd, buffer, size);
MBED_ASSERT(error_value == HAL_OK);
core_util_critical_section_exit();
}

void STM32WL_LoRaRadio::write_to_register(uint16_t addr, uint8_t data)
Expand Down
15 changes: 13 additions & 2 deletions targets/TARGET_STM/TARGET_STM32WL/README.md
Expand Up @@ -31,11 +31,22 @@ Only M4 core is currently used by mbed-os applications.
- Total FLASH is 256KB
- RAM: 64 KB

**[tip] mbed-os export feature**

## CUSTOM boards
`mbed export -m NUCLEO_WL55JC -i uvision6`

This needs to locally add a patch:
https://github.com/ARMmbed/mbed-os/pull/10424/files

`mbed export -m NUCLEO_WL55JC -i iar`

Check https://github.com/ARMmbed/stm32customtargets
This needs to locally add a patch:
https://github.com/jeromecoutant/mbed/blob/IAR_EXPORT_SUPPORT/tools/export/iar/iar_definitions.json#L62-L64


## CUSTOM boards

Check https://github.com/ARMmbed/stm32customtargets#stm32wl

# LoRa

Expand Down

0 comments on commit 51be1d4

Please sign in to comment.