Author Topic: LPC1768 Ethernet bootloader : read command failed  (Read 23395 times)

pirrien

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
LPC1768 Ethernet bootloader : read command failed
« on: November 03, 2011, 03:16:05 am »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #1 on: November 04, 2011, 02:02:09 am »
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

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #2 on: November 04, 2011, 03:38:36 am »
Hello Andy,

Here the debug file made with FM in debug mode.

Best regards,
Philippe Irrien

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #3 on: November 07, 2011, 02:05:12 am »
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

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #4 on: November 07, 2011, 05:23:07 am »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #5 on: November 08, 2011, 01:09:11 am »
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

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #6 on: November 08, 2011, 06:32:58 am »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #7 on: November 09, 2011, 08:07:26 am »
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

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #8 on: November 10, 2011, 12:37:03 am »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #9 on: November 10, 2011, 01:38:28 am »
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

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: LPC1768 Ethernet bootloader : read command failed
« Reply #10 on: November 14, 2011, 01:12:05 am »
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