cancel
Showing results for 
Search instead for 
Did you mean: 

USART2 communication no longer works after STM32cubeIDE Update to V1.3.0

KlausF01
Associate II

I have just updated STM32cubeIDE from Version 1.2.0 to 1.3.0.

After uploading a previously running program, I saw that USART communication to the PC is no longer working, after IDE update. I did NOT change anything in my C-sourcecode, just recompiled and uploaded.

This effect occurs in all software, I'm using VCP as a debugging output!

I have no idea, where to search, as the C-sourcecode was not alterd at all!

As you can see in the picture below, there is something received periodically. However I'm not able anymore to set a baudrate (at HTerm) which decodes the transmitted text. I assume that the baudrate, set in USART2, is totally mismatched and anything else than 115200. Unfortunately, in this location I do not have an oscilloscope available to figure out what is reall transmitted there.

Any help is welcom - all my projects are on HALT now 😬

0690X00000DYtouQAD.jpg

BTW: I'm using a nucleo54 STM32L053R8 board.

19 REPLIES 19

Yes of course, it was working before!!!

I did count the bytes, comming in and found that it is correlated with the amount of bytes I do transmitt.

However the Device Configuration Tool allows the USART under Advanced Features to be set to "TX Pin Active Level Inversion" and also "Data Inversion". Why do you think I can exclude the possibility that one of this bits is set wrong, by some misconfiguration or bug?

The pitty is, that without an oscilloscope I just can guess ...

BTW: I does not work with 115200 NOR with 9600 ...

You dont need a scope to debug and look at the relevant register values. Or to calculate the exact baud rate it has set.
If you feel a post has answered your question, please click "Accept as Solution".

> do you think I can exclude the possibility that one of this bits is set wrong, by some misconfiguration or bug?

But you haven't run the Cube... er... "Device Configuration Tool" over the existing code?

So nothing changed in the code, and nothing in the libraries?

Either this is because of updated compiler/GCC libraries, or the builder, or it is caused by the known debugger issues in 1.3.

To exclude the latter, disconnect the debugger and power cycle. Will it run without the debugger?

-- pa

S.Ma
Principal

Did you restore the user project directory or used the touched by 1.3 and reopened in 1.2

Having access to an oscilloscope (fablab, school electronics lab, rental) is quite needed for embedded programming.

There are also small USB scopes too.

Which STM32 are you using?

KlausF01
Associate II

Thanks for alle the answers!

To exclude any software issues, I tried to send a static text and surprise - it transmitts correct!

    HAL_UART_Transmit(&huart2, "Test0123456789", 14, 0xFFFF);

So, there must be a compiler issue, handling the pointers to the variable pData {HAL_UART_Transmit(huart, pData, Size, Timeout)} when typecasting probably is not correctly defined. Handling of this issues seems to have changed with the uptade (new version of compiler).

What I saw to be transmitted, was the correct amount of bytes (as mentioned abobe), but some randomly picked data from elswhere in the memory!

BTW: How to set this topic on solved?

It's really strange, that the problem remained persistent after downgrading to IDE 1.2.0 again.

But good to know, it's not a bug in the HAL.

BTW: How to set this topic on SOLVED?

UButt.1
Associate

Its July 2021 and I find my self in the same situation. Creating a project using STM32CubeIde and then opening STM32CubeMX from it for micro peripheral initialization. After code generation. USART transmits data but raw data uneven.

Creating same thing but first using STM32CubeMX for peripheral initialization and then generating code for STM32CubeIde creates no problem. Usart working properly.

STM32CubeIde has some problem and I cant figure out what. Any one got solution?

@UButt.1​ So, same questions again: what is your STM32? Have you tried to compare old and new generated code?

Has the Cube library version changed between the old and new version?

Have any build settings changed? (optimization, compiler version etc).

Diff the code to find the difference. Gotta be an answer. No clue what “raw data uneven�? means.
If you feel a post has answered your question, please click "Accept as Solution".

(Nucleo-L432KC) I compared the code and found no difference in Uart initialization or any thing. However on this particular board clock pin is shared with USART. I am not using clock, declared pins dedicated to only USART. I decided to just create the project using MX and ignore it. How ever I attached the two folder projects. Folder named "Initialization using Mx" Usart works where as the other with CubeIde doesn't. May be if some body can take a look and update the community.

In the CubeIde main file I added fputc and _write c library functions to see if printf works with USART but no luck. These functions can be deleted.

TDK
Guru

@UButt.1​ Your two projects are not the same, there are quite a few differences in them.

In particular, one of them has the line:

HAL_UART_Transmit(&huart2,'A', 1, 100);

This won't work as intended, since 'A' is a char literal and not a pointer to data. It will also throw a warning during compilation.

I don't see how this is the same problem as the original post, which was solved.

If you still have a problem, please create a new thread with relevant details.

If you feel a post has answered your question, please click "Accept as Solution".