2024-11-14 11:05 AM
Using a Nucleo-F411RE board modified to have 8MHz HSE crystal oscillator and running the OTG peripheral in forced host mode, we are working on implementing our own host stack. With the current code no IRQs trigger until a device is physically attached to the port. However, when we plug up a device then the DISCINT bit in GINTSTS is set along with PCSTS and PCDET in FS_HPRT. Since the host port IRQ is unmasked in FS_GINTMSK the code correctly branches to the global USB ISR, but we are curious as to why the DISCINT (device disconnect) but would also be tripped. We have verified that this bit is not prematurely firing before we physically plug in the USB device. The register setup after our USB hardware configuration is as follows:
OTG_FS_HOST
FS_HCFG 0x00000200 0x50000400
FSLSPCS 0x0 [1:0]
FSLSS 0 [2:2]
HFIR 0x0000ea60 0x50000404
FRIVL 0xea60 [15:0]
FS_HFNUM 0xea603fff 0x50000408
FRNUM 0x3fff [15:0]
FTREM 0xea60 [31:16]
FS_HPTXSTS 0x00080200 0x50000410
PTXFSAVL 0x0200 [15:0]
PTXQSAV 0x08 [23:16]
PTXQTOP 0x00 [31:24]
HAINT 0x00000000 0x50000414
HAINT 0x0000 [15:0]
HAINTMSK 0x00000000 0x50000418
HAINTM 0x0000 [15:0]
FS_HPRT 0x00041803 0x50000440
PCSTS 1 [0:0]
PCDET 1 [1:1]
PENA 0 [2:2]
PENCHNG 0 [3:3]
POCA 0 [4:4]
POCCHNG 0 [5:5]
PRES 0 [6:6]
PSUSP 0 [7:7]
PRST 0 [8:8]
PLSTS 0x2 [11:10]
PPWR 1 [12:12]
PTCTL 0x0 [16:13]
PSPD 0x2 [18:17]
FS_HCCHAR0 0x00000000 0x50000500
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCCHAR1 0x00000000 0x50000520
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCCHAR2 0x00000000 0x50000540
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCCHAR3 0x00000000 0x50000560
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCCHAR4 0x00000000 0x50000580
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCCHAR5 0x00000000 0x500005a0
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCCHAR6 0x00000000 0x500005c0
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCCHAR7 0x00000000 0x500005e0
MPSIZ 0x000 [10:0]
EPNUM 0x0 [14:11]
EPDIR 0 [15:15]
LSDEV 0 [17:17]
EPTYP 0x0 [19:18]
MCNT 0x0 [21:20]
DAD 0x00 [28:22]
ODDFRM 0 [29:29]
CHDIS 0 [30:30]
CHENA 0 [31:31]
FS_HCINT0 0x00000000 0x50000508
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINT1 0x00000000 0x50000528
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINT2 0x00000000 0x50000548
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINT3 0x00000000 0x50000568
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINT4 0x00000000 0x50000588
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINT5 0x00000000 0x500005a8
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINT6 0x00000000 0x500005c8
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINT7 0x00000000 0x500005e8
XFRC 0 [0:0]
CHH 0 [1:1]
STALL 0 [3:3]
NAK 0 [4:4]
ACK 0 [5:5]
TXERR 0 [7:7]
BBERR 0 [8:8]
FRMOR 0 [9:9]
DTERR 0 [10:10]
FS_HCINTMSK0 0x00000000 0x5000050c
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCINTMSK1 0x00000000 0x5000052c
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCINTMSK2 0x00000000 0x5000054c
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCINTMSK3 0x00000000 0x5000056c
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCINTMSK4 0x00000000 0x5000058c
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCINTMSK5 0x00000000 0x500005ac
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCINTMSK6 0x00000000 0x500005cc
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCINTMSK7 0x00000000 0x500005ec
XFRCM 0 [0:0]
CHHM 0 [1:1]
STALLM 0 [3:3]
NAKM 0 [4:4]
ACKM 0 [5:5]
NYET 0 [6:6]
TXERRM 0 [7:7]
BBERRM 0 [8:8]
FRMORM 0 [9:9]
DTERRM 0 [10:10]
FS_HCTSIZ0 0x00000000 0x50000510
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
FS_HCTSIZ1 0x00000000 0x50000530
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
FS_HCTSIZ2 0x00000000 0x50000550
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
FS_HCTSIZ3 0x00000000 0x50000570
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
FS_HCTSIZ4 0x00000000 0x50000590
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
FS_HCTSIZ5 0x00000000 0x500005b0
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
FS_HCTSIZ6 0x00000000 0x500005d0
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
FS_HCTSIZ7 0x00000000 0x500005f0
XFRSIZ 0x00000 [18:0]
PKTCNT 0x000 [28:19]
DPID 0x0 [30:29]
OTG_FS_GLOBAL
FS_GOTGCTL 0x001c0000 0x50000000
SRQSCS 0 [0:0]
SRQ 0 [1:1]
HNGSCS 0 [8:8]
HNPRQ 0 [9:9]
HSHNPEN 0 [10:10]
DHNPEN 0 [11:11]
CIDSTS 0 [16:16]
DBCT 0 [17:17]
ASVLD 1 [18:18]
BSVLD 1 [19:19]
FS_GOTGINT 0x00000000 0x50000004
SEDET 0 [2:2]
SRSSCHG 0 [8:8]
HNSSCHG 0 [9:9]
HNGDET 0 [17:17]
ADTOCHG 0 [18:18]
DBCDNE 0 [19:19]
FS_GAHBCFG 0x00000181 0x50000008
GINT 1 [0:0]
TXFELVL 1 [7:7]
PTXFELVL 1 [8:8]
FS_GUSBCFG 0x20001440 0x5000000c
TOCAL 0x0 [2:0]
PHYSEL 1 [6:6]
SRPCAP 0 [8:8]
HNPCAP 0 [9:9]
TRDT 0x5 [13:10]
FHMOD 1 [29:29]
FDMOD 0 [30:30]
CTXPKT 0 [31:31]
FS_GRSTCTL 0x80000400 0x50000010
CSRST 0 [0:0]
HSRST 0 [1:1]
FCRST 0 [2:2]
RXFFLSH 0 [4:4]
TXFFLSH 0 [5:5]
TXFNUM 0x10 [10:6]
AHBIDL 1 [31:31]
FS_GINTSTS 0x35008029 0x50000014
CMOD 1 [0:0]
MMIS 0 [1:1]
OTGINT 0 [2:2]
SOF 1 [3:3]
RXFLVL 0 [4:4]
NPTXFE 1 [5:5]
GINAKEFF 0 [6:6]
GOUTNAKEFF 0 [7:7]
ESUSP 0 [10:10]
USBSUSP 0 [11:11]
USBRST 0 [12:12]
ENUMDNE 0 [13:13]
ISOODRP 0 [14:14]
EOPF 1 [15:15]
IEPINT 0 [18:18]
OEPINT 0 [19:19]
IISOIXFR 0 [20:20]
IPXFR_INCOMPISOOUT 0 [21:21]
HPRTINT 1 [24:24]
HCINT 0 [25:25]
PTXFE 1 [26:26]
CIDSCHG 1 [28:28]
DISCINT 1 [29:29]
SRQINT 0 [30:30]
WKUPINT 0 [31:31]
FS_GINTMSK 0x01000006 0x50000018
MMISM 1 [1:1]
OTGINT 1 [2:2]
SOFM 0 [3:3]
RXFLVLM 0 [4:4]
NPTXFEM 0 [5:5]
GINAKEFFM 0 [6:6]
GONAKEFFM 0 [7:7]
ESUSPM 0 [10:10]
USBSUSPM 0 [11:11]
USBRST 0 [12:12]
ENUMDNEM 0 [13:13]
ISOODRPM 0 [14:14]
EOPFM 0 [15:15]
EPMISM 0 [17:17]
IEPINT 0 [18:18]
OEPINT 0 [19:19]
IISOIXFRM 0 [20:20]
IPXFRM_IISOOXFRM 0 [21:21]
PRTIM 1 [24:24]
HCIM 0 [25:25]
PTXFEM 0 [26:26]
CIDSCHGM 0 [28:28]
DISCINT 0 [29:29]
SRQIM 0 [30:30]
WUIM 0 [31:31]
FS_GRXSTSR_Device 0xb55fddf7 0x5000001c
EPNUM 0x7 [3:0]
BCNT 0x5df [14:4]
DPID 0x3 [16:15]
PKTSTS 0xf [20:17]
FRMNUM 0xa [24:21]
FS_GRXSTSR_Host 0xb55fddf7 0x5000001c
EPNUM 0x7 [3:0]
BCNT 0x5df [14:4]
DPID 0x3 [16:15]
PKTSTS 0xf [20:17]
FRMNUM 0xa [24:21]
FS_GRXFSIZ 0x00000200 0x50000024
RXFD 0x0200 [15:0]
FS_GNPTXFSIZ_Device 0x02000200 0x50000028
TX0FSA 0x0200 [15:0]
TX0FD 0x0200 [31:16]
FS_GNPTXFSIZ_Host 0x02000200 0x50000028
NPTXFSA 0x0200 [15:0]
NPTXFD 0x0200 [31:16]
FS_GNPTXSTS 0x00080200 0x5000002c
NPTXFSAV 0x0200 [15:0]
NPTQXSAV 0x08 [23:16]
NPTXQTOP 0x00 [30:24]
FS_GCCFG 0x0021ffff 0x50000038
PWRDWN 1 [16:16]
VBUSASEN 0 [18:18]
VBUSBSEN 0 [19:19]
SOFOUTEN 0 [20:20]
FS_CID 0x00001200 0x5000003c
PRODUCT_ID 0x00001200 [31:0]
FS_HPTXFSIZ 0x02000400 0x50000100
PTXSA 0x0400 [15:0]
PTXFSIZ 0x0200 [31:16]
FS_DIEPTXF1 0x02000400 0x50000104
INEPTXSA 0x0400 [15:0]
INEPTXFD 0x0200 [31:16]
FS_DIEPTXF2 0x02000400 0x50000108
INEPTXSA 0x0400 [15:0]
INEPTXFD 0x0200 [31:16]
FS_DIEPTXF3 0x02000400 0x5000010c
INEPTXSA 0x0400 [15:0]
INEPTXFD 0x0200 [31:16]
OTG_FS_PWRCLK
FS_PCGCCTL 0x00000000 0x50000e00
STPPCLK 0 [0:0]
GATEHCLK 0 [1:1]
PHYSUSP 0 [4:4]
Solved! Go to Solution.
2024-11-14 12:38 PM
2024-11-14 12:38 PM
Bouncing signal on DP?
JW
2024-11-14 02:40 PM - edited 2024-11-14 03:24 PM
@waclawek.jan Is your recommendation then that we simply ignore this IRQ and clear it out if we're initializing our USB state machine to the unattached state?
EDIT: If we leave the device attached and reset the software, we get PCDET without DISCINT.