0

Uploading to the Itsy Bitsy 32u4 5V
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Uploading to the Itsy Bitsy 32u4 5V

by cansun on Tue Apr 17, 2018 5:31 pm

Test programs I've written to learn about using the alphanumeric backpack and SleepyDog library worked great. BUT using the same computer, cable, USB-2 port, the latest board and libraries and the Arduino IDE won't let me upload my program of interest. This program of mine compiles, uses only 9262 bytes of flash and 965 bytes of dynamic memory.
Here's what happens: I connect the board, select Itsy Bitsy 32u4, 5V and Com 5 (which was indicated and worked for everything previous on the same board). Compilation and download proceed, LED flashes then up pops a Windows 10 message saying that the USB device was not recognized and that there was a device malfunction. In the process the Com port indicator in the Arduino IDE editor indicates the the Com port has changed from 5 to 7 and the port selection option in "tools" is grayed out. I can reset the Itsy Bitsy by bringing up one of my earlier test programs (ports option is still grayed out), selecting "download" then double clicking the reset button on the Itsy Bitsy board just as the compile step completes. The program downloads, but still shows com 7 at the bottom of the editor pane, however, if I select tools, ports is no longer grayed out and when selected shows com 5 and it can be selected. From this point on everything is normal. Hmmmm... quite a puzzle. Any ideas?

cansun
 
Posts: 7
Joined: Sat Dec 09, 2017 10:55 am

Re: Uploading to the Itsy Bitsy 32u4 5V

by adafruit_support_mike on Wed Apr 18, 2018 2:34 am

Having the port change is normal.

The ATmega3u4 handles USB communication internally, so the bootloader needs to set up a USB connection to upload firmware. Then it has to tear that connection down before handing control over to the code you've just uploaded, since that code won't be able to see data structures that belong to the bootloader. If your own code wants to use the Serial connection, it has to set up its own USB connection.

The process of registering a device with a USB hub takes time, so all operating systems keep a cache of settings for devices they've seen before to save time when those devices reconnect. Windows saves that information in terms of COM ports.

To Windows, the swap between your code's USB connection and the bootloader's USB connection looks like one device being unplugged and another one being plugged in, so it assigns different COM ports to those connections.

If you can only do successful firmware uploads part of the time, it might be a cable problem. USB signals are fast enough that the cable is a component, and they aren't all the same. Sometimes a minor difference in cable impedance can cause signal problems that make the data connection marginal.

Try a couple of other cables and see if you get the same behavior.

At worst, you can double-click the reset button to force the bootloader to restart while trying to upload the code that isn't going through now. Enabling verbose messages during upload in the Arduino IDE's preferences makes it easier to get the timing right: do the reset when the lines that begin with 'PORTS' start to scroll past in the debugging pane.

adafruit_support_mike
 
Posts: 63679
Joined: Thu Feb 11, 2010 2:51 pm

Re: Uploading to the Itsy Bitsy 32u4 5V

by cansun on Wed Apr 18, 2018 12:48 pm

Some great ideas. I'll get to work trying them. I'll also try putting a USB hub in line to see if it's a communication/cable problem.
Thanks for your prompt reply. I'll let you know about the result.

cansun
 
Posts: 7
Joined: Sat Dec 09, 2017 10:55 am

Re: Uploading to the Itsy Bitsy 32u4 5V

by cansun on Sat Apr 21, 2018 2:33 pm

After much hunting I think I've found the source of the problem... Ooops... I forgot to include "alpha4.begin (0x70)" in setup to identify the Adafruit quad hexadecimal display. Seems that really makes a mess of things even though the code compiles perfectly without it.
Thanks very much for your suggestions though. I'm sure some of them will be of use in the future.

cansun
 
Posts: 7
Joined: Sat Dec 09, 2017 10:55 am

Re: Uploading to the Itsy Bitsy 32u4 5V

by adafruit_support_mike on Sun Apr 22, 2018 1:22 am

Glad to hear you got it working. Happy hacking!

adafruit_support_mike
 
Posts: 63679
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.