Configuring STM3210C-EVAL with the lwip example

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

Moderator: RoccoMarco

pommzorz
Posts: 22
Joined: Wed Jul 10, 2013 10:38 am

Configuring STM3210C-EVAL with the lwip example

Post by pommzorz »

Hi everybody!
Still working my way with ChibiOS and trying to learn its secrets... and now I am willing to activate the IP stack to be able to communicate over ethernet.

However the STM32 example is for a different board ( i use the STM3210C), so I have to adapt a little. I thought I could manage that seeing as I had to modify the board settings to use the CAN bus, but something else stops me.

This is the steps I have done to get that example to work :

    - Activate the MAC driver in halconf.h
    - Edit the makefile to build lwip
    - Change the GPIO in board.h to corresponding ethernet values according to the STM32v1xx ref. manual
    - Add the AFIO_MAPR_ETH_REMAP option to the boardInit function to account for Ethernet Remapping
    - Added #define BOARD_PHY_ID MII_STE101P_ID and #define BOARD_PHY_RMII to board.h

My main just inits the board and creates a blinker thread and sends a debug serial message to the PC without creating the lwip thread and without using any ethernet functions. However the micro just hangs without blinking when i start that code... Would you know why?

The blinker works perfectly fine and the serial print too when I just do not build the lwip files...
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Configuring STM3210C-EVAL with the lwip example

Post by Giovanni »

The steps are correct but I have no idea, try to single step from the main until is stops.

Giovanni
pommzorz
Posts: 22
Joined: Wed Jul 10, 2013 10:38 am

Re: Configuring STM3210C-EVAL with the lwip example

Post by pommzorz »

Hi again!

The problem appears when i activate the MAC driver in the HAL... I am looking into it right now but i am a bit clueless.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Configuring STM3210C-EVAL with the lwip example

Post by Giovanni »

If it stops in the PHY detection loop then you should verify if your I/O settings are correct, this already happened in the past. Try starting your board files from the ones of the Olimext STM32-P107, the settings should be very similar to what you need.

Giovanni
pommzorz
Posts: 22
Joined: Wed Jul 10, 2013 10:38 am

Re: Configuring STM3210C-EVAL with the lwip example

Post by pommzorz »

Well the board files from the stmp107 are quite different... I read them and used them and the ref. manual to get the right pins. I checked again all the GPIO definitions and I still cannot make the HAL work...
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Configuring STM3210C-EVAL with the lwip example

Post by Giovanni »

You should try to give me info about what does not work or where the program execution stops, I can only verify that the lwip demo works on the boards I have...

In general there can be two possible problems:
- I/O settings
- Clock settings, is you PHY clocked?

Giovanni
pommzorz
Posts: 22
Joined: Wed Jul 10, 2013 10:38 am

Re: Configuring STM3210C-EVAL with the lwip example

Post by pommzorz »

Hi! Sorry about asking for help without sufficient info, but I could not debug with eclipse and gdb/openOCD and I did not know why ( i already asked for help about that a few days ago. :) ). Apparently right now the debug gods are happy with me so eclipse and gdb are working.

What you suspected was right : the system is halted after trying to find the PHY ( the chSysHalt() is called in mac_lld line 138). So my settings are not correct. I tried to clock the PHY from the HSE 25MHz osc by putting STM32_MCOSEL to STM32_MCOSEL_HSE, and i double checked the pin settings for mii and remapping, and yet I do not have any answer from the board...

What do you think? I will however check again all my gpio settings, but do you see something I completely missed?

in addition to this, the Eclipse chibios/RT plugin does not show anything during the debug, even after hitting the refresh button... I have Kepler, does it works with that Eclipse version? Is there something else I have to do?

Thanks a lot!
pommzorz
Posts: 22
Joined: Wed Jul 10, 2013 10:38 am

Re: Configuring STM3210C-EVAL with the lwip example

Post by pommzorz »

Ok I sorted out the plugin issue, i was not using the "Standard GDB Hardware Debugging Launcher"... Still I am not able to see threads shown as threads in the debug perspective ( only in the chibi plugin am I able to see that). I suspect it is an issue with openOCD, what do you think about that?

EDIT : I checked, and the result of arm-none-eabi-nm build/ch.elf | grep ch_debug | wc -l is 1 as expected, and the rtos auto option of openOCD is also activated... Still I can only see 1 thread.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Configuring STM3210C-EVAL with the lwip example

Post by Giovanni »

Not sure about that, do you see more than one thread using the plugin?

Giovanni
pommzorz
Posts: 22
Joined: Wed Jul 10, 2013 10:38 am

Re: Configuring STM3210C-EVAL with the lwip example

Post by pommzorz »

Hi!

In the plugin window i am able to have all the infos about the different threads and so, but the debug window of eclipse only shows me one single thread, even after chInit() has been long executed.
Attachments
Eclipse Debug Window
Eclipse Debug Window
DebugEclipse.JPG (145.22 KiB) Viewed 7713 times
Post Reply