cancel
Showing results for 
Search instead for 
Did you mean: 

Issue to add sprintf in my code in cube ide

AMuru.1
Associate

Hai, I am using stm32h743zi nucleo board in that I am send and receiving float via UART using sprintf but facing hard fault error while running , help me to sort ​this issue would be appreciated.

7 REPLIES 7
LCE
Principal

First of all, normally sprintf is used for writing something into a string.

Second, maybe you need to set these checkboxes in the project settings:

0693W00000GY3PuQAL.png

TDK
Guru

Also note that printf/sprintf (and maybe sscanf, not sure) use the heap and a failed allocation can cause a crash.

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

Thanks,I have this done in my code still I am facing the same issue.​

FEvra.1
Associate II

I have same Error. Did you solve it?

skuma.8
Associate III

Just add 

#include<cstdio>

Tinnagit
Senior II

I'm not sure but I think you may send or receive some data is not char or not ascii. 
Or you may send or read data oversize from your buffer so you had write in some address which it's may affect to another function and then that function is fail.

Johi
Senior III

Would it be possible to share the part of the code you changed yourselves?

This way we will be more able to assist.