March 19, 2025

Black Pill boards - F411 USB -- enumeration

I turned on a bunch of debug, then booted up Hydra on my F407 board. Then after a bit, I plugged the cable in to the FS usb port. It successfully enumerated (linux is happy) and I captured all the debug. Amazingly all of this serial output did not cause any trouble with enumeration.

Why all of this? Because we expect the HS port to do exactly the same.

The "enumeration done" interrupt is weirdly named. We see it right at the start of enumeration, not the end. The TRM calls this "speed enumeration", Aha! A different sort of enumeration than this process we are looking at. A register can be read to find out the speed determined.

Note that bit 0008 is SOF and we get this every millisecond.


=========================
*********** startup messages
=========================

Rebooted -- initializing
Nvic initialized with 91 IRQ
Initialize FS usb core with IRQ 67
USB init FS core: 50000000
USB base address: 50000000
Event - initUSB - flush Tx Fifo 16
USB - flush Rx Fifo

***************OTG ISR called
OTG ISR called
OTG ISR status: 00000800
interrupt: suspend
***************
******************************
******************************
******************************
Up and running mainline code
March 8, 2025
RCC conf when done: BF00940A
F407 cpu running at 168000000 Hz
 Pclk1 (slow) = 42000000 Hz
 Pclk2 (fast) = 84000000 Hz
xfer test!
Tick 0 -- 0
Tick 1 -- 0

=========================
*********** when I plug in USB cable
*********** it does enumerate OK
*********** Note that the whole process is
***********  done in less than a second.
=========================

OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 8006000100004000
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (8) 1201000200000040
- EP 0 StartXfer 8 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 8 bytes to FIFO: OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00001010
USBint - Rx level
interrupt: reset
USB - flush Tx Fifo 0
OTG ISR called
OTG ISR status: 00002010
USBint - Rx level
interrupt - enumeration done
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 0005560000000000
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 8006000100001200
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (18) 120100020000004083044057000201020301
- EP 0 StartXfer 18 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 18 bytes to FIFO: OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 8006000600000A00
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 8006000600000A00
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 8006000600000A00
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 8006000200000900
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (9) 09024300020100C032
- EP 0 StartXfer 9 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 9 bytes to FIFO: 	C
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 8006000200004300
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (67) 09024300020100C03209040000010202010005240010010524010001042402020524060001070582030800FF09040100020A0000000705010240000007058102400000
- EP 0 StartXfer 67 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 64 bytes to FIFO: 	C
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 3 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 3 bytes to FIFO: @OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 800600030000FF00
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (4) 04030904
- EP 0 StartXfer 4 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 4 bytes to FIFO: 	
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 800602030904FF00
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (66) 4203530054004D003300320020005600690072007400750061006C00200043006F006D0050006F0072007400200069006E0020004600530020004D006F0064006500
- EP 0 StartXfer 66 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 64 bytes to FIFO: BS
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 2 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 2 bytes to FIFO: eOTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 800601030904FF00
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (38) 2603410043004D0045002000620061007200200061006E00640020006700720069006C006C00
- EP 0 StartXfer 38 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 38 bytes to FIFO: &A
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 800603030904FF00
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (26) 1A03300030003000300030003000300030003000350030004300
- EP 0 StartXfer 26 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 26 bytes to FIFO: ␦0
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 0009010000000000
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
- EP 1 StartXfer 64 bytes
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00040018
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 2120000000000700
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup interface request
- EP 0 StartXfer 7 bytes
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 7 bytes from FIFO
OTG ISR called
OTG ISR status: 00000018
USBint - Rx level
OTG ISR called
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR called
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
OTG ISR called
OTG ISR status: 00000008
OTG ISR called
OTG ISR status: 00000008
...
...
=========================
=========================
And for fun here is the output when I send a 200 byte data
packet (which will go to endpoint 1)
=========================
=========================

Tick 29 -- bytes: 0 -- int, sof, xof = 15772 15732 88
Tick 30 -- bytes: 0 -- int, sof, xof = 16317 16277 88
OTG ISR status: 00000010
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 2122030000000000
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup interface request
- EP 0 StartXfer 0 bytes
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
OTG ISR status: 00000018
USBint - Rx level
Endpoint ??, read packet 64 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 1 xfer complete
VCP_DataRx 64
- EP 1 StartXfer 64 bytes
OTG ISR status: 00000010
USBint - Rx level
Endpoint ??, read packet 64 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 1 xfer complete
VCP_DataRx 64
- EP 1 StartXfer 64 bytes
OTG ISR status: 00000010
USBint - Rx level
Endpoint ??, read packet 64 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 1 xfer complete
VCP_DataRx 64
- EP 1 StartXfer 64 bytes
OTG ISR status: 00000010
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 1 xfer complete
VCP_DataRx 8
- EP 1 StartXfer 64 bytes
USBint - Rx level
Endpoint ??, read packet 8 bytes from FIFO
Rx setup (8) 2122000000000000
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup interface request
- EP 0 StartXfer 0 bytes
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
Tick 31 -- bytes: 200 -- int, sof, xof = 16882 16836 107
Tick 32 -- bytes: 200 -- int, sof, xof = 17428 17382 107

Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org