-
-
Notifications
You must be signed in to change notification settings - Fork 725
Turn off USB functionnality / SerialUSB.end() not implemented #103
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
Comments
@AloyseTech good question! I think |
Actually it doesn't solve the issue... I've experimented a bit but none of the experiment I tried was succesfull... I talked to @aethaniel about this issue, but I'm not sure to understand what the real issue is. Here's some snippet I tried :
|
I believe I'm having the same issue of releasing the native Serial/USB port. I'm having trouble waking from from standby sleep mode with an open Serial Monitor connection. I did a SerialUSB.end before sleep, but it doesn't seem to release the USB port. It then hangs at the SerialUSB.begin command when waking up. (Verified that it does wake up, interrupts still function). I'm about to dig into the Arduino USB core and the datasheet, but would love to hear if you've come up with a solution @AloyseTech . |
No I haven't found any solution at the moment. I'm not sure we're facing the same issue : the bug I have also appear when no Serial monitor connection has been or is opened... Or maybe experiment like I posted with those lines of code :
|
Thanks for the advice, @AloyseTech . I first tried detaching & disabling before sleep and enabling & attaching after. The port disappeared and re-enumerated as it should, but Serial commands still hung my program. This was my implementation:
Next, I tried a complete USB hardware reset and re-initialization. This worked, Serial commands now function normally.
I never see "Waking!" because it's not buffered and takes time to re-establish the Serial Monitor link. But subsequent serial outputs show up normally. Yes, I see what you mean about the SerialUSB.end. I also see that the SerialUSB.begin function isn't implemented either, as it's taken care of elsewhere in the CDC setup. This is the first time I've looked through these functions, so I'm still getting familiar with it all. I'd like to figure out the precise cause of the sleep hang-up with Serial functions, but the hardware reset is an OK bandaid for now. Eventually it would be nice to get the USB suspend mode and wake-up interrupts working. |
Hi, Has anyone succeeded to turn off and then back on Native USB? I'm still having trouble with this issue... |
Edit: Ah, I see I was ahead of myself. Forgot I already reported back on this a few months ago! Not using SerialUSB or attach/detach. I was only able to do it by commanding a software reset on the usb module, then re-initializing. I'm on the road now but can attach my code next week if it helps. I think I did a direct write to the software reset bit in the USB register to shut everything down, then used the arduino usb functions to re-initialize. -Carrie Sent from my telephone. |
I would be very much interested in this. Could any one of you share their solution? |
Hi guys,
That would work somehow if delay(5000) is added before the SerialUSB.println("Waking!");
which expects the character a with CRLF. Nothing is received. |
Hi @rocketscream , |
@facchinm but will this solve the incapability to receive after waking up too? If not, I will open another issue. |
@rocketscream It should; sample code:
with sleep() defined as https://github.com/arduino-libraries/ArduinoLowPower/blob/8b7e548d58b4aa96347108a900c35443d2cb9b92/src/samd/ArduinoLowPower.cpp#L18 On my PC the call to sleep detaches the serial port completely. If I leave the serial monitor open, the port will change name on resume (default behaviour in Linux since the monitor il locking the other port). Selecting the right name and opening the monitor again unlocks |
@facchinm thank you very much for fixing this. I will try this. And yes, I'm on Linux machine so I expecting the same behavior as yours. Will report back! |
Hi I am using Window10 with Feather M0 board, not able to ger serial intialized after awake, please suggest /* Create an rtc object */ void setup() void loop() AlarmTime = rtc.getSeconds()+10; // Adds 10 seconds to alarm time rtc.setAlarmSeconds(AlarmTime); // Wakes at next alarm time Serial.end(); // Simple indication of being awake delay(1000); // Delay added to make serial more reliable Serial.begin(9600); void alarmMatch() // Do something when interrupt called } |
Can I have your code ? Is it working? |
This is related to the Not working on SAMD#5 issue from @arduino-libraries ArduinoLowPower library. |
SerialUSB.end() function in cores/arduino/USB/CDC.cpp is not implemented.
When trying to jump from an application to an other (using this function http://pastebin.com/FyjkXJR2), the new application doesn't start if the USB cable is plugged in. I tried to do a SerialUSB.end() rigth before jumpApplication(), but the function is not implemented. I think something should be done to be able to stop all USB activity. Maybe it is not the aim of this function. If so, please point me to the right one 😃
Thanks!
The text was updated successfully, but these errors were encountered: