-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USB interface does not seem to be working #4
Comments
That’s weird, my Switch is up to date (13.2.0) and it works. |
I'm on home menu when I push the button but nothing happens. Is there some sort of video tutorial? Just to check if there's something I'm missing. Also, TX and RX LEDs won't light up, only L LED is blinking. I mentioned in my previous post but just to be clear, it works with the Switch docked, right? |
Yes, the Switch needs to be docked.
From your description, it looks like the Arduino doesn’t register the pushbutton being pressed. Maybe there’s a problem with it? You can try replacing it with a piece of wire to temporarily bridge pins 12 and GND. |
I bridged pin12 and GND as you suggested but I still get the same. L doesn't blink "rapidly" tho, the sequence goes like: ON during t_0 seconds, OFF during t_0 seconds, ON during t_0 seconds, OFF during t_1 seconds, being t_1 > t_0 (haven't measured exactly these times but I can tell just by looking at it), then start the sequence again. Not sure if it's worth mentioning this but NSwitch is always kept in airplane mode (Bluetooth ON, NFC OFF, WiFi OFF), there are some updates I don't want to install so I keep it like that. As far as I'm aware, this shouldn't affect USB connections but just in case. Also, I always leave Joy-Cons plugged to the NSwitch and use the Pro controller, which is always connected via Bluetooth when testing this. Since bridging these pin12 and GND doesn't seem to affect L LED (it keeps blinking), I suppose it's stuck at |
OK, this makes more sense. L blinking N times, stopping, and blinking again indicates that the main µC (ATmega328P) has encountered an error condition and has entered “panic mode” by calling the
I tried it on my Switch (by undocking it, putting it in airplane mode, re-docking it and reconnecting the pro controller) and it didn’t have any effect on the operation of the Arduino.
Same here. |
This is what I got with
Pressed the reset button and L started blinking rapidly this time. Then I tried pushing the button and L turned off (and never turned on again unless I press reset button) but no controller setup was performed. EDIT: also tried bridging the pins together just in case but same result |
Looks fine; I guess USB configuration is working, at least.
Okay, that means the serial port communication between the µCs seem to be working, but not at startup. Maybe try increasing the startup delay a bit (maybe 11 -> 21 in
This means the main µC started the automation sequence (which means the button press was correctly recognized), but stopped because the “give me more data” message from the USB µC was not received. The following patch may help debugging the issue: diff --git a/src/usb-iface/usb-iface.c b/src/usb-iface/usb-iface.c
index c4f118a..9d30077 100644
--- a/src/usb-iface/usb-iface.c
+++ b/src/usb-iface/usb-iface.c
@@ -160,6 +160,7 @@ void refresh_and_send_controller_data(void)
send_count += 1;
if (send_count == 5) {
+ LEDs_ToggleLEDs(LEDMASK_TX);
send_count = 0;
}
}
@@ -180,6 +181,7 @@ bool refresh_controller_data(void)
/* Refresh the controller data */
if (recv_buffer_count == DATA_SIZE) {
+ LEDs_ToggleLEDs(LEDMASK_RX);
uint8_t magic_data = recv_buffer[MAGIC_INDEX];
if ((magic_data & MAGIC_MASK) == MAGIC_VALUE) {
@@ -194,7 +196,7 @@ bool refresh_controller_data(void)
new_led_state |= LEDMASK_RX;
}
- LEDs_SetAllLEDs(new_led_state);
+ //LEDs_SetAllLEDs(new_led_state);
/* Don’t copy the magic byte to the controller data, leave it 0 */
memcpy(out_data, recv_buffer, DATA_SIZE - 1); It changes the TX/RX LEDs to do the following:
I have noticed that for some reason, my Arduino’s main µC works but does not accept being reprogrammed. This means that unfortunately I may not be able to help you debug this issue further until I buy a new one. |
Tried that but I still have to press reset.
Also tried that but TX/RX never blinked. You mentioned RX should toggle at each reset and stay still until I press the button but I didn't see that happening I'm always a bit paranoid about not correctly programming the ATmega16U2 so I double checked it by reading flash content and comparing it with the newly generated HEX file (even though that's what avrdude does). EDIT: tried the same with my PC (I mean, the patch). Here, I get different results every time I disconnect and connect the Arduino to the PC: Sometimes TX and RX LED turn on at the same time, sometimes only RX LED turns on. But on Switch, they're both off. |
For some reason I don't know, I can't seem to build the same exact file as the one you provided. Anyway, I tried flashing the one you posted and did all the steps but still does not work. I guess I'm giving up :( thanks for the help! |
USB interface does not seem to be working. I was able to compile the project successfully and flashed both .hex to each ATmega. Verification (avrdude) was OK. I read flash content manually to make sure it was flashed properly as well. Everything seems fine but it does nothing on my Nintendo Switch. I was thinking maybe it's not compatible with latest NSwitch version? Mine is currently on 13.2.0 (btw, I tried to connecting the Arduino to both USB ports on the side and the one on the back)
The text was updated successfully, but these errors were encountered: