What are the steps to bring up Ethernet phy for MQX?

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

What are the steps to bring up Ethernet phy for MQX?

Jump to solution
3,459 Views
MehmetAliIpin
Contributor V

Dear all,

I have a prototype of VF3x, which has KSZ8081 RMII Ethernet PHY chip. I need the PHY chip to be initialized to start and answer PING commands.

KSZ8081 is generating 50 MHz clock; it is generating all voltage values.

I saw there is KSZ8041 files in ../mqx/source/io/enet/phy/ directory, but  I newer done such a bare metal Ethernet project with MQX before ,

I need guidance for the sequence of initialization/modification of function names, header files, definitions etc, for the clock generation, multiplexing port pins, sending commands to PHY chip and receiving its responses with MII interface, from a simple MQX project(like hello) with DS-5.

Please help me.

Mehmet Ali Ipin

Labels (6)
1 Solution
1,720 Views
timesyssupport
Senior Contributor II

Hi Mehmet,

Thanks for the info. Does your BSP project in DS-5 have the KSZ8041 sources under 'Peripheral_IO_Drivers > enet > phy'? If not, you will need to follow steps 1-4 that I outlined above. This will place the KSZ8041 sources under 'Peripheral_IO_Drivers > enet > phy'. Once the drivers are in this directory, you can follow the rest of the advice:

If the driver is close enough to what would be required for the 8081, you can modify the definitions in the phy_ksz8041.h header to match the 8081. You will also want to init the driver in 'BSP_Files > init_enet.c' under your BSP project. You should now be able to rebuild the BSP project.

Thanks,

Timesys Support

View solution in original post

0 Kudos
Reply
13 Replies
1,720 Views
timesyssupport
Senior Contributor II

Hi Mehmet,

First, if this driver is not already in your BSP project, you can import it. With the Vybrid Tower BSP project, this process would be:

  1. In Project Explorer in DS-5, right click 'bsp_twrvf65gs10_m4 > Peripheral_IO_Drivers > enet > phy', and select 'Import...'.
  2. Choose General > Filesystem. Click Next.
  3. For 'From directory', select: <mqx install dir>/mqx/source/io/enet/phy. Check 'phy_ksz8041.c' and 'phy_ksz8041.h' on the right pane.
  4. Click the 'Advanced' button, and check 'Create links in Workspace', 'Create Virtual Folders', and 'Create link locations relative to: MQX_ROOT_DIR'. Click Finish.

Now, a link to the driver should be located in the 'Peripheral_IO_Drivers > enet > phy' directory under your BSP project. If the driver is close enough to what would be required for the 8081, you can modify the definitions in the phy_ksz8041.h header to match the 8081. You will also want to init the driver in 'BSP_Files > init_enet.c' under your BSP project. You should now be able to rebuild the BSP project.

If you are looking for more detailed usage of the driver, the Freescale MQX design team may be able to help.

Thanks,

Timesys Support

0 Kudos
Reply
1,720 Views
MehmetAliIpin
Contributor V

Dear Timesys,

I am using VF3x (ARM Cortex A5). I could not found any subdirectory under  "mqx/build/ds-5/bsp_twrvf65gs10_m4, and  not found any project

under "mqx/build/ds-5/bsp_twrvf65gs10_a5/Peripheral_IO_Drivers/enet/phy" directory.

Therefore I could not import a project relevant to PHY.

Is my search directory "mqx/build/ds-5/bsp_twrvf65gs10_a5" correct?

Best regards

0 Kudos
Reply
1,720 Views
timesyssupport
Senior Contributor II

Hi Mehmet,

By default, there are no subdirectories in the mqx/build/ds-5/bsp_twrvf65gs10_* directories. These directories just contain .project and .cproject files - which let Eclipse know which source files to link in to the project.

If you have an issue with the steps 1-4 outlined above, please let me know which step you are not able to complete, and any details associated with it.

Thanks,

Timesys Support

0 Kudos
Reply
1,720 Views
MehmetAliIpin
Contributor V

Hi,

The first step. What is a BSP project? is it different from mqx sample projects?

Normally I am copying PHY directory into my (i.e) hello project in DS-5, and building it.

Thanks and best regards

0 Kudos
Reply
1,720 Views
timesyssupport
Senior Contributor II

Hi Mehmet,

In order to build an MQX application, you should have a BSP and PSP project imported and built in DS-5, as shown in step 3 under Building MQX:

Vybrid MCC User Guide For MCC Version 1.0 | Timesys Embedded Linux

This is the BSP project I am referring to. Do you have such a project imported in DS-5?

Thanks,

Timesys Support

0 Kudos
Reply
1,720 Views
MehmetAliIpin
Contributor V

Hi,

Yes, I have already BSP/PSP built project in my DS-5 workspace.

For example, I have a (gpio_twrvf65gs10_a5) project which sends printf("..") messages to the UART1;

For another project, I have a working a graphical LCD interface to SPI1, I2C2 interface to a real time clock, a slave SPI interface to an external master, etc

I would like to add ethernet interface to my gpio_twrvf65gs10_a5 project. So please tell me the first step to handle this interface.

Thanks, and with my best regards.

Mehmet Ali Ipin

0 Kudos
Reply
1,720 Views
naoumgitnik
Senior Contributor V

Dear Mehmet,

You have to be cautious about the Reference clock direction (to or from the processor) and configure the PHY and the processor accordingly. If from the processor, then reviewing the https://community.freescale.com/message/377425  thread is a must!

(BTW, if after you are done reading it you decide to use trapezoidal waveforms , please, also consider having external capacitors on the board (for the 2 TXD lines) to not depend only on the parasitic capacitance of the PHY inputs and the board stray capacitance.)

Regards, Naoum Gitnik.

1,720 Views
MehmetAliIpin
Contributor V

Dear Naoum,

Thank you for your cauiton. I looked at the 377425 thread. I have an external 25 MHz crystal, and KSZ8081 is generating 50 MHz RMII clock from crystal ( I measured the 50 MHz clock coming from the KS8081 clock output pin). I guess there will not be a problem with external clock.

Thanks and best regards.

Mehmet Ali Ipin

0 Kudos
Reply
1,720 Views
naoumgitnik
Senior Contributor V

There will be no problem in your case, Mehmet.

/Naoum.

0 Kudos
Reply
1,719 Views
MehmetAliIpin
Contributor V

Dear Naoum,

Thanks and best wishes.

0 Kudos
Reply
1,721 Views
timesyssupport
Senior Contributor II

Hi Mehmet,

Thanks for the info. Does your BSP project in DS-5 have the KSZ8041 sources under 'Peripheral_IO_Drivers > enet > phy'? If not, you will need to follow steps 1-4 that I outlined above. This will place the KSZ8041 sources under 'Peripheral_IO_Drivers > enet > phy'. Once the drivers are in this directory, you can follow the rest of the advice:

If the driver is close enough to what would be required for the 8081, you can modify the definitions in the phy_ksz8041.h header to match the 8081. You will also want to init the driver in 'BSP_Files > init_enet.c' under your BSP project. You should now be able to rebuild the BSP project.

Thanks,

Timesys Support

0 Kudos
Reply
1,719 Views
MehmetAliIpin
Contributor V

Dear Timesys,

Thank you for your information. There were not K8041 .c and .h files in "Peripheral_IO_Drivers/enet/phy directories. Then I executed your 4 steps into my BSP project, then re-built it, without error.

Thank you very much.

0 Kudos
Reply
1,719 Views
naoumgitnik
Senior Contributor V

Dear timesyssupport,

What might you provide such general recommendations for Mehmet, please?

Regards, Naoum Gitnik.