March 20, 2025

Black Pill boards - F411 USB -- enumeration

Today was a big day. It was the first day I was able to make the HS usb on my F407 board work. It works in FS mode, but that is the only thing possible given the lack of a HS external Phy.

Along the way, I made various improvements to my debug -- and this flavor of the driver uses special interrupts for endpoint 1 activity. So it seemed worthwhile to capture and preserve the output here.

Note the following messages when we send application data:

OTG EP1 OUT ISR status: 00000001
Rebooted -- initializing
Nvic initialized with 91 IRQ
Initialize HS usb core with IRQ 77
USB init HS core: 40040000
USB base address: 40040000
Event - initUSB - flush Tx Fifo 16
USB - flush Rx Fifo

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 -- bytes: 0 -- int, sof, xof = 1 0 1

OTG ISR status: 00001000
interrupt: reset
USB - flush Tx Fifo 0
OTG ISR status: 00002000
interrupt - enumeration done
OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 8006000100004000
OTG ISR status: 00000018
USBint - Rx level
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 status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 8 bytes to FIFO: OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00001010
USBint - Rx level
interrupt: reset
USB - flush Tx Fifo 0
OTG ISR status: 00002008
interrupt - enumeration done
OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 00057C0000000000
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
- EP 0 StartXfer 0 bytes
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 8006000100001200
OTG ISR status: 00000018
USBint - Rx level
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 status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 18 bytes to FIFO: OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 8006000600000A00
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 8006000600000A00
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 8006000600000A00
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 8006000200000900
OTG ISR status: 00000018
USBint - Rx level
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 status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 9 bytes to FIFO: 	C
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 8006000200004300
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
Tx ctrl (67) 09024300020100C032090400000102020100052400100105240100010424020205240600010705820308001009040100020A0000000705010200020007058102000200
- EP 0 StartXfer 67 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 64 bytes to FIFO: 	C
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 3 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 3 bytes to FIFO: OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 800600030000FF00
OTG ISR status: 00000018
USBint - Rx level
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 status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 4 bytes to FIFO: 	
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 800602030904FF00
OTG ISR status: 00000018
USBint - Rx level
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 status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 64 bytes to FIFO: BS
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 2 bytes
- TxE interrupt enabled for endpoint 0
OTG ISR status: 00040008
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 2 bytes to FIFO: eOTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 800601030904FF00
OTG ISR status: 00000018
USBint - Rx level
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 status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 38 bytes to FIFO: &A
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 800603030904FF00
OTG ISR status: 00000018
USBint - Rx level
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 status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 empty Tx
Endpoint 0, write packet 26 bytes to FIFO: ␦0
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00000010
USBint - Rx level
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080018
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
USBint - Rx level
Endpoint 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 0009010000000000
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 setup done
Setup device request
- EP 1 StartXfer 512 bytes
- 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 0 read SETUP packet 8 bytes from FIFO
Rx setup (8) 2120000000000700
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 7 bytes
OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read DATA packet 7 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG ISR status: 00080008
USBint - OUT Endpoint
USBint = OUT Endpoint 0 xfer complete
- EP 0 StartXfer 0 bytes
OTG ISR status: 00040000
USBint - IN Endpoint
USBint = IN Endpoint 0 Xfer complete

Tick 1 -- bytes: 0 -- int, sof, xof = 509 469 88
Tick 2 -- bytes: 0 -- int, sof, xof = 1054 1014 88
Tick 3 -- bytes: 0 -- int, sof, xof = 1599 1559 88

** The above ends a succesful enumeration.
** Next I send a single 200 byte message from
** a C program running on the linux host


OTG ISR status: 00000010
USBint - Rx level
Endpoint 0 read SETUP 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 1 read DATA packet 64 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG EP1 OUT ISR status: 00000001
VCP_DataRx 64
- EP 1 StartXfer 512 bytes
OTG ISR status: 00000010
USBint - Rx level
Endpoint 1 read DATA packet 64 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG EP1 OUT ISR status: 00000001
VCP_DataRx 64
- EP 1 StartXfer 512 bytes
OTG ISR status: 00000010
USBint - Rx level
Endpoint 1 read DATA packet 64 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG EP1 OUT ISR status: 00000001
VCP_DataRx 64
- EP 1 StartXfer 512 bytes
OTG ISR status: 00000010
USBint - Rx level
Endpoint 1 read DATA packet 8 bytes from FIFO
OTG ISR status: 00000018
USBint - Rx level
OTG EP1 OUT ISR status: 00000001
VCP_DataRx 8
- EP 1 StartXfer 512 bytes
OTG ISR status: 00000018
USBint - Rx level
Endpoint 0 read SETUP 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 795 -- bytes: 200 -- int, sof, xof = 433760 433714 104
Tick 796 -- bytes: 200 -- int, sof, xof = 434306 434260 104

Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org