Sending script to photon through serial

Hello!

I am trying to send a code to the photon through serial (WIFI off). The script sends fine when using the command “particle flash --serial app.ino” when the WIFI is on but I am unable to send it when the WIFI is off which is integral to my project. It recognizes that there is something connected via serial but can’t send the code. In my reading, I find that I may have to send this as a .bin file…? If this is the case, how do I convert my .ino file to a bin file. If this is not the case, then can someone please tell what I am missing. Thank you in advance!

What SYSTEM_MODE are you running?

In default SYSTEM_MODE(AUTOMATIC) your code will never start running if you have no valid cloud connection.

But if you mean uploading firmware, you always flash a binary and never a script.
I’ve never sent a .ino via --serial and I’m pretty sure that won’t work.
When you execute particle flash <deviceID> app.ino you actualy send the source code to the cloud to build and it in turn OTA flashes the binary to the device you specified via <deviceID>.
If you want to flash with --serial you can build with Web IDE and download the binary or use particle compile photon app.ino to get the code built online and get the binary sent back to you for subsequent offline flashing.
For --serial your device should be in Listening Mode (blinking blue).

1 Like

Hello! Thank you so much for the reply. I have downloaded the firmware.bin file and attempted to flash while the particle was offline using “particle flash --serial firmware.bin” while the device is blinking blue. I received the error: ! serial:
Error writing firmware…Transfer cancelled
undefined

I also tried sending through usb while the device is in listening mode and am not able to do so. I have gone through the process of installing the dfu-util driver.

Any suggestions?

Thank you!

What OS are you running?
Have you got the required drivers installed?
Can you see the serial port of the device in your host system?

If you want to flash via particle flash --usb firmware.bin you need to put your device in DFU Mode (blinking yellow).

1 Like

I am sorry, I wrote that wrong. I had it in dfu mode (blinking yellow) and was not able to flash the device using “particle flash --usb firmware.bin”. I installed the dfu-util driver. Is there another driver I am missing?

I am able to see the serial port when it is listening mode by calling “particle identify”.

dfu-util is not a driver. It’s a uitility that would transfer the binaries via the driver to a DFU device.
But when you install CLI, the dfu-util is installed with it, so no need to do that manually.

But since you haven’t answered this question, it’s not clear how to help you with locating the actual DFU drivers

1 Like

OS is windows

Yes, and?
There are several versions of that OS.

windows 10, sorry

This tool will help you install the DFU drivers
https://zadig.akeo.ie/

I’m using libusbK but others have also success with other drivers provided by this tool.

What does particle --version report?

If you are running 1.29.0 or later you may want to flash via

particle flash --usb firmware.bin -v

to get the verbose output of the actual flashing process.

2 Likes

This shows what the DFU driver configuration should look like for Windows:

https://docs.particle.io/faq/particle-tools/installing-dfu-util/photon/#windows-debugging-drivers

1 Like