Suggestion for FreeRTOS+TCP Zynq port driver enhancement

pete-bone wrote on Thursday, May 16, 2019:

Hi all,

I am working with the latest version of FreeRTOS+TCP on a Zynq based hardware platform and I have been investigating why I have some unresponsiveness at start-up on my system.

I have tracked the issue down to the loop which waits for the PHY Autonegotiation to complete, this code appears to run at the highest priority and calls the Xilinx sleep() function which runs in a tight loop reading the system hardware timer causing the scheduler to stall while this ‘sleep’ takes place…

To eliminate the issue in my own setup I have replaced line 341 of the file:
portable/NetworkInterface/Zynq/x_emacpsif_physpeed.c

It previously read:
sleep(1);

My version is:
if( xTaskGetSchedulerState() != taskSCHEDULER_RUNNING ) sleep(1); else vTaskDelay( 10 );

This as you know allows the other lower priority tasks to run if they are ‘Ready’ and the task scheduler is active.

I thought you may like to include this modification in the next release?

Kind Regards,

Pete

heinbali01 wrote on Thursday, May 16, 2019:

Hi Pete, we were already aware of the blocking Xilinx sleep, and I had already replaced it with vTaskDelay().

I did not test the scheduler state, because FreeRTOS+FAT assumes that it becomes only active when the scheduler is running. There are too many dependencies on the scheduler.

I’m attaching my latest copy of the Zynq driver.

pete-bone wrote on Thursday, May 16, 2019:

Hi Hein,

If you are aware of the issue that is fine, thank you for the latest Zynq code, I have added this latest version to my project and all seems well.

Kind Regards,

Pete