Page 1 of 2
[DONE] STM3241G-EVAL Ethernet
Posted: Thu Mar 20, 2014 9:33 pm
by Tabulous
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_RMII
At 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
Re: STM3241G-EVAL Ethernet
Posted: Fri Mar 21, 2014 9:17 am
by Giovanni
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
Re: STM3241G-EVAL Ethernet
Posted: Fri Mar 21, 2014 11:00 am
by Tabulous
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
Re: STM3241G-EVAL Ethernet
Posted: Fri Mar 21, 2014 11:37 am
by Tabulous
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 ?
Re: STM3241G-EVAL Ethernet
Posted: Fri Mar 21, 2014 1:03 pm
by Tabulous
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);
Re: STM3241G-EVAL Ethernet
Posted: Fri Mar 21, 2014 1:23 pm
by Giovanni
Hi,
Instead of doing that, could you try to put a delay after "rccEnableETH(FALSE);", you may use halPolledDelay();
Giovanni
Re: STM3241G-EVAL Ethernet
Posted: Fri Mar 21, 2014 6:29 pm
by Tabulous
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.
Re: STM3241G-EVAL Ethernet
Posted: Mon Mar 24, 2014 10:10 am
by Tabulous
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.
Re: STM3241G-EVAL Ethernet
Posted: Mon Mar 24, 2014 1:53 pm
by Giovanni
I decided to remove the reset operation and the loop entirely, see if this works for you.
Giovanni
Re: STM3241G-EVAL Ethernet
Posted: Thu Mar 27, 2014 5:37 pm
by Tabulous
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);