-
Notifications
You must be signed in to change notification settings - Fork 964
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 serial doesn't open immediately after reset #333
Comments
Related to #288 and raspberrypi/pico-examples#60 I know very little about the lowlevels of USB, but I think some of the timing-sensitive delay might be partly due to the USB enumeration-process happening on the host? |
Good thought, and I guess this will arise every time the Pico restarts as the host will detect the disconnect / reconnect?
The host is a RPi4 running Raspbian.
I guess the solution is to use UART serial but that involves another set of cables and in my application I have mortgaged most of the GPIO pins to other purposes.
Am I correct in understanding that I can connect to any one set of UART GPIO pins for this purpose, I don’t have to use the first set as per the examples, or do I have to do something to point the Pico at the right set?
Cheers,
Andrew (aka EDSAC)
… On 11 Apr 2021, at 23:43, Andrew Scheller ***@***.***> wrote:
Related to #288 <https://github.com/raspberrypi/pico-sdk/issues/288> and raspberrypi/pico-examples#60 <raspberrypi/pico-examples#60>
I know very little about the lowlevels of USB, but I think some of the timing-sensitive delay might be partly due to the USB enumeration-process happening on the host?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#333 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AOZH36OWCUUMZXYXN66CIYTTIIQ2VANCNFSM42YEREMQ>.
|
There's some handy defines in https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards/pico.h 😃 |
Great, thanks!
A.
… On 12 Apr 2021, at 10:36, Andrew Scheller ***@***.***> wrote:
Am I correct in understanding that I can connect to any one set of UART GPIO pins for this purpose, I don’t have to use the first set as per the examples, or do I have to do something to point the Pico at the right set?
There's some handy defines in https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards/pico.h <https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards/pico.h> 😃
To override their values, just define them in your own application code before including any pico-sdk headers.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#333 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AOZH36LLWYUPC4IKSYL4AB3TIK5IBANCNFSM42YEREMQ>.
|
From one Andrew to another, you're welcome! 😁 |
having a "wait for connected" method should be a separate issue (there may be one) |
If my program commences output to the USBserial port immediately after reset the initial output is lost.
Putting a 1000ms delay at the start of my program cures the problem.
Another work-around is as follows:
#include "tusb.h"
int main() {
stdio_init_all();
adc_init();
printf("waiting for usb host");
while (!tud_cdc_connected()) {
printf(".");
sleep_ms(500);
}
printf("\nusb host detected!\n");
But this too appears to be time sensitive - if I make the sleep <= 10ms I still lose the first line.
It would be nice to have a helper function that gets this right, or an option on opening the port.
Thanks.
The text was updated successfully, but these errors were encountered: