Skip to main content
AMuru.1
Associate
November 24, 2021
Question

Issue to add sprintf in my code in cube ide

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.

This topic has been closed for replies.

7 replies

LCE
Principal III
November 24, 2021

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

AMuru.1
AMuru.1Author
Associate
November 25, 2021

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

TDK
November 24, 2021

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""."
FEvra.1
Associate
June 1, 2023

I have same Error. Did you solve it?

skuma.8
Associate II
November 5, 2023

Just add 

#include<cstdio>

Tinnagit
Senior II
November 5, 2023

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 II
November 5, 2023

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

This way we will be more able to assist.