Delayed completion of first USB data transfer after microcontroller power-on

I am testing data transfer from a microcontroller to a host PC using USB CDC ACM on the nRF5340.
Right after powering on the microcontroller, only the first packet takes longer than usual to complete data transfer.
Although I haven’t measured the exact time, the logs clearly show that it is slower than normal.

The conditions for this issue are:

  • Immediately after powering on the microcontroller
  • Only for the first packet

I am using a custom Python script for testing.
The process is: open the virtual COM port, send a command to the microcontroller via USB, and then the microcontroller sends data to the PC.
If I wait about 1 second after opening the port before sending the command to the microcontroller, this issue does not occur.

Questions:

  • Is there any rule or recommended condition, such as needing to wait a few seconds after opening the port?
  • Are there any other possible reasons why USB data transfer from the microcontroller might be delayed?

Best Regards.

  • Hi,

    Having a kind of handshaking mechanism during startup might be a good idea in general. For instance when you power on the chip and connect USB, it will can for instance take several hundreds of ms to startup clocks and to enumerate the USB descriptors and reports with an host USB, so I would say it's not abnormal that there is a delay on the first packet no.

    Kenneth

Related