STM32F407 Discovery + Ethernet PHY Example?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

Dubbie
Posts: 6
Joined: Wed Oct 18, 2017 9:57 am
Has thanked: 1 time
Been thanked: 1 time

STM32F407 Discovery + Ethernet PHY Example?

Postby Dubbie » Wed Oct 18, 2017 10:03 am

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

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby steved » Wed Oct 18, 2017 10:12 am

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.

Dubbie
Posts: 6
Joined: Wed Oct 18, 2017 9:57 am
Has thanked: 1 time
Been thanked: 1 time

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby Dubbie » Wed Oct 18, 2017 10:40 am

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

Dubbie
Posts: 6
Joined: Wed Oct 18, 2017 9:57 am
Has thanked: 1 time
Been thanked: 1 time

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby Dubbie » Thu Oct 19, 2017 9:54 am

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.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby Giovanni » Thu Oct 19, 2017 10:32 am

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

Dubbie
Posts: 6
Joined: Wed Oct 18, 2017 9:57 am
Has thanked: 1 time
Been thanked: 1 time

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby Dubbie » Thu Oct 19, 2017 11:01 am

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.
Last edited by Dubbie on Thu Oct 19, 2017 11:05 am, edited 1 time in total.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby Giovanni » Thu Oct 19, 2017 11:05 am

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

Dubbie
Posts: 6
Joined: Wed Oct 18, 2017 9:57 am
Has thanked: 1 time
Been thanked: 1 time

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby Dubbie » Thu Oct 19, 2017 11:07 am

Thanks very much for the hand holding.
I will try tomorrow and report how I get on.

Dubbie
Posts: 6
Joined: Wed Oct 18, 2017 9:57 am
Has thanked: 1 time
Been thanked: 1 time

Re: STM32F407 Discovery + Ethernet PHY Example?

Postby Dubbie » Wed Nov 08, 2017 3:02 am

I got this all working now.

Thanks for the assistance.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 47 guests