Busfault not generated on STM32F2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-18 1:18 PM
Posted on February 18, 2014 at 22:18
I am running the standard peripheral demo code on an STM3221G evaluation board (for STM32F2 MCU).
However when I tried to force a busfault by writing to an invalid address, nothing happened and the program just moved on! For example the following code inserted at the beginning of main() would cause an BusFault exception on STM32F3Discovery board, but NOT on the STM32F2 eval board. int *ptr = (int *)0x0; *ptr = 1; I am perplexed since I believe we do not need to explicitly enable busfault for precise/imprecise errors (unlike division by zero.) Please help since trapping invalid memory access is important to our application. Thanks Lawrence #stm32f2-busfault
Labels:
- Labels:
-
STM32F2 Series
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-18 4:58 PM
Posted on February 19, 2014 at 01:58
What's mapped at ZERO?
Try int *ptr = (int *)0x20200000;
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-20 3:17 PM
Posted on February 21, 2014 at 00:17
I tried writing to 0x20200000 and it indeed raised a busfault. However 0 is mapped to code, and I thought writing to code space would also raise a busfault. It faulted on the STM32F3Discovery board but did not on the STMF221G Eval board, which I found odd.
I also tried writing to 0x1FFFFFF0, which is just below the SRAM region. It did not raise any faults either. Thanks LawrenceOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-21 2:08 AM
Posted on February 21, 2014 at 11:08
Hi
Be careful. NULL is often defined as 0. Not sure using 0 to cause a bus fault is a good idea. Finding a memory region which always causes a bus fault on all processors is also tricky. On STM32 there is address banding.