Go Down

Topic: Device Error (Read 527 times) previous topic - next topic

Feargaill

I uploaded this code and now get a device error 'Windows has stopped this device because it has reported problems. (Code 43) A request for the USB device descriptor failed.' I uninstalled, reinstalled, updated drivers, tried to roll back driver(not an option). I don't have a reset button either. I don't know what else to do. Arduino: 1.8.9 on Windows 10,

Code: [Select]
#include <MPU9250_asukiaaa.h>
#include <Wire.h>
#include "Mouse.h"
#define accelRange
#define gyroRange

MPU9250 myIMU; //only need yaw/pitch (x,y)


float aX, aY, gX, gY;

void setup() {
  Serial.begin(115200);
  Wire.begin();
 
  myIMU.beginAccel();
  myIMU.beginGyro();
 
  accelRange(0x08); // accel scale 4g; 2g=0x00; 8g=0x10; 16g=0x10
  gyroRange(0x10); // gyro scale 1000 DPD; 250DPS=0x00; 500DPS=0x10; 2000DPS=0x10
  Mouse.begin();
}

void loop() {

  myIMU.accelUpdate();
  aX = myIMU.accelX();
  aY = myIMU.accelY();
 
  myIMU.gyroUpdate();
  gX = myIMU.gyroX();
  gY = myIMU.gyroY();
 
  int total_gX = cos((gX)*cos(gY));
  int total_gY = sin((gX)*cos(gY));
 
  Mouse.move(total_gX, total_gY, 0);
}

BJHenry

What board are you using?

Feargaill


pert

Does the problem still occur if you disconnect all wiring/circuitry/components/modules/etc. from your Pro Micro?

Feargaill

I have a mpu9250 soldered, I can't disconnect it

pert

It may be that there is something in the sketch you uploaded that messed up your Pro Micro's USB functionality.

Try this:

File > New

Connect a wire to the reset pin on your Pro Micro and be ready to momentarily connect the other end of that wire to the ground pin.

Sketch > Upload

Watch the black console window at the bottom of the Arduino IDE window until you see something like this:
Code: [Select]
Sketch uses 3462 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.


Quickly connect the reset pin to ground and then disconnect it.

The upload should now finish successfully and your board should be recognized again. After this, you should be able to go back to uploading to the board normally again. If you upload the problematic sketch it may cause the problem to return. At a glance, I don't see anything about that sketch that would cause a problem. You could try running it without the Mouse library code to narrow down the cause of the error.

Feargaill


Feargaill

Worked! Thanks Pert

pert

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

Go Up