STM32 Ethernet Demo

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
brian360
Posts: 27
Joined: Wed Dec 08, 2010 5:47 pm
Location: Seattle, WA, USA

STM32 Ethernet Demo

Postby brian360 » Tue Jan 11, 2011 5:42 am

I just uploaded an STM32 Ethernet MAC driver with an lwip demo for the STM3210C-EVAL board to svn under branches/stm32_ethernet_test, in case anybody is interested.

Currently the MAC driver is just a wrapper around ST's own Ethernet firmware library. It's all very preliminary, but a simple web server demo seems to work. The MAC driver is based largely on, and the lwip & web server files are identical to, the ARM7-AT91SAM7X-LWIP-GCC demo.

Because of the dependency on st's ethernet library, it also currently requires the st firmware library to be enabled.

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

Re: STM32 Ethernet Demo

Postby Giovanni » Tue Jan 11, 2011 3:20 pm

Thanks Brian, good work.

A wrapper is fine, may be we can think to a native driver after improving the MAC driver model, I wish to implement a copy-less interface and that will require changes also in lwIP or a whole new networking stack.

Giovanni

brian360
Posts: 27
Joined: Wed Dec 08, 2010 5:47 pm
Location: Seattle, WA, USA

Re: STM32 Ethernet Demo

Postby brian360 » Tue Jan 11, 2011 6:06 pm

I agree, the wrapper is simply a starting point because I needed the Ethernet interface for a project that I'm working on. A native driver would certainly be ideal, and better yet a copy-less interface :)

Have you seen this Propox STM32 module with USB & Ethernet? It seems like a good buy at only $49.64 USD.
http://www.propox.com/products/t_264.html?lang=en

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

Re: STM32 Ethernet Demo

Postby Giovanni » Tue Jan 11, 2011 7:37 pm

Not bad, probably I will buy one. There is also this new board from Olimex: http://www.olimex.com/dev/stm32-p107.html

Giovanni

mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Location: Karlsruhe, Germany
Been thanked: 1 time
Contact:

Re: STM32 Ethernet Demo

Postby mabl » Sun Mar 06, 2011 12:20 pm

Has anybody got this ethernet demo running on the Olimex board and the recent 2.2.2 release? I'm trying to get it running since 3 days and I am completely stuck.

What I did so far:
  • Change pin layout to olimex board
  • Try to change everything von MII to RMII
  • Generate a 50MHz clock for the ethernet driver

It seems the mac driver is now working (it detects the ethernet cable, yeah...), but I don't get lwip to work... If there is interest in my current setup I gladly post it.

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

Re: STM32 Ethernet Demo

Postby Giovanni » Sun Mar 06, 2011 2:05 pm

I just received that board but haven't tried it yet, post your code, I'll give it a try next weekend after the 2.3.0 release.

Giovanni

mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Location: Karlsruhe, Germany
Been thanked: 1 time
Contact:

Re: STM32 Ethernet Demo

Postby mabl » Sun Mar 06, 2011 2:45 pm

Hello Giovanni,

thanks for your fast reply! I could not attach the code as it exceeds the allowed 256 KB. I uploaded it on my personal server, I hope it can be useful. Thanks again for your help!

MaBl

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

Re: STM32 Ethernet Demo

Postby Giovanni » Fri Mar 11, 2011 6:16 pm

Hi MaBl,

I finally had the time to unpack the board and give it a try, probably I found the cause.

The STE101P PHY requires a 50MHz clock on the SCLOCK input in order to operate in RMII mode, the line is connected to the MCO pin of the STM32F107 which is supposed to generate the clock.

Problems I found so far:
1) The MCO is not programmed to output a clock in mcuconf.h.
2) In order to generate 50MHz on the MCO pin the PLL3 is required, currently the HAL does not activate the PLL3 at all, you would have to activate it from board.c operating on the RCC registers directly. PLL2 generates 40MHz, PLL1 generates 72MHz so cannot be used for that.

I will add the support for PLL3 in the upcoming version 2.3.1, you may try to activate it manually and then verify you have the 50MHz signal on the MCO pin.

Giovanni

mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Location: Karlsruhe, Germany
Been thanked: 1 time
Contact:

Re: STM32 Ethernet Demo

Postby mabl » Fri Mar 11, 2011 6:30 pm

Hello Giovanni,

thank you for taking the time to look at the board! I think I have generated the required signal on the MCU port, but I put the code in mac_lld_init() :oops:

Code: Select all

   RCC_PLL3Config(RCC_PLL3Mul_10);
   /* Enable PLL3 */
   RCC_PLL3Cmd(ENABLE);
   /* Wait till PLL3 is ready */
   while (RCC_GetFlagStatus(RCC_FLAG_PLL3RDY) == RESET)
   {}

   /* Get clock PLL3 clock on PA8 pin */
   RCC_MCOConfig(RCC_MCO_PLL3CLK);
   palSetPadMode(IOPORT1, 8, PAL_MODE_STM32_ALTERNATE_PUSHPULL);


I thought I also measured the 50MHz at resistor R18...

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

Re: STM32 Ethernet Demo

Postby Giovanni » Fri Mar 11, 2011 6:42 pm

I searched for that in the wrong places it seems...

I'll give it another try tomorrow, if the driver works then it must be something in lwIP or the integration code.

Are you able at least to ping the board? that would give us an hint.

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 21 guests