cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with USART1 on board B-L072Z-LRWAN1

LBasi.1
Associate

Hello, everyone.

I have a problem with the board B-L072Z-LRWAN1. 

I edited the End_Node project of I-CUBE-LRWAN in order to get some packets transmitted by a Decawave device connected to the B-L072-LRWAN1 board.

Obviously, I connected the TX-RX pins of my Decawave device to the RX-TX pins of my board (USART1 PA10 - PA9).

Such packets, once received and processed by the board, will be forwared to a Lora gateway for further processing.

The communication between the end node and Lora gateway doesn't seem to give any problems; however, I don't get any packet transmitted by the Decawave device on my B-L072-LRWAN1 if I use USART1.

I don't know why, but I believe that there are some problems with USART1 and the interrupt service routine.

For debugging purposes, I also checked that the Decawave packets are correctly sent and printed to the USART2 (connecting the TX pin of my Decawave to the RX pin of USART2 - PA3) of the B-L072-LRWAN1 board. I confirm there are no problems in this sense, my Decawave packets are correctly sent and printed to the console.

As proof of concept, I also implemented a basic interrupt function that transmits over USART2 the same character read in Tera Term and it worked.

If I try to edit the UART/GPIO parameters of the USART2 in order to receive Decawave packets on the RX pin of the USART1, nothing seems to work (except the communication with the Lora gateway).

I initialized the USART1 and interrupt service routine in the following way:

...
 
UART_HandleTypeDef 	huartHandle1;
 
void USART1_IRQHandler(void)
{
    HAL_UART_IRQHandler(&huartHandle1);
}
 
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{ 
   if (huart->Instance == USART1)
   {
        HAL_UART_Receive_IT(&huartHandle1, buff, 32);
         ...
    }
}
  
void gpioInit()
{
	GPIO_InitTypeDef GPIO_InitStruct;
	__GPIOA_CLK_ENABLE();
	GPIO_InitStruct.Pin      = GPIO_PIN_9|GPIO_PIN_10;
	GPIO_InitStruct.Mode  = GPIO_MODE_AF_PP;
	GPIO_InitStruct.Pull      = GPIO_NOPULL;
	GPIO_InitStruct.Speed  = GPIO_SPEED_LOW;
	GPIO_InitStruct.Alternate  = GPIO_AF4_USART1;
	HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
 
void huartHandleInit()
{
        __USART1_CLK_ENABLE();
	huartHandle1.Instance  = USART1;
	huartHandle1.Init.BaudRate = 115200;
	huartHandle1.Init.WordLength = UART_WORDLENGTH_8B;
	huartHandle1.Init.StopBits  = UART_STOPBITS_1;
	huartHandle1.Init.Parity  = UART_PARITY_NONE;
	huartHandle1.Init.Mode  = UART_MODE_TX_RX;
	huartHandle1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
	huartHandle1.Init.OverSampling = UART_OVERSAMPLING_16;
	HAL_UART_Init(&huartHandle1);
        HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
	HAL_NVIC_EnableIRQ(USART1_IRQn);
}
...
 
main()
{
   /* STM32 HAL library initialization*/
  HAL_Init();
 
  /* Configure the system clock*/
  SystemClock_Config();
 
  /* Configure the debug mode*/
  DBG_Init();
 
  /* Configure the hardware*/
  HW_Init();
 
  gpioInit();
 
  huartHandleInit();
 
  HAL_UART_Receive_IT(&huartHandle1, buff, 32);
 
  while (1)
  {
     ...
  }
}

What could be the problem of using the USART1 on board B-L072Z-LRWAN1?

Thanks in advance.

1 REPLY 1
Peter BENSCH
ST Employee

Maybe the reason is the pins PA9 and PA10 and therefore USART1 are fixed connected with the Murata LoRa module.

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.