printf does not work properly on stm32f407
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
Labels:
- Labels:
-
STM32F4 Series
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-07-14 8: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.
If you feel a post has answered your question, please click "Accept as Solution".
