How to Send New Firmware Binary to Photon & Electron via Y-Modem - TeraTerm!

I have some custom products I have created for a client who would like the ability to modify the firmware in the future if desired.

It looks like loading new firmware to the Photon via Y-Modem is an option if I give them access to the Photon via a USB port.

The USB port access would also allow programming via DFU mode.

Where can I find more info about updating a Photons firmware via Y-Modem?

Is using the Y-Modem update feature commonly used by professionals as a product firmware update method?

I’ve never used it before but I assume it there to allow easy updating?

@rickkas7 @ScruffR @peekay123 I’m sure you know a little about this feature. Just curious how Y-Modem compares to DFU updating as far as simplicity goes.

Any advice here is appreciated :slight_smile:

1 Like

What kinds of modifications does the client wish to make on their own? Simple ones like changing configuration setting variables, or more complex modifications that greatly change the product’s behavior?


Are you using these Photons in the Particle product console? If so, you’d have to mark the devices as development devices.

DFU is much more reliable than Y-Modem, as Y-Modem has to be used while the Photon is in listening mode and can be interrupted if the application makes use of serial in listening mode. DFU much less likely to be interrupted because the firmware does not run while the Photon is in DFU mode.

As far as simplicity goes, the Y-Modem flasher is included in Particle CLI, and dfu-util is it’s own separate binary.

How will the client be building the firmware? Web IDE, Workbench, Particle CLI, Locally with gcc-arm?

It might be easiest include the dfu-util binary with the firmware and provide a helper script that puts the Photon in DFU mode by setting the serial baud rate to 14400 and then flashes the firmware with dfu-util.

Also, which OS is the client using? The method of automatically putting a Photon into DFU works on macOS, Linux, or Windows.


I have developed firmware for clients who are competent with using the command line. I provide them with a copy of the firmware using GitHub. They can clone the repository to their computer with Git. They can make modifications the the firmware if they please, and use po-util to build the firmware locally and flash it with DFU.


TLDR:

DFU is much more reliable and simple than Y-Modem because it is standalone and can be used without installing Particle CLI first. You can put a Photon into DFU mode without touching the buttons from within a script to create a more pleasant DFU experience.

1 Like

Y-Modem as a “legacy” protocol which is widely used for a long time already - the main “advantage” is it’s simple and available on virtually every platform

1 Like

The client has a embedded engineer on board so they would be ok with programming via the CLI or even GCC-Arm.

The more I think about it I don’t really want them to hand over the code that is running on the devices but would rather supply them with the Binary with any changes they request. They could just flash the Binary via DFU using a panel mount USB port that is connected to a Photon’s USB port.

The products have panel mount USB ports like this which connects to the Photons USB port.

What is the easiest way for them to load a new binary file I provide when they only have access to to this panel mount USB port?

This seems to be a USB A receptacle which are usually used on the host side. The Particel devcies (especially in DFU Mode) act as USB clients which commonly would use USB B receptacles like this

https://uk.rs-online.com/web/p/type-b-usb-connectors/7398528/

1 Like

Is there any documented toutorials or programming steps for how to update a Photon via USB using Y-Modem? I have no idea how to take advantage of this feature.

I was able to see how you can access some programming modes by simply connecting to the Photon at different serial baud rates but nothing beyond that.

Are these different baud rates and functions that are available in the different modes you can get into listed anywhere that I could read up on them?

I searched for Ymodem in the docs but nothing was there.

particle flash --serial <firmware.bin> is essentially a Y-Modem update.
You can also put the device in Listening Mode and send x via a terminal program and transfer the data.

Baudrate 28800 will put the device in Listening Mode and from there Y-Modem is accessible.

Y-Modem is non-specific to Particle hence it's not further documented on their side.

There are many terminal programs that support Y-Modem transfer out the box (e.g. ExtraPuTTY on Windows).
And Linux based systems usually sport the sx/sb/sz set of commands.

2 Likes

So if all you had was a USB port and no access to the Photons buttons what would be the easiest way to load new Bin file to the Photon for a end user?

These guys are embedded engineers so they are capibable of whatever option I recommend. I’m just trying to keep it simple.

Set the baudrate to 28800 send x and transfer via sz

2 Likes

Or set the baudrate to 14400 and upload with dfu-util

You could make a helper script the client could use to do this automatically.

1 Like

I know how to do that part :slight_smile:

I’m assuming this means I type x and hit return/enter on the keyboard?

Is “sz” the command that sends the binary to the Photon?

Where and when do I specify where the Binary is located on my computer hard drive?

I’m only asking because I have no idea where to find documentation or instructions on how to do this properly.

So instead of having the client download TerraTerm they would download dfu-util and not the full Particle CLI package?

You don't need to type it, you can have a script do that too.

I provided a link that explains what sz is

If you are on Mac I'd guess you should have that too - I'm using the Windows 10 Linux Subsystem and have it.

You'd still need dfu drivers and the flash command is a bit more complicated :wink:

@ScruffR @nrobinson2000

I figured it out how to use YModem successfully by getting lucky and hitting “F” after putting the Photon into listening mode via connecting to the Photon’s USB Serial port at 28,800 baud.

This puts the Photon into Listening Mode where the LED blinks dark blue:

Next, you hit “F” and it says that its ready to receive a binary file.

It gives you a certain amount of time to initiate the binary transfer and prints “C” while it waits for the transfer to begin.

If you do not transfer the file quick enough it will error out and you will need to hit “F” again to start a new binary transfer session. You can see what happens if you wait to long before sending the file in the image below:

When you go into TeraTerm and choose the File > Transfer > YMODEM > Send… > Pick the binary file location on your hard drive that you want to upload and then it will start transferring the file.

image

image

Then after the file has transferred you will see something like this:

And the update is done.

Now you just need to switch the serial baud rate to something other than 28800 and restart the Photon to begin running the new firmware.

This is a pretty cool method for easily updating products that are not Wifi Connected.

I could not find an easy guide on how to exactly how to do this process so hopefully, this helps somebody else who tries to do this also in the future.

Always something new to learn with this stuff :nerd_face:

5 Likes

@rickkas7 When transferring binary Files to a Photon via setting the USB serial to 28,800 Baud and then hitting F to enter YModem Binary Update Mode can you also upgrade to new Firmware versions without Wifi?

If I had a Photon running Firmware 7.0 with no Wifi access and I compile a new sketch using the new 1.0 firmware and transfer that over to the Photon using YModem will the Photon update the system firmware to 1.0 just as if you updated it using OTA via Wifi?

I think I just did exactly that but it had Wifi access so not sure if it updated to the new 1.0 Firmware with or without a WiFi connection.

Just trying to clarify since I was under the impression that with a Photon that did not have Wifi Acess and YModem was used for all future updates that I would have to stick with whatever Firmware version that was originally installed on the Photon and I would only be able to update the actual sketch only and not the firmware.

Safe Mode Healer needs to be able to acquire the system update via WiFi in order to update.

If you want to update the device OS without cloud access you need to provide the device OS (and sometimes the bootloader) binaries aswell - they can be updated via Y-Modem too.

1 Like

Thanks for clarifying that!

I’m happy to hear that it’s totally updateable via YModem. I have 4 systems using this now and it’s working well.

1 Like