LPC1768 Ethernet bootloader : read command failed

Started by pirrien, November 03, 2011, 03:16:05 AM

Previous topic - Next topic

pirrien

Hello,
i have implemented a ethernet bootloader for the lpc1768 based on the lpc2300 ethernet bootloader.

To ensure that the code is correctly downloaded, i use the verify command of FM.
But this command returns this message : "Error verifying.There is a difference in the hex file value and the stored value( address 0x00002000)".

When i checked with wireshark what hapens :
     - FM sends the read command : R 8192 512<CR><LF>
     - After FM received the checksum of the 512 bytes from the lpc1768 MCU, FM sends the value 0x1B.

If i understand what is writing in the user lpc17xx user manual, normaly FM sends "OK<CR><LF>"  if the check-sum matches to continue further transmission otherwise "RESEND<CR><LF>".

But is is not the case. Why FM sends the value 0x1B instead of  "OK<CR><LF>" or "RESEND<CR><LF>" response?

Best regards,
Philippe Irrien

Andy Ayre

Please email me a debug file showing everything so we can get a better idea of what is happening.

http://www.flashmagictool.com/debugfile.html

Please reference this topic. Thanks.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

pirrien

Hello Andy,

Here the debug file made with FM in debug mode.

Best regards,
Philippe Irrien

Andy Ayre

Looking at the code the only situation I can see this happening is if the sending of "RESEND" or the sending of "OK" fails. Then FM will give up and send the abort command 0x1B. I'm not sure why that would happen because the sending of 0x1B works.

I can see that Flash Magic attempts to read the 512 bytes starting at 0x2000 five times and each time it gets back the same checksum and feels that it is wrong, so sending the RESEND command would have the same result anyway.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

pirrien

For me, there is a problem when FM checked the check-sum.

To be more precise, the read security ( R 764 4 ) command works.
FM sends the OK command after the checking of the checksum.
So I do not understand why the verify command failed.
The checksum sent to FM is computed in the same way than the read security command.

And normally, FM must send the RESEND command if the checksum does not match and not the abort command 0x1B as the
lpc17xx manual says for the read command :

"The data stream is followed by the command success return code. The check-sum is sent
after transmitting 20 UU-encoded lines. The checksum is generated by adding raw data
(before UU-encoding) bytes and is reset after transmitting 20 UU-encoded lines. The
length of any UU-encoded line should not exceed 61 characters (bytes) i.e. it can hold
45 data bytes. When the data fits in less than 20 UU-encoded lines then the check-sum is
of actual number of bytes sent. The host should compare it with the checksum of the
received bytes. If the check-sum matches then the host should respond with
"OK<CR><LF>" to continue further transmission. If the check-sum does not match then
the host should respond with "RESEND<CR><LF>". In response the ISP command
handler sends the data again."


Philippe

Andy Ayre

Please try programming into a blank device a small test hex file containing 10 bytes of data using some kind of simple pattern, e.g. 0x01, 0x02, 0x03, etc.

Next use the display memory feature to display the contents of memory - please post a screenshot showing the 10 bytes.

Finally perform a verify. If this fails please send me a debug file showing the erase, program, read and verify.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

pirrien

I have made the different operation that you suggested.
But, the device is programmed with a small test hex file containing 16 bytes and not 10 bytes( see attach files ).
The display memory and the verify commands failed too( see the attach files ).

Best regards,
Philippe

Andy Ayre

Normally I would try it myself but unfortunately I can't do that until early next week.

In your first post you mentioned that you had implemented an LPC1700 bootloader based on the LPC2300 version. Can you please try the official LPC1700 ethernet bootloader and let me know if there are any differences?

C:\Program Files (x86)\Flash Magic\Ethernet Bootloader\LPC1700

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

pirrien

I can't try the official lpc1700 ethernet bootloader because i have not the MCB1700 board.
The LPC1768 MCU is implemented on one of our board.
But, I tried the official LPC2300 ethernet bootloader and the problem is the same with FM.
The ISP functions are the same for lpc1700 and LPC2300 ethernet bootloader.
The read and verifiy command do not work.

In a preceding mail, i have said that the read security ( R 764 4 ) command works.
To do this, the param_check function must be changed to ensure the good work of the read security command.

So for me, those bootloader are not completely tested with FM.

So, i wait after your investigation on FM.

Philippe

Andy Ayre

Yes, the bootloaders have been tested and do work, so something has changed. As soon as I am able I will give a try.

You shouldn't need the Keil MCB1700 board to use the official LPC1700 ethernet bootloader - it just needs an Ethernet controller and the LED used is easy changed.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

pirrien

Finally, i tried the lpc1700 ethernet bootloader and it works.
I found a difference in the UDP frame sent by the lpc1768 MCU on my board.
It appears that the length field of the IP header was wrong.
After the correcting of this point, the read and the verify commands work.

Thanks for you support.
Best Regards,
Philippe