cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WL55 subghz radio low level hardware init.

D.Heink
Associate III

Hi,

im currently working on a project (STM32WL55) where i need to send data via LoRa. I plan to use the SubGHz HAL driver as it seems pretty low level and provides easy usage of the internal subghz spi.

While researching, i found AN5406 where it says in page 6 that i need to implement the HAL_SUBGHZ_MspInit function, but not how.

In stmwlxx_hal_subghz.c there is a weak function that doesn't do anything, and is meant to be overwritten:

/**
  * @brief  Initialize the SUBGHZ MSP.
  * @param  hsubghz pointer to a SUBGHZ_HandleTypeDef structure that contains
  *         the handle information for SUBGHZ module.
  * @retval None
  */
__weak void HAL_SUBGHZ_MspInit(SUBGHZ_HandleTypeDef *hsubghz)
{
  /* NOTE : This function should not be modified, when the callback is needed,
            the HAL_SUBGHZ_MspInit should be implemented in the user file
   */
 
  /* Prevent unused argument(s) compilation warning */
  UNUSED(hsubghz);
}

In HAL_SUBGHZ_Init it says that the function is meant to Init the low level hardware : GPIO, CLOCK, NVIC...

/* Init the low level hardware : GPIO, CLOCK, NVIC... */
    HAL_SUBGHZ_MspInit(hsubghz);

I initialise the hse, and the Subghz radio interrupt via MX, so

my question is, which low level hardware needs to be initialised in HAL_SUBGHZ_MspInit for the subghz radio to work.

5 REPLIES 5
Louis AUDOLY
ST Employee

Hello @D.Heink​ ,

You need to enable the SUBGHZ SPI clock and to initialize the radio interrupt.

You can fin an example of LoRa communication in the STM32Cube_FW_WL_V1.2.0, under "Projects\NUCLEO-WL55JC\Applications\SubGHz_Phy\SubGHz_Phy_Per". This example use only the LoRa communication so it can help you to configure your project !

I hope this helps you !

Regards

Louis

Thanks!

But doesn't the SubGHz_Phy_Per use the GFSK modulation?

Also, the SubGHz_Phy_Per doesnt employ the SubGHz HAL driver instead it uses the SubGHz_Phy middleware. So i can't use it as a reference.

D.Heink
Associate III

Okay, i read the section of AN5406 again, and realised that it does indeed give an explanation on how to implement the HAL_SUBGHZ_MspInit() function.

PWR: Enable wakeup signal of the sub-GHz radio peripheral.

I couldn't find what the wakeup signal of the sub-GHz radio peripheral is, can can somebody give me a hint?

Further i found that there is already a HAL_SUBGHZ_MspInit() overwrite where the interrupts get setup so that probelm is solved.

@Louis AUDOLY​ The SUBGHZ SPI clock is derived from the PCLK3 according to RM0453 page 300. Isn't it enabled with the normal clock initialisation from mx? If not where do i need to enable it manually?

D.Heink
Associate III

Nevermind, i found the SUBGHZ_Tx_Mode example and that answeres all my questions.