Skip to content

USB serial doesn't open immediately after reset #333

Closed
@andrewjherbert

Description

@andrewjherbert

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions