I am trying to get FreeRTOS TCP/IP running an a STM32F746 Discovery board and am running into problems.
The receive path seems to work OK but the transmit path does not. I am going drectly from my PC to the device ( host 192.168.1.33 → 192.168.1.125 ). I have also tried going through a switch ( host 192.168.1.33 → 192.168.1.10 → 192.168.1.125 )
One of the first things that happens upon power on of the board is an ARP event, wherin my device attempts to send a broadcast ARP out. The ARP packet appears to be properly formed and the transmit TxDMA descriptors look correct in the xNetworkInterfaceOutput() function. HOWEVER, nothing physically appears the the output of EITHER the MAC or PHY output pins ( verified on OSCOPE and Wireshark ).
Next, If I send a packet from the host to the device, I see that the device correctly receives a request from the host to generate an ARP packet. The ARP packet is properly formed and has the correct host MAC Addr and IP addr, as well as my device MAC Addr and IP address, and other relevant ARP info - at xNetworkInterfaceOutput(). HOWEVER, nothing physically appears at the output of EITHER the MAC or PHY output pins.
Obviously I see no traffic being generated from my device using Wireshark.
I’m looking for ideas on what I am doing wrong.
I have shown below the ARP packets and the status of the DMA and MAC registers during the sending of the packet. I don’t really see anything abnormal.
Network info:
Host IP addr; 192.168.1.33
My device IP addr: 192.168.1.125
Host MAC addr: 90 E2 BA 84 DE 71
My device MAC address: 01 02 03 04 05 06
Here is some startup debug info showing the PHY register settings:
(null-format-string-pointer)prvIPTask started
PHY ID 7C130
xPhyReset: phyBMCR_RESET 0 ready
+TCP: advertise: 01E1 config 1000
prvEthernetUpdateConfig: LS mask 00 Force 1
Autonego ready: 00000004: full duplex 100 mbit high status
reg 0 1100
reg 1 782D
reg 2 0007
reg 3 C131
reg 4 01E1
reg 5 C1E1
reg 6 006F
reg 7 2001
reg 8 4000
reg 9 FFFF
reg 10 FFFF
reg 11 FFFF
reg 12 FFFF
reg 13 0000
reg 14 0000
reg 15 0000
reg 16 0041
reg 17 0002
reg 18 60E0
reg 19 FFFF
reg 20 0000
reg 21 0000
reg 22 0000
reg 23 0000
reg 24 9B9D
reg 25 0000
reg 26 0000
reg 27 000A
reg 28 4000
reg 29 00C8
reg 30 0000
reg 31 1058
Network buffers: 91 lowest 91
Link Status is high
Socket Created
IP Address: 192.168.1.125
Subnet Mask: 255.255.255.0
Network buffers: 90 lowest 90
DNS server IP Address: 208.67.222.222
Binding socket to port 10000
Socket 10000 → 0ip:0 State eCLOSED->eTCP_LISTEN
Network buffers: 89 lowest 89
Device generates an ARPTimerEvent to update its ARPCache:
ARPAgeCache() ->FreeRTOS_OutputARPRequest() → xNetworkInterfaceOutput()
Just prior to /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
pxDMATxDesc 0x20000080: Status 0x70D00000 ( own bit not yet set ). ControlBufferSize 0x00000002A. Buffer1Addr = 0X20002272
Contents of buffer1Addr: FF FF FF FF FF FF 01 02 03 04 05 06 08 06 00 01 08 00 06 04 00 01 01 02 03 04 05 06 C0 A8 01 7D 00 00 00 00 00 00 C0 A8 01 7D FF
This is xETH_HEADER + xARP_HEADER ( see FreeRTOS_IP_Private.h ). Note this shows a broadcast MAC addr FF FF FF FF FF FF as destination, 01 02 03 04 05 06 as source MAC addr, “Frame TYpe”
as 0x0806, Hardware Type as 0x0001, ProtocolType = 0x0800 HardwareaddressLength = 0x06, ProtocolAddressLength = 0x04, Operation = 0x0001, xSenderHardwareAddress = 01 02 03 04 05 06
SenderProtocolAddress = C0 A8 01 7D (This is addr 192.168.1.125 ) TargetHardware Address = 00 00 00 00 00 00 TargetProtocolAddress = C0 A8 01 7D (This is addr 192.168.1.125 )
SET the OWN bit in Status of pxDMATxDesc:
pxDMATxDesc 0x20000080: Status 0xf0d00000
At this point here are various relevant DMA and MAC register values. The only thing that loos possibly strange are that the values of TBUS and TPS in the DMASR ( DMA status register ). These values are
always 1 and 6 respectively, even after the transmit is “finished” ( TBUS = 1 = Transmit Buffer unavailable, and TPS = 6 = Transmit process suspended ). But I believe these are referring to the NEXT
descriptor, not the current Descriptor.:
DMABMR 0x02c12080
SR 0
DA 0
DSL 0x00
EDFE 1
PBL 0x20
RTPR 0x0
FB 1
RDP 0x20
USP 1
FPM 0
AAB 1
MB 0
DMATPDR 0x00000000
TPD 0x00000000
DMARPDR 0x00000000
RPD 0x00000000
DMARDLAR 0x20000000
SRL 0x20000000
DMATDLAR 0x20000080
STL 0x20000080
DMASR 0x00680004
TS 0
TPSS 0
TBUS 1
TJTS 0
ROS 0
TUS 0
RS 0
RBUS 0
RPSS 0
PWTS 0
ETS 0
FBES 0
ERS 0
AIS 0
NIS 0
RPS 0x4
TPS 0x6
EBS 0x0
MMCS 0
PMTS 0
TSTS 0
DMAOMR 0x02202006
SR 1
OSF 1
RTC 0x0
FUGF 0
FEF 0
ST 1
TTC 0x0
FTF 0
TSF 1
DFRF 0
RSF 1
DTCEFD 0
DMAIER 0x000163fb
TIE 1
TPSIE 1
TBUIE 0
TJTIE 1
ROIE 1
TUIE 1
RIE 1
RBUIE 1
RPSIE 1
RWTIE 1
ETIE 0
FBEIE 1
ERIE 1
AISE 0
NISE 1
DMAMFBOCR 0x000008ca
MFC 0x08ca
OMFC 0
MFA 0x000
OFOC 0
DMARSWTR 0x00000000
RSWTC 0x00
DMACHTDR 0x20000080
HTDAP 0x20000080
DMACHRDR 0x20000000
HRDAP 0x20000000
DMACHTBAR 0x00000000
HTBAP 0x00000000
DMACHRBAR 0x20003fea
HRBAP 0x20003fea
Ethernet_MAC
MACCR 0x0000ce0c
RE 1
TE 1
DC 0
BL 0x0
APCS 0
RD 1
IPCO 1
DM 1
LM 0
ROD 0
FES 1
CSD 0
IFG 0x0
JD 0
WD 0
CSTF 0
MACFFR 0x00000040
PM 0
HU 0
HM 0
DAIF 0
RAM 0
BFD 0
PCF 1
SAIF 0
SAF 0
HPF 0
RA 0
MACHTHR 0x00000000
HTH 0x00000000
MACHTLR 0x00000000
HTL 0x00000000
MACMIIAR 0x000007d0
MB 0
MW 0
CR 0x4
MR 0x1f
PA 0x00
MACMIIDR 0x00001058
TD 0x1058
MACFCR 0x00000080
FCB 0
TFCE 0
RFCE 0
UPFD 0
PLT 0x0
ZQPD 1
PT 0x0000
MACVLANTR 0x00000000
VLANTI 0x0000
VLANTC 0
MACPMTCSR 0x00000000
PD 0
MPE 0
WFE 0
MPR 0
WFR 0
GU 0
WFFRPR 0
MACDBGR 0x00000000
CR 0
CSR 0
ROR 0
MCF 0
MCP 0
MCFHP 0
MACSR 0x00000000
PMTS 0
MMCS 0
MMCRS 0
MMCTS 0
TSTS 0
MACIMR 0x00000000
PMTIM 0
TSTIM 0
MACA0HR 0x80000605
MACA0H 0x0605
MO 1
MACA0LR 0x04030201
MACA0L 0x04030201
MACA1HR 0x0000ffff
MACA1H 0xffff
MBC 0x00
SA 0
AE 0
MACA1LR 0xffffffff
MACA1LR 0xffffffff
MACA2HR 0x0000ffff
MAC2AH 0xffff
MBC 0x00
SA 0
AE 0
MACA2LR 0xffffffff
MACA2L 0x7fffffff
MACA3HR 0x0000ffff
MACA3H 0xffff
MBC 0x00
SA 0
AE 0
MACA3LR 0xffffffff
MBCA3L 0xffffffff
MACRWUFFER 0x00000000
Then After resume DMA transmission (after iptraceNETWORK_INTERFACE_TRANSMIT() and setting xReturn to pdPASS: )
Ethernet_DMA
DMABMR 0x02c12080
SR 0
DA 0
DSL 0x00
EDFE 1
PBL 0x20
RTPR 0x0
FB 1
RDP 0x20
USP 1
FPM 0
AAB 1
MB 0
DMATPDR 0x00000000
TPD 0x00000000
DMARPDR 0x00000000
RPD 0x00000000
DMARDLAR 0x20000000
SRL 0x20000000
DMATDLAR 0x20000080
STL 0x20000080
DMASR 0x00690405
TS 1
TPSS 0
TBUS 1
TJTS 0
ROS 0
TUS 0
RS 0
RBUS 0
RPSS 0
PWTS 0
ETS 1
FBES 0
ERS 0
AIS 0
NIS 1
RPS 0x4
TPS 0x6
EBS 0x0
MMCS 0
PMTS 0
TSTS 0
DMAOMR 0x02202006
SR 1
OSF 1
RTC 0x0
FUGF 0
FEF 0
ST 1
TTC 0x0
FTF 0
TSF 1
DFRF 0
RSF 1
DTCEFD 0
DMAIER 0x000163fb
TIE 1
TPSIE 1
TBUIE 0
TJTIE 1
ROIE 1
TUIE 1
RIE 1
RBUIE 1
RPSIE 1
RWTIE 1
ETIE 0
FBEIE 1
ERIE 1
AISE 0
NISE 1
DMAMFBOCR 0x00000034
MFC 0x0034
OMFC 0
MFA 0x000
OFOC 0
DMARSWTR 0x00000000
RSWTC 0x00
DMACHTDR 0x200000a0
HTDAP 0x200000a0
DMACHRDR 0x20000000
HRDAP 0x20000000
DMACHTBAR 0x00000000
HTBAP 0x00000000
DMACHRBAR 0x200059ca
HRBAP 0x200059ca
Ethernet_MAC
MACCR 0x0000ce0c
RE 1
TE 1
DC 0
BL 0x0
APCS 0
RD 1
IPCO 1
DM 1
LM 0
ROD 0
FES 1
CSD 0
IFG 0x0
JD 0
WD 0
CSTF 0
MACFFR 0x00000040
PM 0
HU 0
HM 0
DAIF 0
RAM 0
BFD 0
PCF 1
SAIF 0
SAF 0
HPF 0
RA 0
MACHTHR 0x00000000
HTH 0x00000000
MACHTLR 0x00000000
HTL 0x00000000
MACMIIAR 0x000007d0
MB 0
MW 0
CR 0x4
MR 0x1f
PA 0x00
MACMIIDR 0x00001058
TD 0x1058
MACFCR 0x00000080
FCB 0
TFCE 0
RFCE 0
UPFD 0
PLT 0x0
ZQPD 1
PT 0x0000
MACVLANTR 0x00000000
VLANTI 0x0000
VLANTC 0
MACPMTCSR 0x00000000
PD 0
MPE 0
WFE 0
MPR 0
WFR 0
GU 0
WFFRPR 0
MACDBGR 0x00000000
CR 0
CSR 0
ROR 0
MCF 0
MCP 0
MCFHP 0
MACSR 0x00000000
PMTS 0
MMCS 0
MMCRS 0
MMCTS 0
TSTS 0
MACIMR 0x00000000
PMTIM 0
TSTIM 0
MACA0HR 0x80000605
MACA0H 0x0605
MO 1
MACA0LR 0x04030201
MACA0L 0x04030201
MACA1HR 0x0000ffff
MACA1H 0xffff
MBC 0x00
SA 0
AE 0
MACA1LR 0xffffffff
MACA1LR 0xffffffff
MACA2HR 0x0000ffff
MAC2AH 0xffff
MBC 0x00
SA 0
AE 0
MACA2LR 0xffffffff
MACA2L 0x7fffffff
MACA3HR 0x0000ffff
MACA3H 0xffff
MBC 0x00
SA 0
AE 0
MACA3LR 0xffffffff
MBCA3L 0xffffffff
MACRWUFFER 0x00000000