cancel
Showing results for 
Search instead for 
Did you mean: 

Precise data bus error

sue
Associate III
Posted on August 05, 2010 at 00:01

Precise data bus error

6 REPLIES 6
sue
Associate III
Posted on May 17, 2011 at 14:00

After re-reading a cortex-m3 book I figured out what ''precise'' and ''imprecise'' bus errors are.  ''Precise'' just means it knows the instruction that caused the problem, ''imprecise'' means it doesn't.

I have looked at all the registers and flash memory is definitely not write-protected. All the write-protect bits are on (which means protection is off - go figure...).

However, if I try manually to change the flash memory location to which I'm trying to write (I am using IAR Embedded Workbench IDE) it will not allow me even to type anything in.  So something is set that is disallowing writes to flash memory but I can't find out what that is.  If anyone has any suggestions, please reply.

Cheers

sue
Associate III
Posted on May 17, 2011 at 14:00

Ok did some more reading and found in the ARM-V7M Architecture Reference Manual some stuff about unaligned data accesses (boy, you really have to dig).  This instruction was doing an unaligned data access, hence the error.  However, having fixed this the instruction now executes without an error, but the flash memory location is NOT being updated with the data, in the same manner as I am not able to manually enter the data through the IDE.

Am really stumped now...

domen23
Associate II
Posted on May 17, 2011 at 14:00

Did you erase the sector you're writing to?

Edit: good work on tracking down precise error issue. It's the way you'll learn most about MCUs.

sue
Associate III
Posted on May 17, 2011 at 14:00

Hi, many thanks for your reply.

Yes, I am writing zero first (according to the flash programming manual) and get no error.  This morning I did some more sleuthing and find that when I try to write the data, after clearing the destination half-word, the PGERR bit is set in the FLASH_CR register (but not the WRPRTERR bit). 

I notice in your post that you use the word ''sector''.  Do I have to clear more than the half-word I want to write?

I don't know where else to look or what else to do.

swhite2
Associate III
Posted on May 17, 2011 at 14:00

Have you read the

http://www.st.com/stonline/products/literature/pm/13259.pdf

manual?

sue
Associate III
Posted on May 17, 2011 at 14:00

From cover to cover many times. I can recite it in my sleep, along with the Architecture Reference Manual, Cortex-M3 Technical Reference and the STMF103 Reference Manual. 

do you have a suggestion as to where I should look next?

I am going to start a new thread as the title of this one no longer reflects the problem being discussed.  New thread is ''unable to write to flash memory''