cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WL problems with sending data. SOLVED.

RobMBSos
Associate

Hi!
EDIT 4: it was solved, and the solution at the end of the post.
I did a hardware design based on the STM32WL55 chip + Balun and one line for controlling the radio, FE_CTRL1. I modified the HAL radio library for all the SET-RESET only using RF_SW_CTRL1 and added the RF_TCXO init and its VDD value 3V0.
The problem is that I can't communicate fully between the device and the network; it connects, sends the data (I see on the NS), and then freezes. I added some "logs" to print through the UART to check the process.

 

Normal working:
OnMacProcessNotify
32s099:MAC rxDone
32s101:UpdateRxSlotIdleState
OnTxData

###### ========== MCPS-Confirm =============
###### U/L FRAME:0001 | PORT:2 | DR:0 | PWR:5 | MSG TYPE:UNCONFIRMED
OUT OF IF - ELSE
RESTORE MAIN TASK
OnRxData
###### D/L FRAME:0000 | PORT:0 | DR:10 | SLOT:1 | RSSI:-29 | SNR:9
OnRxData END
Edit, I tried called the send task right after connecting and this happens:
SendTxFrame Init
81s196:TX on freq 904100000 Hz at DR 0
81s198:SEND REQUEST
SendTxFrame END
OnMacProcessNotify
81s569:MAC txDone
81s569:ProcessRadioTxDone
86s552:RX_1 on freq 923900000 Hz at DR 10
OnMacProcessNotify
86s655:MAC rxDone
86s655:ProcessRadioRxDone

 

EDIT2: it seems it is related to RX_2, right?
Despite that, I am having difficulty using a JTAG debugger through the SWDIO to see which part of the code is freezing. Any ideas I can test?
EDIT1(more information):
Part of the SCH

RobMBSos_0-1697482106536.jpeg

I am using the Balun WL-02D3 and a BGS12SN6 RF switch. I modified part of the code in stm32wlxx_nucleo_radio.c like this:

 

int32_t BSP_RADIO_Init(void)
{
  GPIO_InitTypeDef  gpio_init_structure = {0};
  
  /* Enable the Radio Switch Clock */
  RF_SW_CTRL1_GPIO_CLK_ENABLE();
  
  /* Configure the Radio Switch pin */
  gpio_init_structure.Pin   = RF_SW_CTRL1_PIN;
  gpio_init_structure.Mode  = GPIO_MODE_OUTPUT_PP;
  gpio_init_structure.Pull  = GPIO_NOPULL;
  gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  
  HAL_GPIO_Init(RF_SW_CTRL1_GPIO_PORT, &gpio_init_structure);
  
  gpio_init_structure.Pin = RF_TCXO_VCC_PIN;
  HAL_GPIO_Init(RF_TCXO_VCC_GPIO_PORT, &gpio_init_structure);

  HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET); 
  HAL_GPIO_WritePin(RF_TCXO_VCC_GPIO_PORT, RF_TCXO_VCC_PIN, GPIO_PIN_SET);

  return BSP_ERROR_NONE;
}
int32_t BSP_RADIO_DeInit(void)
{
  RF_SW_CTRL1_GPIO_CLK_ENABLE();

  /* Turn off switch */
  HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
  

  
  /* DeInit the Radio Switch pin */
  HAL_GPIO_DeInit(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN);



  return BSP_ERROR_NONE;
}
int32_t BSP_RADIO_ConfigRFSwitch(BSP_RADIO_Switch_TypeDef Config)
{
  switch (Config)
  {
    case RADIO_SWITCH_OFF:
    {
      /* Turn off switch */
      HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
      break;      
    }
    case RADIO_SWITCH_RX:
    {
      /*Turns On in Rx Mode the RF Switch */
      HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
      break;
    }
    case RADIO_SWITCH_RFO_LP:
    {
      /*Turns On in Tx Low Power the RF Switch */ 
      HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_SET); 
      break;
    }
    case RADIO_SWITCH_RFO_HP:
    {
      /*Turns On in Tx High Power the RF Switch */
      HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_SET);
      break;
    }
    default:
      break;    
  }  

  return BSP_ERROR_NONE;
}

 


TTN console:
1) Gateway:

RobMBSos_1-1697482173421.jpeg


2) Application:

RobMBSos_2-1697482182152.jpeg

 


EDIT3: Hard fault view.

RobMBSos_0-1697481026898.png

SOLUTION:
It was very easy, but took me longer than I thought. In the file sys_app.c there is a function that was making the MCU halt, despite I had no debug lines activated. It added the comment block, and it worked like a charm.

RobMBSos_0-1697602339543.png

 



Best,
Roberto.

0 REPLIES 0