Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32WL : add robustness #15183

Merged
merged 2 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be part of this PR neither the commit (not related to the PR ,is it?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's about WL... :-)
I could make 2 commits at least !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true lets separate these. Should we however document deprecated features (at least a note there ?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xc0170 done


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