Go Down

Topic: Pro Micro not found at startup (Read 800 times) previous topic - next topic

Grrrmachine

I've set up a Pro Micro as a media keyboard, sending media hotkeys based on readings from one analog pin.

It works great... right up until you reboot the computer. Then nothing. Disconnect it from the USB socket and plug it back in and it works fine again, until the next reboot.

Same issue on two PCs; one Windows 7, one Windows 8.1. I am tearing my hair out trying to work out why. Any ideas?

ballscrewbob

In your next post include the sketch..

55 posts under your belt so you should know what to add and how.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

pert

I have a Pro Micro permanently connected to my computer. It has been through many reboots without ever needing to be unplugged and plugged back in to work as an HID keyboard. So it is possible to make it work but I don't know what could be the problem.

Grrrmachine

I didn't post the code as it seemed to be more of a bootloader/driver issue, but here it is anyway:

Code: [Select]
#include "HID-Project.h"

const int pinButton = 3;
int data;

void setup() {
  //pinMode(pinButton, INPUT_PULLUP);

  // Sends a clean report to the host. This is important on any Arduino type.
  Consumer.begin();
  Serial.begin (9600);
}

void loop() {
  data=analogRead(pinButton);
  Serial.println (data);
    // See HID Project documentation for more Consumer keys

    if (data>140 && data <= 200) {
      Consumer.write(MEDIA_PLAY_PAUSE); }
     
    if (data>99 && data <= 110) {
      Consumer.write(MEDIA_PREVIOUS); }
     
    if (data>53 && data <= 65) {
      Consumer.write(MEDIA_NEXT); }
     
    if (data>3 && data <= 20) {
      Consumer.write(MEDIA_VOLUME_DOWN); }
   
    if (data>25 && data <= 40) {
      Consumer.write(MEDIA_VOLUME_UP); }
   
    if (data>290 && data <= 320) {
      Consumer.write(MEDIA_VOLUME_MUTE); }
   
    // Simple debounce
    delay(200);
 
}



I've got a similar board which shows up in the IDE as a Leonardo instead of a Pro Micro, so I presume it's got a newer bootloader on it. I'll have to set it up and give it a try to see if I have the same issue.

Grrrmachine

Very strange. I tried a different USB hub and cable and it seems to be working better. However, the two other devices (touchscreen panel and a bluetooth dongle) never had any issues, so I wonder if this was an issue with stable voltage?

ballscrewbob

USB power on laptops can be hit and miss.
More so with Macs !

USB hubs are usually a better choice but should be POWERED from its own supply of adequate rating for the amount of ports it has...eg a 4 port hub PSU should be able to supply 4 x 500mA

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Grrrmachine

Just an update: this issue still persists. I've tried two different hubs, two different USB cables, and two different Pro Micros. Behaviour is still the same:

1) Plug arduino into powered PC: detected and works fine immediately.
2) Turn PC off
3) Turn PC on: arduino not responding to inputs, one LED shines for power but none for RX/TX or any other behaviour
4) Unplug arduino
5) Reconnect arduino to PC: detected and works fine immediately.

Does this sound like a power issue, or a question of drivers? I've even reinstalled the PC from windows 7 to windows 10 and reinstalled the IDE to a newer version, but nothing's helping.

ballscrewbob

Put up a schematic of what you have connected to it and how.
Also if there are any changes in the sketch then post the current version.


It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Grrrmachine

Here's my fantastically professional component layout:



As you can see, there are quite a few USB devices attached so there is a chance that power is the issue here. Trouble is, the cable from the Brix to the Touchscreen hub is 5m, so I'd have to add step-down converter near there to add power to that hub, if that's the required solution. Fortunately things are tucked away behind the centre console, so I can tap into the cigarette lighter socket if I need power there.

ballscrewbob

A "block" diagram is certainly not a schematic and does not tell anyone what they need to know.

Also a 5 meter run of cable would certainly be suspect but without the detail who knows ?

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Grrrmachine

Apologies, I wasn't quite sure what you wanted. Something more like this?



As you can see, it's just reading a basic resistor ladder (six buttons of various resistances, with another resistor between Analog in and ground). I can't tell you the resistor values off the top of my head, unfortunately.

ballscrewbob

OK that makes much more sense.
I presume the USB HUB has its very own PSU ?
If it doesn't or is not powerful enough for all those items then that is likely the issue

I love resistor ladders / dividers for a few buttons it makes it so simple (wire wise)

If the HUB is properly powered then right now I can only see cable length being a problem and you might need.

Another thought and this would relate directly to the PC.
Ensure you do NOT have any power saving enabled on the USB ports.
Power saving on PC's can and do cause issues but mostly on laptops or similar.
there are usually settings that can be changed to make sure it always supplies full power and other settings that will always pick up USB devices from power up. Some are OS dependant and the latter is usually a BIOS setting.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Grrrmachine

I presume the USB HUB has its very own PSU ?
Unfortunately not, and that seems to be the crux of the problem. I just tried disconnecting the hub and connecting the Arduino solely to the 5m USB cable, and it was found at startup multiple times with no issue. So it looks like I simply drained too much power from the 5V line on that USB port, so the Arduino didn't boot properly.

I'll look into powering that hub now; hopefully it'll resolve the issue.

Go Up