cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WL55: Subghz RADIO_GET_STATUS returns invalid data.

D.Heink
Associate III

Hi,

i'm currently working on a Project where i need to send some data via LoRa.

I've been struggeling to get a transmission going, so i decided to check the basics.

To test the radio, i went ahead and rebuilt the SUBGHZ_Tx_Mode example from the STMCubeWL on my board, implementing the exact code that the example uses.

The MX setup is identical .

When i tested, i found that the code fails the first time that data is received with this function call.

if (HAL_SUBGHZ_ExecGetCmd(&hsubghz, RADIO_GET_STATUS, &RadioResult, 1) != HAL_OK)
  {
    Error_Handler();
  }
HAL_StatusTypeDef HAL_SUBGHZ_ExecGetCmd(SUBGHZ_HandleTypeDef *hsubghz,
                                        SUBGHZ_RadioGetCmd_t Command,
                                        uint8_t *pBuffer,
                                        uint16_t Size)
{
  HAL_StatusTypeDef status;
  uint8_t *pData = pBuffer;
 
  if (hsubghz->State == HAL_SUBGHZ_STATE_READY)
  {
    /* Process Locked */
    __HAL_LOCK(hsubghz);
 
    ret = SUBGHZ_CheckDeviceReady(hsubghz);
 
    /* NSS = 0 */
    LL_PWR_SelectSUBGHZSPI_NSS();
 
    ret = SUBGHZSPI_Transmit(hsubghz, (uint8_t)Command);
 
    /* Use to flush the Status (First byte) receive from SUBGHZ as not use */
    (void)SUBGHZSPI_Transmit(hsubghz, 0x00U);
 
    for (uint16_t i = 0U; i < Size; i++)
    {
      ret = SUBGHZSPI_Receive(hsubghz, (pData));
      pData++;
    }
 
    /* NSS = 1 */
    LL_PWR_UnselectSUBGHZSPI_NSS();
 
    (void)SUBGHZ_WaitOnBusy(hsubghz);
 
    if (hsubghz->ErrorCode != HAL_SUBGHZ_ERROR_NONE)
    {
      status = HAL_ERROR;
    }
    else
    {
      status = HAL_OK;
    }

More specifically, the SUBGHZSPI_Receive function fills the byte with 0xFF, when the expected values go from 2 to 6.

I checked the return value of SUBGHZSPI_Receive, and it returns HAL_OK.

My question now is: Why does this happen and how can i fix this?

Any help is greatly appreciated.

1 REPLY 1
cgp
Associate

Hi @D.Heink ,

I am getting a similar error to yours. When retrieving the status from the SubGhz radio side, in line 147, I get that I am in Standby mode, instead of in Tx mode and the command status is 0x05, which is equivalent to "command execution failure (command successfully received but cannot be executed at this time, requested operating mode cannot be entered or requested data cannot be sent)" in the datasheet.

Did you find a way to solve your issue?

Thanks in advanced.