cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_Init() bug for more than one UART setting

SVora.4
Associate

I am working on a LoRaWAN and GNSS project. I have found one inconsistent operation when try to configure UART1 for GNSS connection. UART2 is used as PRINTF for logging.

 

Procedure to produce bug:

  1. Use I-CUBE-LRWAN example as the codebase.
  2. Add code from X-CUBE-GNSS into the project.
  3. Call GNSS_UART_Init().

 

Effect of bug:

  1. PRINTF() not work.
  2. UART1 is not configured.

 

I have tracked down to the code of HAL_UART_Init() and found that a single HAL_UART_MspInit() callback is invoked for any UART. Since the HAL_UART_MspInit() function is provided in the vcom.c so this caused the bug.

 

3 REPLIES 3
Andrea Palmieri
ST Employee

Hi,

your setup is an example of what the STM32ODE program provdes as Function Packs, in the sense that two or more functionalities are combined in the same package (in your case, LoRa and GNSS). In such cases, it could happen that some resources (e.g., the UART bus) are shared between different components and it is up to the user to properly define the Init/DeInit functions/services.

In the near future, the CubeMX tool should ease this kind of setup providing also the support for Function Packs.

Regards

Andrea

Hi,

I want to use the USART2 to read a sensor.

To do this i had to overwrite the HAL_UART_MspInit()  function in vcom.c.

The code seems to work fine but with one problem. The power consumption in sleepmode went from <2uA to 4mA.

Do you have any idea why this is happening?

Mabra.3
Associate II

hiii bro

i know you are asking, but i think you can help me in my problem:

I use the node B-L072Z-LRWAN1 with the example “end node�? of the stack “STM32CubeExpansion_LRWAN�?, the objectif it’s to send data of sensor to TTN. and I managed to send “int�? or "floa"t without problem to my TTN as first step.

on the other hand, I made a program of UART communication of the “B-L072Z-LRWAN1�? thanks to STM32CubeMX, and it’s working well.

Unfortunately I don’t know how integrated all the code that STM32CubeMX generated in the “end node�? project to send my UART data.

thanks in advence.