Firmware update from USB stick does not work

01 Apr 2011

Hi Mbeder!

I have adapted the ethernet firmware update from Shinichiro Nakamura (great job!) to pick the file from an USB stick. Unfortunately it doesn't work properly. I made two different .bin files. One with the firmware update function running on the Mbed (led 1 blinking) and another with only led 2 blinking stored on the USB Stick. Both programs work properly when downloading them to the Mbed.

After downloading the program with the firmware update function and resetting the mbed, the update should be executed. According to the Log file produced by the program, everything should be fine but nevertheless it seems as if the old firmware runs. The size of the .bin file before the reset is 48kB, after the reset the size is equal to the filesize on the usb stick (11kB).

I have already had a look into the .bin file and compared the two files (firmware.bin on mbed & firmware.bin on USB stick) after the fimware update. Since there were no diffences I can't explain why led1 is still blinking.

Can anyone give me some support, please! I have added the firmware update program and a photo from my setup. USB connection works.

Thank you in advance!

/media/uploads/Markus_Paar/firmware.zip

/media/uploads/Markus_Paar/setup.jpg

01 Apr 2011

Could it be because you've called them the same name ? Maybe mbed doesn't think it needs to reflash the LPC as it doesn't see a file name change ?

does it work if you call them different names. (but remember, Mbed will always run the most recent file in its memory when reflashing the CPU, so you'll have to make sure the second one has a later date too.)

Just an idea.

02 Apr 2011

Hi David!

Thank's for your idea.

As far as I understood the boot process on the mbed it always loads the firmware from the local filesystem. Before executing the firmware update function it is the software which includes this function and after executing this function it should be the "stupid" function which only can blink the led. Since there is only one firmware available it can only load this firmware after reset. That's why the same name has no effect (from my point of view).

But I will try to change the name.

06 Apr 2011

Actual Status: Different filenames don't work at all, I don't know why. What I recognized was the following: Changing one character in the .bin file after the update followed by the reset and storing the changed file under the same name forces the mbed to reload the file -> the new, updated file runs on mbed (Hooray!!!). I changed the character from the PC, which changes the file's timestamp too. So this seems to be the point where I have to stick on.

Does anybody know if there is a possibility to get the timestamp information from a local file and to change it? If this is possible, I could save it in the txt file and after the change the timestamp of the updated file to a later date.

Thank you in advance!

14 Sep 2011

Hi. Markus-san

O.K.

Your idea (To use USB mass-storage) is great.

The instance of FirmwareUpdater have log field.

Could you send me your output of the log information with the latest version?

To use log is really easy.

FirmwareUpdater fwup("firmware", "firmware", true);

The instance is here.

    /**
     * Create.
     *
     * @param url URL for firmware. Do not include a target file name.
     * @param name An application name. Do not include a extention.
     * @param log True if logging.
     */
    FirmwareUpdater(std::string src_name, std::string dest_name, bool log = false);

http://mbed.org/users/shintamainjp/notebook/firmwareupdater_en/

15 Sep 2011

Hi Shinichiro, Here is the log file:

First reset: Local firmware version is 1. (/local/firmware.txt)

Source firmware version is 2. (/fs/firmware.txt)

INFO: Deleted '/local/FIRMWARE.BIN'.

File copying... (/fs/firmware.txt->/local/firmware.txt)

File copied. (/fs/firmware.txt->/local/firmware.txt)

File copying... (/fs/firmware.bin->/local/firmware.bin)

File copied. (/fs/firmware.bin->/local/firmware.bin)

Local firmware version is 2. (/local/firmware.txt)

Source firmware version is 2. (/fs/firmware.txt)

Second reset: Local firmware version is 2. (/local/firmware.txt)

Source firmware version is 2. (/fs/firmware.txt)

I just have sent you the link to my project together with some informations.

http://mbed.org/users/Markus_Paar/programs/firmwareV2/lxj0jo

Thanks!

17 Sep 2011

Your program based on my FirmwareUpdater version 0.0.1. But the implementation have some bugs. Please re-implement your program on the version 0.0.2.

To cleanup all .bin files is important for your project. Because local file copy in FirmwareUpdater can NOT control the date of the file.

Important things

  • mbed system controller see .bin files on his local file system.
  • He check a date of a .bin file. (Probably)
  • He check a name of a .bin file. (Maybe)
  • FirmwareUpdater can NOT control a date of the file with my current implementation.
  • So the FirmwareUpdater cleanup all .bin files.

Please try to update your FirmwareUpdaterWithUsbMass. :) It's a great project!

Shin.

19 Sep 2011

Hi Shin, thank you for your information. That's the cuuren status: I have implemented the version 0.0.2 of your FirmwareUpdater but without success. You can find the project on http://mbed.org/users/Markus_Paar/programs/firmwareV3/lxqw92. The problem is still the same: All .bin files are deleted by the cleanup function and the new firmware file is copied to the local file system. Nevertheless the mbed does not flash the LCP. Only restoring the .bin file from the PC (changing the timestamp) leads to success.

Here is the Log File:

INFO: Version file '/local/firmware.txt': Version 1.

INFO: Version file '/fs/firmware.txt': Version 2.

INFO: Version file '/local/firmware.txt': Version 1.

INFO: Version file '/fs/firmware.txt': Version 2.

INFO: Firmware updating... (1 -> 2)

INFO: Deleted '/local/FIRMWARE.BIN'.

INFO: File copying... (/fs/firmware.txt->/local/firmware.txt)

INFO: File copied. (/fs/firmware.txt->/local/firmware.txt)

INFO: File copying... (/fs/firmware.bin->/local/firmware.bin)

INFO: File copied. (/fs/firmware.bin->/local/firmware.bin)

INFO: Version file '/local/firmware.txt': Version 2.

INFO: Version file '/fs/firmware.txt': Version 2.

The programm should do everything right but it doesn't. Maybe you have an idea what can be done to solve this problem.

20 Sep 2011

Hi Markus-san

My original version uses temporary files for copying .bin and .txt. See EXT_BINTMP and EXT_TXTTMP.

But you removed these implementations. So all local bin files removed. :)

Please think about "Why the original version uses temporary files?". (Because ... for the "Important things".)

That's the cause, and you can fix it. :)

cheers, Shin.

Please log in to post a reply.