I am attempting to use serial boot mode to download a secondary bootloader into RAM which attempts to program a word in flash. However this method is not 100% successful and is corrupting the memory at the location I attempt to write to when it fails. I am using the MPC5566 reference manual section-126.96.36.199, as a guide to program the flash. When I use the debugger to observe the changes that have been made, a majority of the time I am shown "XXXXXXXXX Bus Error - No Opcode" at the location I attempt to write. Currently I am just attempting to program a word to 0x00000000, therefore I am not settings bits high, 0 -> 1(which is not possible using this method).
The reference manual mentions, "All programming operations must be from 64 bits to 256 bits, and be 64-bit aligned." The code downloaded accounts for this by also programming the previous memory address(i.e. if I want to write to 0xC, I attempt to write 0x8 and 0xC)
However it also states that, "Thus, if only 1 word in any given 64-bit ECC segment is programmed, do not program the adjoining word (in that segment) because the ECC calculation has already completed for that 64-bit segment." Could I possibly be interfering with the ECC?
Sometimes it writes successfully, but it seems to have a very low percentage of success. Any help is appreciated.