Skip to main content
andy2
Associate II
June 3, 2015
Question

HAL Driver on STM32F051 and STM32L051 differences?

  • June 3, 2015
  • 1 reply
  • 611 views
Posted on June 03, 2015 at 05:14

Must say the CubeMX generation tool is very good, and it really does make everything simpler. However, I run into a situation where I am using the STM32L051 and STM32F051 to test on a project connecting to the bluetooth module. What I have done is very simple, which is to use interrupt to capture one character, and send from UART1 to UART2, and from UART2 to UART1. UART1 is using CTS/RTS flow control, while UART2 is just using RX and TX.

Both sets of code are generated by CubeMX with the same settings on pins, baud rate... etc. Also tested by connecting USB UART converters. When I type one character on one putty window, the other will appear. However, when UART1 is connected to my module, and it is sending at high speed, STM32L051 will return some kind of repeated characters, for example, ''READY.'' will become ''REEDDY''. As the STM32F051K8U6 and STM32L051K8U6 are basically interchangeable, I have replaced them on my PCB, and observe that STM32F0 do not have a problem. I am suspecting either a bug in the HAL driver for STM32L0, or something stupid I have done. I IRQHandler is very simple, just pass one to the other, and get ready for another character.

void
USART1_IRQHandler(
void
)
{
HAL_UART_IRQHandler(&huart1);
HAL_UART_Receive_IT(&huart1, &character_in, 1); 
HAL_UART_Transmit(&huart2, &character_in, 1, 1000); 
}

If anyone has anything I could try, it would be great. Thanks.
    This topic has been closed for replies.

    1 reply

    andy2
    andy2Author
    Associate II
    June 4, 2015
    Posted on June 04, 2015 at 18:07

    Seems it is STM32F0 also has the problem, and I think it is due to the fact that I am using blocking function to send, and _IT function to receive, and in the handler, I delay everything when sending the data out to the other side.

    However, tried whole day today, and can't get it working.  Is it possible anyone can share an example using CubeMX generated code, with USART1 <-> USART2 sending to each other, which is using the _IT functions?   Sorry I know it is a lot to ask, but deadline is coming, anything would help.  

    Thanks.