ChibiOS public support forum for all topics not covered by a specific support forum.
Moderators: RoccoMarco , lbednarz , tfAteba
Tabulous
Posts: 518 Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times
Post
by Tabulous » Thu Mar 20, 2014 9:33 pm
Trying to get ethernet working on my STM3241G-EVAL, the Phy on the board is DP83848. Got the board configure to run with Ext 25Mhz for the Phy, and have set the Board config to the correct BOARD_PHY_ID, and commented out #define BOARD_PHY_RMII as i want to run MII interface.
Code: Select all
/* * Ethernet PHY type. */ #define BOARD_PHY_ID MII_DP83848I_ID //#define BOARD_PHY_RMIIAt the moment the code loops here
Code: Select all
/* MAC clocks activation and commanded reset procedure.*/ rccEnableETH(FALSE); ETH->DMABMR |= ETH_DMABMR_SR; while(ETH->DMABMR & ETH_DMABMR_SR) ;Ive attached the board file, as i think its right but sometimes a new pair of eyes can see faults
Attachments
board.zip
(8.95 KiB) Downloaded 352 times
Giovanni
Site Admin
Posts: 14895 Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times
Post
by Giovanni » Fri Mar 21, 2014 9:17 am
It is most likely an error in the board files, that board is very complex, you have to verify each pin vs the schematic. Giovanni
Tabulous
Posts: 518 Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times
Post
by Tabulous » Fri Mar 21, 2014 11:00 am
Giovanni wrote: It is most likely an error in the board files, that board is very complex, you have to verify each pin vs the schematic. Giovanni
I've been over it so many times, i'm convince i'm missing something.
The mac_lld_init() works ok its when the macStart() is called where it loops
Tabulous
Posts: 518 Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times
Post
by Tabulous » Fri Mar 21, 2014 11:37 am
if I comment out the reset and while loop, everything runs ok and i can hit the web server demo with my browser
Code: Select all
/* MAC clocks activation and commanded reset procedure.*/ rccEnableETH(FALSE); // ETH->DMABMR |= ETH_DMABMR_SR; // while(ETH->DMABMR & ETH_DMABMR_SR) // ;So i guess the question is why does this loop for ? and what is it actually doing ?
Tabulous
Posts: 518 Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times
Post
by Tabulous » Fri Mar 21, 2014 1:03 pm
Hi Giovanni
i believe there is a bug here.
You are calling to reset the MAC, but it is not in power up state, as you dont call power up until after, hence it just loops for ever.
Code: Select all
ETH->DMABMR |= ETH_DMABMR_SR; while(ETH->DMABMR & ETH_DMABMR_SR);what i think you should have, and it works on my STM3241G-EVAL is
Code: Select all
#if STM32_MAC_ETH1_CHANGE_PHY_STATE /* PHY in power up mode.*/ mii_write(macp, MII_BMCR, mii_read(macp, MII_BMCR) & ~BMCR_PDOWN); #endif ETH->DMABMR |= ETH_DMABMR_SR; while(ETH->DMABMR & ETH_DMABMR_SR);
Giovanni
Site Admin
Posts: 14895 Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times
Post
by Giovanni » Fri Mar 21, 2014 1:23 pm
Hi, Instead of doing that, could you try to put a delay after "rccEnableETH(FALSE);", you may use halPolledDelay(); Giovanni
Tabulous
Posts: 518 Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times
Post
by Tabulous » Fri Mar 21, 2014 6:29 pm
Giovanni wrote: Hi, Instead of doing that, could you try to put a delay after "rccEnableETH(FALSE);", you may use halPolledDelay(); Giovanni
Code: Select all
/* MAC clocks activation and commanded reset procedure.*/ rccEnableETH(FALSE); halPolledDelay(1000); ETH->DMABMR |= ETH_DMABMR_SR; while(ETH->DMABMR & ETH_DMABMR_SR);having a delay has no effect, still loops in while loop.
Tabulous
Posts: 518 Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times
Post
by Tabulous » Mon Mar 24, 2014 10:10 am
Tabulous wrote: Giovanni wrote: Hi, Instead of doing that, could you try to put a delay after "rccEnableETH(FALSE);", you may use halPolledDelay(); Giovanni
Code: Select all
/* MAC clocks activation and commanded reset procedure.*/ rccEnableETH(FALSE); halPolledDelay(1000); ETH->DMABMR |= ETH_DMABMR_SR; while(ETH->DMABMR & ETH_DMABMR_SR);having a delay has no effect, still loops in while loop.
As above having a delay has no effect, still loops in while loop.
Giovanni
Site Admin
Posts: 14895 Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times
Post
by Giovanni » Mon Mar 24, 2014 1:53 pm
I decided to remove the reset operation and the loop entirely, see if this works for you. Giovanni
Tabulous
Posts: 518 Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times
Post
by Tabulous » Thu Mar 27, 2014 5:37 pm
Giovanni wrote: I decided to remove the reset operation and the loop entirely, see if this works for you. Giovanni
i can confirm removing this, causes no issues on my board, Ethernet is still running good
Code: Select all
ETH->DMABMR |= ETH_DMABMR_SR; while(ETH->DMABMR & ETH_DMABMR_SR);