I am trying to get the FreeRTOS TCP/IP stack going on a STM32F745 with a LAN874A phy on a custom board. I’m using the latest network interface drivers at:
I’m going from my PC (192.168.1.33) through a switch (192.168.1.10) to the device (192.168.1.125).
Everything seems to come up OK to a point:
prvIPTask started
PHY ID 7C130
xPhyReset: phyBMCR_RESET 0 ready
+TCP: advertise: 01E1 config 1000
prvEthernetUpdateConfig: LS mask 00 Force 1
and I am getting gratuitous ARPs being sent out every 20 seconds as seen via wireshark. I see that the transmit interrupt does get called when the ARP gets sent out, so interrupts running.
Now, when I try to ping the device from the PC I get no response. There is output from the PHY visible on the oscilloscope at the RXD0/RXD1 inputs to the STM32. I verified that the GPIO pins are setup correctly for the part for ethernet ( alternate function 11 ) and that the hardware is correct. I NEVER see a receive interrupt. It is enabled. Also, the MAC filter is set to receive broadcast messages.
I’m looking for ideas on what I could be missing here…I have run out of them !
Errm… yes. I’ve reread your post and noticed the missing ETH RX interrupt
And that you checked the MAC (filter) setup. RX DMA is surely also armed properly.
Did you just try a TCP connection or sending UDP packets to the device ?
This might start with an ARP request to the device which should then ARP reply.
I think the provided drivers are pretty good and working but as far as I know they rely on HAL. Maybe post the (cube) version you’re using.
I don’t use cube/HAL and can’t really help with it, unfortunately.
Thanks Hartmut. Right now I’m just trying a TCP connection.
Binding socket to port 10000
Socket 10000 -> 0ip:0 State eCLOSED->eTCP_LISTEN
Heap: current 1128 lowest 1128
Network buffers: 96 lowest 95
Although I don’t think it has anything to do with my present problem ( no DMA receive interrupts ), I’m wondering about the “heap” memory. is 1128 enough ?
Then there is not much left to dynamically create FreeRTOS resources (tasks, queues, etc) in case you need that (later).
Enabling/defining configUSE_MALLOC_FAILED_HOOK will easily show you if you run out of heap.
1128 bytes left sounds very minimal. I also suspect that your pvPortMalloc is failing. Like Hartmut said, have you enabled configUSE_MALLOC_FAILED_HOOK and defined vApplicationMallocFailedHook()?
It is possible to run the FreeRTOS+TCP stack on a CPU with 64 KB of RAM, but you will have to configure it to get a small RAM footprint. Like you might want to disable the use of TCP sliding windows (#define ipconfigUSE_TCP_WIN 0).
By the way, the official repo of FreeRTOS+TCP is here:
That is where the pull requests are being done, and also a lot of testing.
If it helps, here you find a STM32F7 project that works fine. You may want to compare the initialisation in main.c.
Thanks for all the information Hein. I have plenty of SRAM available, so I increased configTOTAL_HEAP_SIZE to 200K, and added the vApplicationMallocFailedHook() and enabled configUSE_MALLOC_FAILED_HOOK.
Thanks for the code link. I will study that and see what I can learn.
It almost seems like the MAC is not transferring the received frames to the memory locations pointed to by the DMA descriptors. An examination of those memory locations show that nothing is being written there. The descriptors themselves are located in the DTCM RAM space.
I tried playing with the configurable threshold value but that did not affect anything.
OK still no luck getting this to work. I’ve tried a number of different things…including disabling auto negotiation and just using fixed values of duplex mode and speed., physically swapping RXD0/RXD1 ( a long shot but I saw someone had that issue ), and varying configurable receive DMA FIFO threshold.
I have studied the code referenced above at
and examined the initialization. It looks basically the same as my initialization ( not surprising, since we are both using the same network interface driver ), except for the board specific items ( like ethernet pin numbers - which I have verified to be correct multiple times ). MAC and DMA configuration and interrupt registers appear to all be set correctly when I debug the running code. But the DMA buffers remain empty, and a receive interrupt never happens.
One difference between the aforementioned code and mine is that I am using FreeRTOS_TCP version 2.3, and the other is 2.2.2. But I don’t see how that could be the problem. The network interface code is the same though.
except for the board specific items ( like ethernet pin numbers -
which I have verified to be correct multiple times )
Does you board have a MII or a RMII? Unless you define ipconfigUSE_RMII, for a STM32F7xx it will be assumed that you have a Reduced Media-Independent Interface: