Use of the Ethernet interface in FreeRTOS running on the Cortex-M4, parallel to Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use of the Ethernet interface in FreeRTOS running on the Cortex-M4, parallel to Linux

1,291 Views
andreas_vorderl
Contributor I

Hi,

I'm trying to use the second ethernet interface (fec2) on the Cortex-M4 core with FreeRTOS , while Linux is running in parallel. Using the second ethernet interface from FreeRTOS works fine, but when I start Linux in parallel, both OS hang after a while.

I changed the device tree so that fec1 and fec2 are disabled!
But it does not work. 

Can you give me a hint about what needs to be set that I can use the second ethernet interface (fec2) in FreeRTOS that runns on the Cortex-M4 core while Linux is running in parallel?


Thanks in advance.

 

Best regards,
Andreas

Labels (2)
0 Kudos
Reply
4 Replies

1,272 Views
andreas_vorderl
Contributor I

Thanks for the quick response. But I think it is not the same issue, because Linux does not hang during the boot process. It hangs approximately  some seconds after the "Welcome" message of Linux (Debian Buster). I have also tried to start the Cortex-M4 directly from Linux. I got the same result. After some seconds nothing works anymore.

Do you know if Linux loads some device drivers after the boot process that can cause this conflict?
The two fec interfaces are definitly not recogized during boot. There is no corresponding message in the console.

I have also tried to use a kernel with excluded "Ethernet driver spport" but this setting does not change anything.

What I can say is that configuring the clocks for the fec device in Cortex-M4 does not cause the failure, because FreeRTOS and Linux hang after those configuration at an other position in my code (does not matter if starting Cortex-M4 from U-Boot or Linux). It seems sending some TCP/IP pakets leads to this behaviour. As mentioned earlier, the code works fine without starting Linux.

It would be great if you could give me a hint of what else could possibly be tried.


Best regards,
Andreas

0 Kudos
Reply

1,264 Views
igorpadykov
NXP Employee
NXP Employee

Hi Andreas

 

unfortunately debian is not supported by NXP for i.MX7D. Suggest to try NXP official linux releases

from source.codeaurora.org/external/imx/linux-imx repository
https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_5.4.70_2.3.0

https://www.nxp.com/design/software/embedded-software/i-mx-software/embedded-linux-for-i-mx-applicat...

 

In general one can try to debug it and find place is code where hanging happens, use

AN4553 Using Open Source Debugging Tools for Linux on i.MX Processors
https://www.nxp.com/docs/en/application-note/AN4553.pdf

In particular check if ENET RX/TX data buffers could overwrite memory regions used by linux

and check RDC permissions for both ENETs.

 

Best regards
igor

0 Kudos
Reply

1,255 Views
andreas_vorderl
Contributor I

Hi Igor,

thanks a lot. I found the problem that is causing both OS's to hang. It was the RDC permission, like you said.

Due to the fact that fec1 and fec2 share the MDIO bus for configuring the PHYs, I set the RDC for both interfaces as follows:

Line1: RDC_SetPdapAccess(RDC, BOARD_ENET1_RDC_PDAP, 0xFFfalse, true);
Line2: RDC_SetPdapAccess(RDCBOARD_ENET2_RDC_PDAP0xFFfalsetrue);

If FreeRTOS takes usage of the fec2 the OS will hang. Due to the fact that I need fec1 (ENET1) to setup the PHY for fec2 I can not remove the configuration from "Line1".

Do you know how I can adapt the Linux kernel, so that I'm able to access fec1 also from FreeRTOS?


Best regards,
Andreas
Tags (1)
0 Kudos
Reply

1,283 Views
igorpadykov
NXP Employee
NXP Employee

Hi Andreas

 

one can look at similar issue on

https://community.nxp.com/t5/i-MX-Processors/GPT-capture-sample-on-M4-seems-to-hang-on-Linux-boot/m-...

 

Best regards
igor

0 Kudos
Reply