Reading from flash causes hardfault
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-01 3:23 PM
I'm working with the STM32wb55ceu MCU which states that it has 512K of flash memory starting from address 0x08000000.
However, I realized that if I compile and run the follow program, it will hard fault when attempting to read the value from flash (line 3)
void main ()
{
uint8_t i = *(uint8_t *)0x0806f18c;
(void)i;
while (1);
}
To my understanding, the flash should end at 0x08080000. and I have confirmed that my flash memory size is 512K by using the st-info utility.
Is there some sort of memory protection I need to disable?
Solved! Go to Solution.
- Labels:
-
DEBUG
-
Flash
-
STM32WB series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-01 5:25 PM
0x0806f18c is near the end of the flash.
You're probably reading FLASH that is reserved for the second core (CPU2) handling the wireless functions.
From the datasheet:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-01 3:41 PM
If you dump the faulting address in the Hard Fault handler, what does it report?
Unwritten FLASH may fail ECC checks
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-01 3:54 PM
Looks like BusFault Status Register contains 0x82 which means BFARVALID is set and PRECISERR
if this is what you were asking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-01 5:25 PM
0x0806f18c is near the end of the flash.
You're probably reading FLASH that is reserved for the second core (CPU2) handling the wireless functions.
From the datasheet:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-01 5:26 PM
Read out FLASH_SFR to verify what's reserved for CPU2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-01 5:27 PM
Makes sense. I missed that in the data sheet. Thank you.
