When writing to the internal flash using the I2C ISP protocol I can write, read, erase PAGES, BLOCKS and SECTORS with no issues as long as I stay away from the 512 bytes starting at 0x0.
When I BLOCK write #0 I do not get an error ack which is an error in itself.
However when I PAGE write #0 I get this error: ERR_USER_CODE_CHECKSUM which is probably also not the correct error message since I have the correct checksum writing everywhere else.
I then used a SEGGER JFlash tool to burn the chip via SWD and read out the flash via I2C.
I then discovered that the word at 0x28 was not identical to the file. The Segger tool had modified this when burning. If I do the same thing and modify my image I'm able to burn it via I2C as well.
I'm burning 0xdffd604a at offset 0x28.
So there is obviously some sort of qualification being performed when writing the the start of the flash.
However I'm unable to find proper documentation on the requirements and what this magic number is.
From looking at image documentation this corresponds to the vector 11 in the image and should contain a valid pointer to an enhanced boot block structure, is this the clue?
Solved! Go to Solution.
Hi again, I'm happy to say I have found the issue but embarrassed by the reason why. I have set you out on a bug hunt on the wrong premises: I state that the offset is hex 0x28 but in reality it was decimal 28. That makes sense in that it then represents the checksum of the 7 first words as described in the manual on legacy images which is what I'm writing. The error code also makes sense now. So again, sorry about the misleading info in my first post, I'm not sure how I managed to confuse the two...
Hello rolfweldeskeie
I've started working on your inquiry.
Please, provide me additional time to post my feedback.
Regards, Diego.
Hi rolfweldeskeie
I'm still working on your case, please provide me additional time to corroborate the following.
The error for the checksum is interesting, typically a debugger calculates the checksum while programming, the difference on the offset value 0x28 may explain the error in the checksum, I'll check this further.
On the other hand regarding the value for the 0x28 (vector 11 on page 0) that points to the the boot structure. I asume that you are developing a enhanced image (single or dual ), is that correct? For legacy images the offset 0x28 of flash is equal to zero, the same case with 0x24.
Additionally, could you provide me you the original startup file of your image?
Best regards, Diego
Hi rolfweldeskeie
This is a follow up on the post,
As you know the 0x28 offset is required for enhanced images, typically points to a boot block structure as shown in the following illlustration.
( This is taken from the AN12122LPC540xx Image Header Structure )
Since the 0x28 is pointing at 0xdffd604a , that is outside of the flash memory region.At the moment It is hard to explain from were comes this value. Maybe we are overlooking something.
If you are able to provide further details you can post it for other users reference.
I have to mention that we are not following the post after 7 days, but this has been an interesting question.
Best regards, Diego.
Hi again, I'm happy to say I have found the issue but embarrassed by the reason why. I have set you out on a bug hunt on the wrong premises: I state that the offset is hex 0x28 but in reality it was decimal 28. That makes sense in that it then represents the checksum of the 7 first words as described in the manual on legacy images which is what I'm writing. The error code also makes sense now. So again, sorry about the misleading info in my first post, I'm not sure how I managed to confuse the two...
Hi, Rolf!
I'm happy that you found the error :-)
Please, mark your last reply as correct, since that is the resolution.
Best regards, Diego.