2021-07-12 10:51 PM
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.
2021-07-14 08:24 PM
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.