Author Topic: Not all USB cables can flash an MCU? I can't believe my eyes  (Read 2614 times)

0 Members and 1 Guest are viewing this topic.

Offline analogoTopic starter

  • Regular Contributor
  • *
  • Posts: 85
  • Country: at
Not all USB cables can flash an MCU? I can't believe my eyes
« on: March 13, 2017, 05:28:57 pm »
I thought all the USB cables where the same. I made fun of audiofools, but now...

I received a new NodeMCU board and proceeded to flash it via USB using the Arduino IDE. After a while the flashing process was interrupted. Well, it happens. Let's tray again. Same. Let's just read serial data from another, already flashed board. Garbage. Only after a while I tried a new cable and... it worked.  :wtf: The MCU flashed correctly and the serial output was working just fine. I tried again with the other cable and the old problems reappeared. I could not, and I still can not believe it.  :-//

I tried all the mirco USB cables I have in my house, from solid data cables to random cables that came with power adapters. Out of 15 only 3 worked reliably.

Why? All these USB cables work just fine when I used them to connect to external HDs and other stuff. I can imagine that these MCU dev kits are using chipsets that are flakier than what is used in USB-SATA controller, but still I cannot imagine which part of the cable could make a difference. They are just four wires twisted together, aren't them?

What makes the three working USB cables better than others 12 non-flashing cables?
 

Offline DavidDLC

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #1 on: March 13, 2017, 05:58:37 pm »
Maybe it is a combination of the board and some cables ?

Not necessarily the cables are wrong.

David DLC.
 

Offline bktemp

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: de
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #2 on: March 13, 2017, 06:11:34 pm »
Most USB problems are due to the voltage drop on the cable for the 5V supply voltage.
If you have a scope, you could look at the supply rail on the board. Maybe it drops while flashing (I doubt it draws so much current but that is easy to check).
It could also be a bad USB phy implementation with marginal signal integrity but that is more difficult to analyse.
Or it could be a cheap or broken USB connector only making a good contact with some cables.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13987
  • Country: gb
    • Mike's Electric Stuff
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #3 on: March 13, 2017, 06:14:23 pm »
There are a lot of USB cables out there with inadequate power cores. It may also be that something else is so marginal that it's so close to the edge that small cable differences will push it over .
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2417
  • Country: us
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #4 on: March 13, 2017, 06:17:06 pm »
You ever looked at how small the wires are on cheap USB cables? Those 3 cables were probably of higher quality. Larger wires, less resistance. Maybe they were the shortest cables as well?

My experience is that when flashing NodeMCU, you're right on the edge of what a vanilla computer USB port will provide currentwise. My problems with that went away when I provided external power and only used USB for comms.
« Last Edit: March 13, 2017, 06:19:35 pm by Nusa »
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8789
  • Country: fi
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #5 on: March 13, 2017, 06:21:48 pm »
As others have said, most likely a design issue with said "NodeMCU board", not providing enough bulk capacitance needed for the operation with most USB cables. You could try to solder a large (like 470uF or even bigger) electrolytic capacitor right to the 5V input of the board and redo your tests and see how many cables pass.
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2437
  • Country: gb
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #6 on: March 13, 2017, 07:15:05 pm »
^^^What he said.
Or maybe a crappy micro-usb socket on the nodeMCU?
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 17203
  • Country: 00
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #7 on: March 13, 2017, 07:29:28 pm »
Try measuring the voltage on the MCU using the different cables. I bet you'll find something.
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4751
  • Country: dk
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #8 on: March 13, 2017, 07:48:53 pm »
As others have said, most likely a design issue with said "NodeMCU board", not providing enough bulk capacitance needed for the operation with most USB cables. You could try to solder a large (like 470uF or even bigger) electrolytic capacitor right to the 5V input of the board and redo your tests and see how many cables pass.

the USB specification specifies a maximum capacitance on Vusb of 10uf to limit inrush current
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #9 on: March 13, 2017, 08:47:58 pm »
I've encountered several USB cables that were either bad or just made with such thin wires that they couldn't power the device I tried plugging in. Now I usually just throw away any that look marginal and use a good quality cable.  You need not spend a lot, decent USB cables can be found cheaply.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8789
  • Country: fi
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #10 on: March 13, 2017, 09:11:22 pm »
the USB specification specifies a maximum capacitance on Vusb of 10uf to limit inrush current

10uF is the limit if you just passively connect a capacitor there, but there are cases where 10uF simply is not enough, and I guess this device might be one, requiring quite high pulse currents due to the WLAN transceiver. And btw, this limit, strictly speaking, is not there to limit inrush current - the current can't be limited by limiting the capacitance, so the inrush current itself is OK to begin with.

The USB spec does allow larger capacitances in the device, but then you need an inrush limiter circuit (which doesn't need to be too complex, but it's more than just the cap)

This kind of a crappy toy device, however, isn't going to follow the relevant standards anyway, it probably doesn't even negotiate for more current; so you can just add the cap and test whether the success rate goes up. A 470uF cap is not going to blow any physical fuses, or damage the hub (at least hopefully - but you always do everything at your own risk, when reading forum advice).

« Last Edit: March 13, 2017, 09:21:34 pm by Siwastaja »
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1562
  • Country: gb
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #11 on: March 14, 2017, 01:11:15 am »
I had a similar problem a while ago. A micro USB cable I was using on an AVRISP MkII just suddenly decided one day to give me trouble. This was a cable I'd been successfully using for years, but all of a sudden was dropping too much voltage, because of too much resistance on the wire. Not sure if it suddenly went bad, or had been steadily declining and had reached the point where it was marginal.
 

Offline AlessandroAU

  • Regular Contributor
  • *
  • Posts: 168
  • Country: au
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #12 on: March 14, 2017, 01:17:30 am »
Those ESP8266 boards often default to the 1Mbit flash rate, I find that sometimes this causes the flashing to flail randomly sometimes, only to work fine when you press the upload button again. I bet if you reduce the flash speed to 115200 all of your cables will work fine.
 

Offline analogoTopic starter

  • Regular Contributor
  • *
  • Posts: 85
  • Country: at
Re: Not all USB cables can flash an MCU? I can't believe my eyes
« Reply #13 on: March 14, 2017, 08:21:44 am »
Those ESP8266 boards often default to the 1Mbit flash rate, I find that sometimes this causes the flashing to flail randomly sometimes, only to work fine when you press the upload button again. I bet if you reduce the flash speed to 115200 all of your cables will work fine.

Random failures is what I suspected at first, but nope, in this case the cables play an important role. And you lost your bet: I always use 115200.  >:D
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf