Legion2 / CorsairLightingProtocol

Control LEDs connected to an Arduino with iCUE, create an unofficial Corsair iCUE compatible Arduino LED controller.
Apache License 2.0
515 stars 64 forks source link

LS100 Does not stay connected. #248

Closed chanyork closed 3 years ago

chanyork commented 3 years ago

Describe the problem LS100 on Arduino Pro Micro Unstable connection. First irst time connection after the software upload works few minutes than it will disconnect and jump into Unknown USB Device (Device Descriptor Request Failed).

Tried different USB Port, different Arduino Pro Micro, different Cable results are the same.

Screenshots If applicable, add screenshots to help explain your problem.

System (please complete the following information):

Code changes Did you changed the code of the library or the sketch?

include

include

// Hint: The channels of the LS100 are swapped in iCUE, so the first channel in iCUE is here channel 2

define DATA_PIN_CHANNEL_1 A1

define DATA_PIN_CHANNEL_2 A0

define BUTTON_PIN A3

// Hint: The ATmega32U4 does not have enough memory for 135 leds on both channels // Ultrawide is 54 top and bottom 15 left and right // Setting up Array

CRGB ledsChannel1[22]; CRGB ledsChannel2[6];

CorsairLightingFirmware firmware = corsairLS100Firmware(); FastLEDController ledController(true); CorsairLightingProtocolController cLP(&ledController, &firmware);

const char mySerialNumber[] PROGMEM = "202B6949A001"; CorsairLightingProtocolHID cHID(&cLP, mySerialNumber);

void setup() { pinMode(DATA_PIN_CHANNEL_1, OUTPUT); pinMode(DATA_PIN_CHANNEL_2, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP); CLP::disableBuildInLEDs(); byte deviceId[4] = { 0x9A, 0xDA, 0xA7, 0x8F }; firmware.setDeviceID(deviceId); FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_1, GRB>(ledsChannel1, 22); FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 6); ledController.addLEDs(0, ledsChannel1, 16); ledController.addLEDs(1, ledsChannel2, 4);

//segment front represent corsair rear represent actual led

ledController.onUpdateHook(0, [](){ CLP::SegmentScaling segments[] = {{5, 5}, {6, 12}, {5, 5}}; CLP::scaleSegments(&ledController, 1, segments, 3); }); }

void loop() { static bool lightingEnabled = true; cHID.update();

if (buttonClicked()) {
    lightingEnabled = !lightingEnabled;
    fill_solid(ledsChannel1, 45, CRGB::Black);
    fill_solid(ledsChannel2, 144, CRGB::Black);
    FastLED.show();
}

if (lightingEnabled && ledController.updateLEDs()) {
    FastLED.show();
}

}

bool buttonClicked() { static bool previousState = 1; bool state = digitalRead(BUTTON_PIN); if (previousState == 0 && state == 1) { previousState = state; return true; } previousState = state; return false; }

Legion2 commented 3 years ago

Do you use the button to turn on and off the LEDs, if not remove the code for it, else the code must be updated with the correct number of LEDs.

chanyork commented 3 years ago

Yes, let me try that.

But I can not get my device connected now. keep saying Unknown USB Device (Device Descriptor Request Failed).

chanyork commented 3 years ago

Tried it, I removed the button code. And still the same. the LS100 will be recognize by the USB for about 30 seconds sometime longer and then suddenly become Unrecognized Device.

chanyork commented 3 years ago

I have a Lighting Node Pro - Arduino, which is running perfectly without any issues. somehow it seem to be the ls100 only to have the issue.

things I have tried. Uninstall and reinstall Icue: results is the same. tried on SparkFun Micro, Tried on Pro Micro, Tried on Leonardo it is all the same. Show Hidden USB device and delete all hidden USB driver and reconnect. Disable USB power saving mode. Nothing seems to be working.

chanyork commented 3 years ago

Will there be any issue if I am running a custom mega32u4 board? My Lighting Node Pro already running in it and it is 100% okay. It is LS100 firmware which I am having issue with.

chanyork commented 3 years ago

My VID is 0000 and PID is 0002

Legion2 commented 3 years ago

can you send the current code, where you removed the button code.

But I can not get my device connected now. keep saying Unknown USB Device (Device Descriptor Request Failed).

https://github.com/Legion2/CorsairLightingProtocol/wiki/Troubleshooting

chanyork commented 3 years ago

include

include

define DATA_PIN_CHANNEL_1 A1 //Channel1

define DATA_PIN_CHANNEL_2 A0 //Channel0

CRGB ledsChannel1[22]; CRGB ledsChannel2[22];

CorsairLightingFirmware firmware = corsairLS100Firmware(); FastLEDController ledController(true); CorsairLightingProtocolController cLP(&ledController, &firmware); const char mySerialNumber[] PROGMEM = "202B00000002"; CorsairLightingProtocolHID cHID(&cLP, mySerialNumber);

void setup() { byte deviceId[4] = { 0x90, 0xDA, 0xA7, 0x90 }; firmware.setDeviceID(deviceId);

CLP::disableBuildInLEDs(); FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_1, GRB>(ledsChannel1, 22); FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 22); ledController.addLEDs(0, ledsChannel1, 16); ledController.addLEDs(1, ledsChannel2, 16);

pinMode(DATA_PIN_CHANNEL_1, OUTPUT); pinMode(DATA_PIN_CHANNEL_2, OUTPUT);

//segment front represent corsair rear represent actual led

ledController.onUpdateHook(0, [](){ CLP::SegmentScaling segments[] = {{5, 5}, {6, 12}, {5, 5}}; CLP::scaleSegments(&ledController, 0, segments, 3); }); }

void loop() { cHID.update();

if (ledController.updateLEDs()) {
    FastLED.show();
}

}

chanyork commented 3 years ago

Attached is my schematic as well.

Schematic_Icue Lighting Node Pro V2_2021-09-23

Legion2 commented 3 years ago

Which Power supply do you use?

chanyork commented 3 years ago

5V-5a to power the led and USB power to power the atmega32U4-MU. In some schematic I saw a 1M resistor between the Crystal do I need that?

On Fri, 24 Sep 2021 at 00:59, Leon Kiefer @.***> wrote:

Which Power supply do you use?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Legion2/CorsairLightingProtocol/issues/248#issuecomment-925992616, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG37QOLCSZB7L3SHJ45SGSLUDNMIZANCNFSM5EMMSLNA .

Legion2 commented 3 years ago

can you reupload the latest sketch and make sure that it is successfully uploaded, in Arduino IDE it should not display an error if successfully uploaded.

chanyork commented 3 years ago

Hello Legion2, Thank you for your help. I think I probably found the issue to be the USB port connector. Seems to be a bad quality Female Port which can not keep the connection stable or my trace maybe too think that cause the connection D+/D- very unstable.

chanyork commented 3 years ago

Hello Legion2, Thank you for your help. I think I probably found the issue to be the USB port connector. Seems to be a bad quality Female Port which can not keep the connection stable or my trace maybe too think that cause the connection D+/D- very unstable.