cancel
Showing results for 
Search instead for 
Did you mean: 

printf does not work properly on stm32f407

Krunal
Associate

I am using stm32f407 discovery board. My printf function works fine but when it comes to printing numeric values HardFault(Bus fault) occurs. It prints alphabets perfectly fine but cant print numeric values. 

e.g. printf("UFSR=%x, *pUFSR);  

It prints

UFSR=

then fault occurs.

Thank you.

1 REPLY 1
TDK
Guru

printf uses the heap to allocate memory. A call to malloc is probably failing and causing the havoc. Verify you have enough heap memory. Try doing malloc(128) or so and see if it succeeds. Try a more standard printf call like printf("%d", 0) and see if it works, perhaps hex isn't implemented.

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