Page 1 of 1

STM32F407 Discovery + Ethernet PHY Example?

Posted: Wed Oct 18, 2017 10:03 am
by Dubbie
Hi,

I have made an Ethernet PHY board based on the LAN8720A chip.
I have spent a long time searching but I can't find any example code yet to test it with ChibiOS.

My goal is to get a simple webserver working.

Obviously I will have to set the right pins somehow for the RMII interface, but I am a little stuck with where to go next.
I have got the basic blinky demo running on the board.

This is my first project with ChibiOS so I am a little green. Any advice will be gratefully received.

Thanks,

R

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Wed Oct 18, 2017 10:12 am
by steved
Look at the Olimex E407 demo - you'll need to match some of the clock settings in mcuconf.h to the Discovery.

Or the demos for any of the 32F4xx nucleo/discovery boards which have Ethernet (e.g. Nucleo144-F429)

Might even be easier to swap your Discovery for one of these boards.

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Wed Oct 18, 2017 10:40 am
by Dubbie
Thanks Steved. Will try that.

I do want to get my own breakout board working because it will become part of a larger custom board once I get it all working. I just wanted to attack the Ethernet stuff alone with a known good mcu.

R

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Thu Oct 19, 2017 9:54 am
by Dubbie
Hi,

So just a small update.
I fiddled around a bit with the Olimax project.
I mainly changed the clock settings to run from the 8Mhz HSE clock with a SYSCLK at 168Mhz.

It built fine and I flashed it onto the board.

it seems to crap out during the macInit() and I'm not 100% sure if there is something else I need to configure, or if I have a hardware fault.

My phy is connected to the appropriate pins and I am generating a good quality 50mhz clock on it that comes to the STM discovery board.

It kinda looks to me like something is going wrong determining the PHY address. I have tried with and without a pullup on the XER/PHYAD0 pin.
The PHY address register contains 0x1E. so i guess it tried all the adresses with no success.

if there is nothing software/wise that I have obviously missed, that anyone here can see, I will break out the scope and check everything electrically.
Tomorrow I will order a known good PHY board as well :D

MAC Failure.PNG


Thanks.

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Thu Oct 19, 2017 10:32 am
by Giovanni
Hi,

Have you created board files for your board? the MAC driver can hang if ethernet-related pins are not properly initialized.

You need to define a function for all pins in your board. The pins you are using could also have conflicts with on-board devices, verify on the schematic.

Giovanni

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Thu Oct 19, 2017 11:01 am
by Dubbie
I just used the Olimax board file because I figure it is pretty much the same and I don’t care about any of the other pins functions at this stage. I just manually edited the clock setup and the voltage.

If you think it’s better, I will generate new board files.

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Thu Oct 19, 2017 11:05 am
by Giovanni
You need to program the Ethernet pins to the appropriate alternate mode, make sure there are no conflicts and take care that the PHY receives the correct clock.

Giovanni

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Thu Oct 19, 2017 11:07 am
by Dubbie
Thanks very much for the hand holding.
I will try tomorrow and report how I get on.

Re: STM32F407 Discovery + Ethernet PHY Example?

Posted: Wed Nov 08, 2017 3:02 am
by Dubbie
I got this all working now.

Thanks for the assistance.