I am a new FreeRTOS user so please bear with me.
Platform: Xilinx Zynq-7000 SoC on a Cora-Z7 development-kit.
OS: FreeRTOS 10+ port for Xilinx
I am trying to get a simple echo client example to run on my platform. I want to use the DHCP server that I have set up on my PC to provide the IP address for the client. My problem is that I am not seeing a single discovery packet from the Zynq in Wireshark. I have the DHCP flag set to 1 in the IPConfig file.
I know that my DHCP server is set correctly because the moment I connect my RaspberryPi to my PC via Ethernet, I see the entire DHCP handshake process take place in Wireshark.
For hours I have tried to figure out what I am doing wrong but to no avail, unfortunately. Can somebody please guide me as to what I should be doing differently?
Here is a link to my source code: https://gitlab.com/siddhantmodi/freertos-tcp-plus-test/-/tree/master/src
I believe everything pertaining to this task is in that repo.
Thank you for your help,
Does the network event hook get called to say the network is up?
If you configure the system to use a static IP address by setting configUSE_DHCP to 0, and ensuring you use a static IP address that is on the same subnet and the source of the ping, can you ping the Zynq target? You will need to have ipconfigREPLY_TO_INCOMING_PINGS set to 1.
Thanks for your response.
vApplicationIPNetworkEventHook function gets triggered and I see the
eNetworkUp event. I tried setting
configUSE_DHCP to 0 and
ipconfigREPLY_TO_INCOMING_PINGS to 1 but I still didn’t get a response when I pinged the IP. The static IP I am using for the board is 192.168.1.75 and my laptop is at 192.168.1.100. When I hook up the Pi, I am able to ping it from my laptop.
This makes me believe I am doing something else wrong but I’m at a loss…
Sid, I will first try out your files in an existing Zynq 7000 project, and report back here.
Thanks for your help, I am looking forward to hearing from you.
In the meantime, here is some more info that may help:
- My code is successfully entering the
detect_phy function in the
x_emacpsif_physpeed file and is printing
XEmacPs detect_phy: C9150010 at address 0 and then
link speed: 100.
- At the end of the
xNetworkInterfaceInitialise function in
NetworkInterface.c, the variable
xLinkStatus has a value of
FreeRTOS_connect is never returning 0 for me.
I hope this information is useful.
Sid, what I did is link my project with your +TCP sources and
FreeRTOSIPConfig.h file. That all worked fine.
I tried both
ipconfigNIC_LINKSPEED_AUTODETECT. With the latter you may get a 1 Gbps connection.
Can you put a break in NetworkInterface.c and check if packets are received?
And if you look on Wireshark, do you see gratuitous ARP requests coming from you board?
PS the stack you assigned to the IP-task is small. I use these defines in my Zynq project:
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 )
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
I put a breakpoint on lines 411 and 431 in NetworkInterface.c and the breakpoints did not trigger. I also did not see a gratuitous ARP request coming from the board. I can not see any packed that has the IP or MAC address of the board in Wireshark. I have attached a screenshot of all the activity that I saw on Wireshark after I ran the program on the board.
I have a feeling that the board is not communicating via Ethernet with my laptop at all. But since the code is entering the
function with the
event, I am very confused. Could it be that there is a problem with my hardware project? If you are using the same board as me, I could share my HW project .xsa file with you.
Regarding the stack, I have been using the exact same size as you. My #define values match yours.
Thank you for your help,
Can you please share your FreeRTOSIPConfig.h file with me? I do not have a good starting point and I think that is where I might be going wrong…
After trying a whole bunch of things in FW, I did some debugging and put breakpoints in the Eth receive interrupts at the driver level and realised there was no activity going on at all. This, combined with the fact that my code worked with your project made me believe that the problem was with my HW configuration. I am not an FPGA engineer so I don’t quite understand what I am doing but I went back to Vivado and reconfigured the Zynq HW and everything seems to work now!
A different problem now is that the code crashes when I used bufferAllocation_2 but works fine with bufferAllocation_1. I checked and know that my FreeRTOS instance is using heap_4. Do you know what could be causing that?
Good to hear. I don’t know much about FPGA programming neither.
It is not recommended to use
bufferAllocation_2 for this zero-copy driver.
pvPortMalloc() will be called and that will be cached memory.
Using heap_4 or heap_5 ( they are essentially the same ) is perfect.