I have task to develop a software for writing hex content to flash, of course there are tools for it but the tools had issues so i had to make my own software for it but first i need to understand it (for understanding purpose i am using flashmagic software for now).
The issue is that its says in NXP LPCxx document that The length of any
UU-encoded line should not exceed 61 characters (bytes) i.e. it can hold 45 data bytes.
The receiver should compare it with the check-sum of the received bytes.
Thanks in advance,
M.Bilal
Solved! Go to Solution.
Dear bilalqureshi.epic@gmail.com,
I will try to answer your question the best I can:
The checksum will be send it after all the package, using the flash magic as a reference, this send 512 bytes for each command to write in RAM (this is implementation of the flash magic, it could be until 900 bytes), this is calculated adding the raw data of all the 512 bytes:
For example, if all the 512 bytes are 0xFF the checksum will be 130560:
Remember that the encoding that is used is the UU-encoded so the packages will have up to 61 bytes, (1 of the size of the package + 32 and the payload encoded) each 4 bytes will represent 3 bytes of raw data. That's why the payload raw data is 45.
I hope this information helps you.
Best Regards,
Alexis Andalon
Dear bilalqureshi.epic@gmail.com,
I will try to answer your question the best I can:
The checksum will be send it after all the package, using the flash magic as a reference, this send 512 bytes for each command to write in RAM (this is implementation of the flash magic, it could be until 900 bytes), this is calculated adding the raw data of all the 512 bytes:
For example, if all the 512 bytes are 0xFF the checksum will be 130560:
Remember that the encoding that is used is the UU-encoded so the packages will have up to 61 bytes, (1 of the size of the package + 32 and the payload encoded) each 4 bytes will represent 3 bytes of raw data. That's why the payload raw data is 45.
I hope this information helps you.
Best Regards,
Alexis Andalon
Thank You @Alexis Andalon, i applied what you said and getting correct uu-encoding as that of flash magic, the only issue i am facing right now is checksum of first and last 512 bytes, i am not sure what is wrong with first 512 bytes checksum but some how i think there is padding in last checksum of "F". for example for first 512 bytes i get 34964 checksum of raw data whereas it should be 35644, after this all the checksum are fine except the last one. Can you kindly help me with this one as well according to your knowledge.