Usb commands not working with 0.7.0

Hello guys,

In my last post regarding the Electron.js, we were able to fix the issues thanks for the help! Now during the testing, with a photon (v0.7.0), the usb commands are not working. The error is IN control transfer failed: LIBUSB_TRANSFER_STALL. The commands we tried are particle usb dfu and particle usb start-listening.

After updating the system firmware, the usb commands are working fine. The particle serial wifi --file wifiCred.json command stopped working with v1.2.1.

The physical access to the buttons is not possible. Setting the baud rate to put the device in dfu mode also not working with ubuntu.

It would be great if you guys could help with putting the device in DFU mode through CLI and setting WiFi credentials through JSON. We are using ubuntu 18.04, nodejs version 10.16.3 and particle-cli 1.43.3.

Cheers!

That’s not surprising since USB Control Requests were only introduced with some 0.8.0-rc.x.

But you can use the USB Serial baudrates 14400 and 28800 with some tweaks @nrobinson2000 knows more about - or just temporarily move to a Windows machine and update your device.

If your device is cloud connected you could also OTA flash some firmware that provides a function to enter Safe and/or DFU Mode.

1 Like

Thanks for confirming @ScruffR. Is there anyway to put the device in DFU and listening mode through CLI for 0.7.0? The WiFi credentials set from JSON is not working in 1.2.1 for us.
Setting the buad rate to put the device in DFU and listening mode seems like not working

Have you tried with a Windows machine?

(Some) Linux distros don’t support “exotic” baudrates by default, so you’d either need to tweak Linux to accept other baudrates or alter the device OS to listen for a different (standard) baudrate.

The baud rate is working fine with Mac OS. We need to try this in Ubuntu because the application is going to install on Ubuntu systems.

Could you please try setting the wifi with the JSON file in 1.2.1? We are not able to do it in Ubuntu and Mac OS. Thanks, I will try on tweaking Linux to accept different baud rates.

Once you have 1.2.1 on your device you shouldn’t need the baudrate tweaks anymore as USB Control Requests are supported there already and particle usb dfu whould do the job.

Can you post a (sanitised) version of your WiFi creds JSON file to see what may be wrong?
Is the WiFi network present and visible at time of setup?
Also what mode was your device at the time of sending the creds to the device?

Once you have 1.2.1 on your device you shouldn’t need the baudrate tweaks anymore as USB Control Requests are supported there already and particle usb dfu whould do the job.

Yes, which is working fine for us.

This is the WiFi credentials we use. {"network":"name","security":"WPA2","password":"Password15"}

Is the WiFi network present and visible at time of setup?

Yes, it is and working for 0.7.0.

Also what mode was your device at the time of sending the creds to the device?

The devices are in listening mode.

I can see at least one mistake in your JSON
And the solution to that I have already given you nine days ago in another thread of yours.

I don’t mind repeating the same thing over and over between different users, but having to repeat the same thing for the same user in just over one week becomes tiring.

@ScruffR Yes, I undestand. We tried using all the security type combination in the list as nothing works. Let me work on it and let you know.

You indicated otherwise in the other thread

Yes, which was for 0.7.0 but not working for 1.2.1 as mentioned in the post.

I think the issue is related to particle-cli npm module. The immediate response from the CLI is

Error configuring Wi-Fi: Error Resource temporarily unavailable Cannot lock port

Retried several times but to no avail. Thanks for your help! :beers:

I have just tested with a Photon on 1.2.1 and it works for me.

JSON (for WPA2 this is the “take-it-all” option):

{"network":"mySSID","security":"WPA2_AES+TKIP","password":"myPassword"}

Make sure your currently installed firmware doesn’t claim the USB Serial interface (e.g. by use of SYSTEM_THREAD(ENABLED) and your host computer is not otherwise using the serial port (e.g. another instance of particle serial monitor --follow or any other serial terminal).

To prevent your firmware from interfering you could either go into Safe Mode before engaging Listening Mode (aka Safe Listening Mode) or flash some dummy code that does nothing with Serial at all.

Good tips! Will update you with the results.

@ScruffR Removing the SYSTEM_THREAD(ENABLED) did the trick. I don’t know how it works on 0.7.0 then. Thanks for the help!

One thing is the JSON will take the security WPA2. I tried it and worked fine.