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

SUBGRF_SetTx() & SUBGRF_SetRx(): SUBGHZ_WaitOnBusy() long blocking delay in HAL_SUBGHZ_ExecSetCmd() #70

Open
pieterconradie opened this issue May 17, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request hal HAL-LL driver-related issue or pull-request. subghz SubGHz-related issue or pull-request.

Comments

@pieterconradie
Copy link

pieterconradie commented May 17, 2023

Hi there!

I have identified the issue in STM32CubeWL V1.3.0. See here:
https://github.com/STMicroelectronics/STM32CubeWL/blob/main/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_subghz.c#L1000

When SUBGRF_SetTx() or SUBGRF_SetRx() is called, it blocks for a long time (~1.2 ms) until the BUSY line goes low. The blocking delay is in HAL_SUBGHZ_ExecSetCmd() where SUBGHZ_WaitOnBusy() is called after the SET_TX (0x83) or SET_RX (0x82).

The long blocking delay prevents other code from executing or the processor core from going to sleep which wastes battery power. The consequence is even worse when SUBGRF_SetTx() or SUBGRF_SetRx() is called inside an interrupt.

I recommend that the blocking delay be removed and a separate polling function added to find out when the command has finished or that the blocking delay be moved to the start so that subsequent commands will wait until the previous one has finished. In most cases this will eliminate the unnecessary delay. I see that there is a HAL_SUBGHZ_STATE_BUSY but it does not look like it was properly implemented with this in mind (?).

UPDATE: I am developing on a NUCLEO-WL55JC1 board. According to the SX1261/2 datasheet the delay is not supposed to be that long(?):

table_8 2_switching_time

But this is what I measured with a logic analyzer:

set_rx_delay

Is there an explanation for the longer than expected blocking delay? Could it have to do with the DC-DC + TCXO as opposed to the LDO + Crystal option?

Thanks in advance,
Pieter
https://piconomix.com

@TOUNSTM
Copy link
Contributor

TOUNSTM commented May 24, 2023

Hello @pieterconradie,

Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.

With regards,

@ALABSTM ALABSTM added the hal HAL-LL driver-related issue or pull-request. label Sep 5, 2023
@KRASTM KRASTM self-assigned this Oct 11, 2024
@KRASTM KRASTM added enhancement New feature or request subghz SubGHz-related issue or pull-request. labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hal HAL-LL driver-related issue or pull-request. subghz SubGHz-related issue or pull-request.
Projects
None yet
Development

No branches or pull requests

5 participants