[DONE] STM3241G-EVAL Ethernet

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

[DONE] STM3241G-EVAL Ethernet

Post 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
Attachments
board.zip
(8.95 KiB) Downloaded 352 times
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM3241G-EVAL Ethernet

Post 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
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: STM3241G-EVAL Ethernet

Post 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
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: STM3241G-EVAL Ethernet

Post 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 ?
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: STM3241G-EVAL Ethernet

Post 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);
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM3241G-EVAL Ethernet

Post by Giovanni »

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

Re: STM3241G-EVAL Ethernet

Post 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.
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: STM3241G-EVAL Ethernet

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM3241G-EVAL Ethernet

Post by Giovanni »

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

Re: STM3241G-EVAL Ethernet

Post 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);
Post Reply