STM32CubeWL icon indicating copy to clipboard operation
STM32CubeWL copied to clipboard

SUBGHZ HAL driver using SPI polling and not DMA... too slow

Open pieterconradie opened this issue 2 years ago • 1 comments

Hi there!

I have measured the SPI comms using a logic analyzer: SUBGHZ_SPI_timing

As you can see there is plenty room for improvement using DMA instead of polling. I'm referring to stm32wlxx_hal_subghz.c SUBGHZSPI_Transmit() and SUBGHZSPI_Receive(): https://github.com/STMicroelectronics/STM32CubeWL/blob/main/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_subghz.c#L1626-L1735

It would be better to formulate the SPI packet for transfer and then use DMA. This means that a HAL_SUBGHZ_ReadRegisters() would have to be rewritten: https://github.com/STMicroelectronics/STM32CubeWL/blob/main/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_subghz.c#L863-L917

These unnecessary delays between each SPI byte will impact battery life. It is most notable when transmitting or receiving a large packet.

Best regards, Pieter https://piconomix.com

pieterconradie avatar Mar 28 '23 07:03 pieterconradie

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, Rania

RJMSTM avatar Mar 28 '23 12:03 RJMSTM