Olimex SAM7-EX256 and EtherNUT works!

www.ethernut.de V4.2.1

It’s running like a charme :slight_smile:

The following changes were needed, to get it up and running:

I applied the following patch to EmacReset() in at91_emac.c

/* PHY ID */

#define MII_DM9161_ID_H 0x0181

#define MII_DM9161_ID_L 0xb8a0

#define MII_AM79C875_ID_H 0x0022

#define MII_AM79C875_ID_L 0x5540

#define MII_MICREL_ID_H 0x0022

#define MII_MICREL_ID_L 0x1610

/* For some unknown reason it seems to be required to read the ID

registers first. */

// Check for DM PHY (as used on the ATMEL EK)

if (phy_inw(NIC_PHY_ID1) != MII_DM9161_ID_H ||

(phy_inw(NIC_PHY_ID2) & 0xFFF0) != MII_DM9161_ID_L) {

// Check for MICREL PHY (as used on the Olimex SAM7-EX256)

if (phy_inw(NIC_PHY_ID1) != MII_MICREL_ID_H ||

(phy_inw(NIC_PHY_ID2) & 0xFFF0) != MII_MICREL_ID_L) {

outr(EMAC_NCR, inr(EMAC_NCR) & ~EMAC_MPE);

return -1;

}

}

The Olimex board uses another PHY (MICREL) I just patched enough, to get

it up and running.

Maybe this ID selection should also happen in the configurator, so

developers using a different kind of PHY have a chance to think about it :slight_smile:

And don’t forget to set the right PHY address (31) and the PHY Powerdown bit (18). The PHY on the Olimex board also uses negated Powerdown polarity. So don’t forget to set this either.

Please post your success in this thread.

Best regards

Marc

Great.

I didn’t have the time to look at ethernut and the differences to uip/freertos. I would like to hear about this topic. (Maybee open a new topic “uip/freertos vs. Ethernut”?)

uip is nice for me because I know the Tools. (I used to work for IAR). Unfortunately the compiler is limited to 32k. I have to find a way to move the file system to another project or switch to a cheaper tool or talk to my former boss.

What tools are you using? Is there a good debugger comparable to IAR-C-Spy that connects to J-Link?

Can you connect your board over dyndns.org so we all can play with it?

Regards,

Eduardo

I use Ethernut for years, but until now only on the ATMEGAs.

I also use WinARM (or the very nice counterpart from yagarto + eclipse)

yagarto also has some nice howto’s online, how to get it up and running.

As I dont have J-Link (but the cheap and nice JTAG adapter from Olimex) I

use H-Jtag to use it on the IAR workbench.

Speaking of a good IDE for my GNU tools, I am still getting my feet wet, I try this and that, and I will update some entries here if I found my personal “golden solution” without spending a car worth of money :slight_smile:

BR

Marc

thanks for that. I now have ethernut up and running on my olimex board.

I do have a question though… you mention to set ‘negated powerdown polarity’… where would I set that?

thanks.

at what point in the at91_emac.c do i add:

/* PHY ID */

#define MII_DM9161_ID_H 0x0181

#define MII_DM9161_ID_L 0xb8a0

#define MII_AM79C875_ID_H 0x0022

#define MII_AM79C875_ID_L 0x5540

#define MII_MICREL_ID_H 0x0022

#define MII_MICREL_ID_L 0x1610

/* For some unknown reason it seems to be required to read the ID

registers first. */

// Check for DM PHY (as used on the ATMEL EK)

if (phy_inw(NIC_PHY_ID1) != MII_DM9161_ID_H ||

(phy_inw(NIC_PHY_ID2) & 0xFFF0) != MII_DM9161_ID_L) {

// Check for MICREL PHY (as used on the Olimex SAM7-EX256)

if (phy_inw(NIC_PHY_ID1) != MII_MICREL_ID_H ||

(phy_inw(NIC_PHY_ID2) & 0xFFF0) != MII_MICREL_ID_L) {

outr(EMAC_NCR, inr(EMAC_NCR) & ~EMAC_MPE);

return -1;

}

}

C:/ethernut-4.2.1/nut/arch/arm/dev/at91_emac.c:760: error: previous declaration of ‘EmacRxThread’ was here

what does this mean???

will the leds light with this patch?

is the patch a replacement for a section of lines or an addition?

I am despirate as I am doing this for a university project, and I have 3 weeks left to get a webserver running so that I can send udp reqests to investigate the suitability of ethernet for real time.