microsoft/IoT-For-Beginners

Error looking for upload port in Lesson 4 for Wio Terminal

marty-optum opened this issue · 13 comments

I am working on Lesson 4, Control your nightlight over the Internet - Wio Terminal. I am on step 7 of the Task - connect to WiFi section where I am asked to upload the code to the Wio terminal.

When I run PlatformIO: Upload, I get the following error message:

...
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
================ [FAILED] Took 4.26 seconds ================
The terminal process "platformio 'run', '--target', 'upload', '--environment', 'seeed_wio_terminal'" terminated with exit code: 1.
...

Prior to modifying the code for this lesson, I verified that the Wio Terminal still functioned properly with the prior lesson's nightlight code.

Has anyone else come across this behavior, or have some clues about how to work around this?

Note: I am pretty sure that I uploaded the Wio Terminal firmware earlier in order to enable the WiFi settings, but perhaps there are more steps needed ?

Thank you.

I've seen this a few times - the Wio Terminal just refuses to go into upload mode. Sometimes it's caused by having another process accessing it (such as a second VS Code instance), other times there seems to be no pattern to it. Usually unplugging it for a while can fix it.

Thanks @jimbobbennett . I've been racking my brain on this one! In my troubleshooting attempts, I even figured out how to use the PlatformIO CLI to replicate the problem. Near as I can tell, the connection between the Mac and the Wio Terminal just drops, and will not reconnect. Then, out of nowhere today, it seemed to establish itself. Things were fine for about 20 minutes, and now I lost the connectivity again.

  1. Has anyone else experienced this with the Wio Terminal? I am using Visual Studio Code on a mac running Big Sur.
  2. Does @jimbobbennett or anyone else have any more suggestions on how to fix this issue, and fix the root cause to keep it from reappearing?

It's frustrating that this is occurring so early in the game before I can even get the MQTT sample stuff working :-(

@marty-optum I'm running into the same issue with Big Sur, VS Code, and Wio at the same point in the tutorial.

Just following up on this. I have been having a few connectivity issues with it - on a live stream which was fun. I'm also using Big Sur.

  • In PlatformIO, in the devices tab, do you see it? It will be /dev/cu.usbmodemxxxxxx

    image

  • What other devices do you have connected? For example, I lose connectivity when my USB audio interface is active

  • If you pull the power button down quickly twice, does it mount a drive called Arduino?

    image

  • Were you able to update the firmware by following the instructions from Seeed:

    https://wiki.seeedstudio.com/Wio-Terminal-Network-Overview/

@jimbobbennett Thanks for following up! I've found that I sometimes but not always can bring back the device and mount it when I restart my computer. I am able to consistently connect from a Windows computer so I think this is could be a Mac issue.

Here's what seems to happen.

  1. The device mounts after restarting my computer.
  2. Via VS Code, I upload with PlatformIO.
  3. My device ejects automatically.
  4. When I try to upload a second time with Platform IO via VS Code, I see the upload_port error. I understand now that it's a symptom of not having my device mount.

To answer your other questions:

  1. I do see /dev/cu.usbmodemxxxxxx when my device mounts.
  2. I don't have any other USB devices connected but I do have an HDMI cable connected through the same USB/HDMI hub. I don't have a USB on my laptop.
  3. Pulling down the power button doesn't consistent mount the device as Arduino, although it did work once.
  4. I was able to update the firmware.

@jimbobbennett and @juliakm, what I see is slightly different.

Environment

  • macOS Big Sur 11.6
  • VS Code 1.60.1
  • PlatformIO IDE 2.3.3 VS Code Extension
  • Hardwired thunderbolt/USB-C port on Mac to USB-C port on the WioTerminal. No adapters or hubs (although I have tried different configurations, such as switching USB ports and using hubs).

[Jim]

In PlatformIO, in the devices tab, do you see it? It will be /dev/cu.usbmodemxxxxxx

This is inconsistent. After a successful PlatformIO Upload command in VS Code , I see it.

image

After an unsuccessful PlatformIO Upload, I still see it, but after hitting refresh in the PlatformIO GUI a few times, it goes away.

image

image

By the way, if anyone else is playing along at home, you may not know how to start the Platform IO shown in these screenshots. I did not see a way to launch this from within the VS Code extension menus. After a little research, I learned I had to invoke it from the Platform IO Command Line Interface (CLI). I found a couple different ways to do this, but they each seem to do the same thing. Here's how:

  1. In VS Code, open the Command Palette by selecting the View | Command Palette... menu option.
  2. In the dialog box, type PlatformIO: New Terminal
  3. On the terminal command line, type pio home. This will open the PlatformIO GUI in a web browser at http://127.0.0.1:8008/

image

image

  1. Select the Devices option from the left Nav bar.

image

[Jim]

What other devices do you have connected? For example, I lose connectivity when my USB audio interface is active

/dev/cu.Bluetooth-Incoming-Port - I think this is my Bluetooth Personal Area Network (PAN). Currently no Bluetooth devices are connected, however.

/dev/cu.SRS-XB10-CSRGAIA - I think this is a Bluetooth speaker. It's disconnected and powered off.

[Jim]

If you pull the power button down quickly twice, does it mount a drive called Arduino?

I do not see any visual indication in Finder (or anywhere else that I can tell) that a drive called Arduino is mounted.

image

I do, however, get notifications when I do PlatformIO operations that the "Arduino" disk was not ejected properly.

image

Pulling down the power switch quickly twice on the WioTerminal allows me to reset it. I can then perform a PlatformIO: Upload operation once or twice before it fails again.

[Jim]

Were you able to update the firmware by following the instructions from Seeed

Yes. I followed the instructions to Update the Wireless Core Firmware. I did not, however, perform the directions for Update Seeed SAMD ArduinoCore or the Libraries Installation. I assume these are not needed. Is that a correct assumption?

Hopefully this extra detail help troubleshoot and fix the issue that we are seeing, and can save other users the same aggravation! :-)

Thanks both.

To get the devices tab, you can also just click the PlatformIO icon in the side too bar (the bug button), then select Quick Access -> PIO Home -> Open. That will bring up the same thing:

image

After an unsuccessful PlatformIO Upload, I still see it, but after hitting refresh in the PlatformIO GUI a few times, it goes away.

image

I get this happening a few times. It usually goes away when I do the double pull on the power button, and I can then upload.

Can I just double check with both of you, before trying an upload can you:

  • Pull the power button down twice quickly
  • Verify that the blue upload light is pulsing
IMG_5653.mp4

It can be tricky getting the timing right. If you do it right, you should see the disk not ejected notification:

image

You do need to do this every time you upload.

Thank you!! That video was very helpful! I wasn't pressing down fast enough. I didn't realize how often my device was leaving upload mode and how to get it back. I don't think that I was ever successfully returning to upload mode unless I restarted my computer. The difference between the blinking and solid light is subtle but very useful. In other words, solid = bad for uploading, blinking = good.

Thanks again for all of your help!

@juliakm - glad you got it working. It's a failing on our part that we weren't clear enough with how to set the device into upload mode. I'll raise a PR with more detailed instructions.

Right - I've updated the lesson 1 Wio lab with this. @marty-optum, does this fix your issues?

@jimbobbennett, I was successful 3 attempts out of 3 when trying the double-pull-down before each upload attempt.

I think for me, I did not realize that this was a requirement every time you upload to the Wio Terminal, especially since it seemed to work fine with earlier course modules without having to do this.

I did see these instructions in the Wio Terminal User manual that came with my device, but Seeed refers to this sequence as entering bootloader.

From Getting Started With Wio Terminal | FAQ

image

P.S. I don't exactly know how to tell when the blue LED is "breathing", but I assume that means it's a good thing :-)

Thank you @jimbobbennett and @juliakm for your assistance troubleshooting this! If there are no objections, I think we can close this issue.

Thanks for the update @marty-optum! Will close this.

Thanks both.

To get the devices tab, you can also just click the PlatformIO icon in the side too bar (the bug button), then select Quick Access -> PIO Home -> Open. That will bring up the same thing:

image

After an unsuccessful PlatformIO Upload, I still see it, but after hitting refresh in the PlatformIO GUI a few times, it goes away.
image

I get this happening a few times. It usually goes away when I do the double pull on the power button, and I can then upload.

Can I just double check with both of you, before trying an upload can you:

  • Pull the power button down twice quickly
  • Verify that the blue upload light is pulsing

IMG_5653.mp4
It can be tricky getting the timing right. If you do it right, you should see the disk not ejected notification:

image

You do need to do this every time you upload.

This solution (post) seems old, but it has saved my day! Thank you