olimex LPC-E2294 with ethernet

Started by Gus February 7, 2005

Hello,

I spent all weekend trying to get the ethernet to work on olimex LPC-
E2294 board http://www.olimex.com/dev/lpc-e2294.html with no luck

Looking at the board schematics, they have the Ethernet
chip "selected" all the time through R57!!! This is WRONG!! I don't
understand why!!! So I removed R57 and installed R56 instead. Now,
when I read the chip, I always get the "chip ID" no matter what
register I select!

Was anyone able to read the registers from CS8900A? Any hints? Even
with thier test code, I wasn't able to get things going. The plan is
to get uIP going on that board http://www.sics.se/~adam/uip/

Thanks,

Gus



Re: olimex LPC-E2294 with ethernet

An Engineer's Guide to the LPC2100 Series

Gus,

I ported uIP to the E2124 and it works on that part, but that's in
polled mode. I don't have a port of uIP for that board as I don't have
the board.

If you have any success with it, please let me know--I'd be interested
to see what you make of the board as it's way over specified to run uIP,
better would be lwIP.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

> -----Original Message-----
> From: Gus [mailto:]
> Sent: 07 February 2005 15:39
> To:
> Subject: [lpc2000] olimex LPC-E2294 with ethernet >
> Hello,
>
> I spent all weekend trying to get the ethernet to work on olimex LPC-
> E2294 board http://www.olimex.com/dev/lpc-e2294.html with no luck
>
> Looking at the board schematics, they have the Ethernet chip
> "selected" all the time through R57!!! This is WRONG!! I
> don't understand why!!! So I removed R57 and installed R56
> instead. Now, when I read the chip, I always get the "chip
> ID" no matter what register I select!
>
> Was anyone able to read the registers from CS8900A? Any
> hints? Even with thier test code, I wasn't able to get things
> going. The plan is to get uIP going on that board
> http://www.sics.se/~adam/uip/
>
> Thanks,
>
> Gus >
>
> Yahoo! Groups Links >




I sm actually starting out with your code. The major work here is
that, in this case, the ethernat chip is connected to the external
bus as 16-bit. So, I have to change your driver to use the external
bus. It seems easy to me but I always read the "chip id" no matter
what I do!!!! I think the write_register() code is not working in my
case.

The big goal is to run IwIP in the fututre or any full TCP/IP stack.

Gus

--- In , "Paul Curtis" <plc@r...> wrote:
> Gus,
>
> I ported uIP to the E2124 and it works on that part, but that's in
> polled mode. I don't have a port of uIP for that board as I don't
have
> the board.
>
> If you have any success with it, please let me know--I'd be
interested
> to see what you make of the board as it's way over specified to
run uIP,
> better would be lwIP.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
>
> > -----Original Message-----
> > From: Gus [mailto:gus_is_working@y...]
> > Sent: 07 February 2005 15:39
> > To:
> > Subject: [lpc2000] olimex LPC-E2294 with ethernet
> >
> >
> >
> > Hello,
> >
> > I spent all weekend trying to get the ethernet to work on olimex
LPC-
> > E2294 board http://www.olimex.com/dev/lpc-e2294.html with no luck
> >
> > Looking at the board schematics, they have the Ethernet chip
> > "selected" all the time through R57!!! This is WRONG!! I
> > don't understand why!!! So I removed R57 and installed R56
> > instead. Now, when I read the chip, I always get the "chip
> > ID" no matter what register I select!
> >
> > Was anyone able to read the registers from CS8900A? Any
> > hints? Even with thier test code, I wasn't able to get things
> > going. The plan is to get uIP going on that board
> > http://www.sics.se/~adam/uip/
> >
> > Thanks,
> >
> > Gus
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >



Gus,

> > > I spent all weekend trying to get the ethernet to work on olimex
> LPC-
> > > E2294 board http://www.olimex.com/dev/lpc-e2294.html with no luck
> > >
> > > Looking at the board schematics, they have the Ethernet chip
> > > "selected" all the time through R57!!! This is WRONG!! I don't
> > > understand why!!! So I removed R57 and installed R56
> instead. Now,
> > > when I read the chip, I always get the "chip ID" no matter what
> > > register I select!

For register reads, I believe that is really doesn't matter that the
chip is always selected using /CHIPSEL as it will only present or latch
data on an IOR or IOW strobe. However, I have not used the chip in its
16-bit mode; it looks like the registers are memory mapped to
0x0000'0300.

Can you post a small piece of code that reads and writes the registers?

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors




Re: olimex LPC-E2294 with ethernet

Paul,

> chip is always selected using /CHIPSEL as it will only present or
> latch data on an IOR or IOW strobe.

Yes that is correct but we have FLASH and RAM on the bus!!! when RD
is strobed for RAM read, the ethernet chip will access the data bus.
I could be wrong somehow!

I am trying to do it in 8-bit now, was 16!! I just want to get it to
work for a starter. I am using the code posted on olimex website

unsigned short cs8900a_read(unsigned addr)
{
unsigned short Data1,Data2;
pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
Data1 = *pAdd_CS;
Data2 = ((*++pAdd_CS) << 8);
return(Data1|Data2);
// the folowing should work as well since we have 16 bit bus
// return *((unsigned short *)(CS8900A_BASE+addr));
}
void cs8900a_write(unsigned addr, unsigned int data)
{
pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
*pAdd_CS = data;
++pAdd_CS;
*pAdd_CS = data>>8;
}

void cs8900a_init(void)
{
int i;
// I am using this since the folowing code will not work
BCFG2=0x00003501;
/*
// CS8900A 8bit;
BCFG2_bit.MW = 0;
// IDCY = 1+1 ~ 33ns
BCFG2_bit.IDCY=1;
// WST1 = 8+3 (read) ~183ns
BCFG2_bit.WST1=8;
// WST2 = 6+1 (write) ~ 117ns
BCFG2_bit.WST2=6;
// RBLE = 1 - ako e 0 ne zapiswa
BCFG2_bit.RBLE = 1;
// WP =0, BM = 0
BCFG2_bit.WP = BCFG2_bit.BM = 0;
//*/
// this code was not changed from the example
// P3.25 - CS2 (CS8900A)
// P3.0 - A0
PINSEL2 |= 0x00804000;
//read chip id
cs8900a_write(ADD_PORT,0);
i = cs8900a_read(DATA_PORT);
if (i != CRYSTAL_SEMI_ID)
while(1);
// read revesion
cs8900a_write(ADD_PORT,0x2);
i = cs8900a_read(0xC);
// i will still be the "manufacture id" no matter what register I
select
Gus

--- In , "Paul Curtis" <plc@r...> wrote:
> Gus,
>
> > > > I spent all weekend trying to get the ethernet to work on
olimex
> > LPC-
> > > > E2294 board http://www.olimex.com/dev/lpc-e2294.html with no
luck
> > > >
> > > > Looking at the board schematics, they have the Ethernet chip
> > > > "selected" all the time through R57!!! This is WRONG!! I
don't
> > > > understand why!!! So I removed R57 and installed R56
> > instead. Now,
> > > > when I read the chip, I always get the "chip ID" no matter
what
> > > > register I select!
>
> For register reads, I believe that is really doesn't matter that
the
> chip is always selected using /CHIPSEL as it will only present or
latch
> data on an IOR or IOW strobe. However, I have not used the chip
in its
> 16-bit mode; it looks like the registers are memory mapped to
> 0x0000'0300.
>
> Can you post a small piece of code that reads and writes the
registers?
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors



Gus,

> > chip is always selected using /CHIPSEL as it will only present or
> > latch data on an IOR or IOW strobe.

> Yes that is correct but we have FLASH and RAM on the bus!!!
> when RD is strobed for RAM read, the ethernet chip will
> access the data bus.
> I could be wrong somehow!

IOR and IOW are gated using CS2 (look down by the copyright symbol)
hence even though CHIPSEL is always selected, you won't get an IOR or
IOW strobe unless CS2 is selected, I think--I'm not particularly good
with this type of thing.

> I am trying to do it in 8-bit now, was 16!! I just want to
> get it to work for a starter. I am using the code posted on
> olimex website
>
> unsigned short cs8900a_read(unsigned addr) {
> unsigned short Data1,Data2;
> pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
> Data1 = *pAdd_CS;
> Data2 = ((*++pAdd_CS) << 8);
> return(Data1|Data2);
> // the folowing should work as well since we have 16 bit
> bus // return *((unsigned short *)(CS8900A_BASE+addr)); }
> void cs8900a_write(unsigned addr, unsigned int data) {
> pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
> *pAdd_CS = data;
> ++pAdd_CS;
> *pAdd_CS = data>>8;
> }

This sort of looks OK modulo volatile.

> void cs8900a_init(void)
> {
> int i;
> // I am using this since the folowing code will not work
> BCFG2=0x00003501;
> /*
> // CS8900A 8bit;
> BCFG2_bit.MW = 0;
> // IDCY = 1+1 ~ 33ns
> BCFG2_bit.IDCY=1;
> // WST1 = 8+3 (read) ~183ns
> BCFG2_bit.WST1=8;
> // WST2 = 6+1 (write) ~ 117ns
> BCFG2_bit.WST2=6;
> // RBLE = 1 - ako e 0 ne zapiswa
> BCFG2_bit.RBLE = 1;
> // WP =0, BM = 0
> BCFG2_bit.WP = BCFG2_bit.BM = 0;
> //*/
> // this code was not changed from the example
> // P3.25 - CS2 (CS8900A)
> // P3.0 - A0
> PINSEL2 |= 0x00804000;
> //read chip id
> cs8900a_write(ADD_PORT,0);
> i = cs8900a_read(DATA_PORT);
> if (i != CRYSTAL_SEMI_ID)
> while(1);
> // read revesion
> cs8900a_write(ADD_PORT,0x2);
> i = cs8900a_read(0xC);
> // i will still be the "manufacture id" no matter what
> register I select

Need to assume that the bitfield stuff workds of course. It seems you
probably haven't written the address correctly in the first place and
the address port defaults to zero. What's your cs8900a_write function
like after you modified it?

Also, have you reset the CS8900A and waited for it to come out of reset? // Reset the CS8900A
cs8900a_write(ADD_PORT, PP_SelfCTL);
cs8900a_write(DATA_PORT, POWER_ON_RESET);

// Wait until chip-reset is done
cs8900a_write(ADD_PORT, PP_SelfST);
while ((cs8900a_read(DATA_PORT) & INIT_DONE) == 0)
;

I don't know whether this makes any difference or not, or is the
manufacturing data only available after a POR or somesuch?

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors



Paul,

> IOR and IOW are gated
I didn't see that LOL!! But why olimex did that anyways? weard!

>What's your cs8900a_write function
I removed the changes and trying to use this one unmodefied

void cs8900a_write(unsigned addr, unsigned int data) {
pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
*pAdd_CS = data;
++pAdd_CS;
*pAdd_CS = data>>8;
}

Gus
--- In , "Paul Curtis" <plc@r...> wrote:
> Gus,
>
> > > chip is always selected using /CHIPSEL as it will only present
or
> > > latch data on an IOR or IOW strobe.
>
> > Yes that is correct but we have FLASH and RAM on the bus!!!
> > when RD is strobed for RAM read, the ethernet chip will
> > access the data bus.
> > I could be wrong somehow!
>
> IOR and IOW are gated using CS2 (look down by the copyright symbol)
> hence even though CHIPSEL is always selected, you won't get an IOR
or
> IOW strobe unless CS2 is selected, I think--I'm not particularly
good
> with this type of thing.
>
> > I am trying to do it in 8-bit now, was 16!! I just want to
> > get it to work for a starter. I am using the code posted on
> > olimex website
> >
> > unsigned short cs8900a_read(unsigned addr) {
> > unsigned short Data1,Data2;
> > pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
> > Data1 = *pAdd_CS;
> > Data2 = ((*++pAdd_CS) << 8);
> > return(Data1|Data2);
> > // the folowing should work as well since we have 16 bit
> > bus // return *((unsigned short *)(CS8900A_BASE+addr)); }
> > void cs8900a_write(unsigned addr, unsigned int data) {
> > pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
> > *pAdd_CS = data;
> > ++pAdd_CS;
> > *pAdd_CS = data>>8;
> > }
>
> This sort of looks OK modulo volatile.
>
> > void cs8900a_init(void)
> > {
> > int i;
> > // I am using this since the folowing code will not work
> > BCFG2=0x00003501;
> > /*
> > // CS8900A 8bit;
> > BCFG2_bit.MW = 0;
> > // IDCY = 1+1 ~ 33ns
> > BCFG2_bit.IDCY=1;
> > // WST1 = 8+3 (read) ~183ns
> > BCFG2_bit.WST1=8;
> > // WST2 = 6+1 (write) ~ 117ns
> > BCFG2_bit.WST2=6;
> > // RBLE = 1 - ako e 0 ne zapiswa
> > BCFG2_bit.RBLE = 1;
> > // WP =0, BM = 0
> > BCFG2_bit.WP = BCFG2_bit.BM = 0;
> > //*/
> > // this code was not changed from the example
> > // P3.25 - CS2 (CS8900A)
> > // P3.0 - A0
> > PINSEL2 |= 0x00804000;
> > //read chip id
> > cs8900a_write(ADD_PORT,0);
> > i = cs8900a_read(DATA_PORT);
> > if (i != CRYSTAL_SEMI_ID)
> > while(1);
> > // read revesion
> > cs8900a_write(ADD_PORT,0x2);
> > i = cs8900a_read(0xC);
> > // i will still be the "manufacture id" no matter what
> > register I select
>
> Need to assume that the bitfield stuff workds of course. It seems
you
> probably haven't written the address correctly in the first place
and
> the address port defaults to zero. What's your cs8900a_write
function
> like after you modified it?
>
> Also, have you reset the CS8900A and waited for it to come out of
reset?
>
>
> // Reset the CS8900A
> cs8900a_write(ADD_PORT, PP_SelfCTL);
> cs8900a_write(DATA_PORT, POWER_ON_RESET);
>
> // Wait until chip-reset is done
> cs8900a_write(ADD_PORT, PP_SelfST);
> while ((cs8900a_read(DATA_PORT) & INIT_DONE) == 0)
> ;
>
> I don't know whether this makes any difference or not, or is the
> manufacturing data only available after a POR or somesuch?
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors



On 7 Feb 2005 at 15:38, Gus wrote:

>
>
> Hello,
>
> I spent all weekend trying to get the ethernet to work on olimex LPC-
> E2294 board http://www.olimex.com/dev/lpc-e2294.html with no luck
>
> Looking at the board schematics, they have the Ethernet
> chip "selected" all the time through R57!!! This is WRONG!! I don't
> understand why!!! So I removed R57 and installed R56 instead. Now,
> when I read the chip, I always get the "chip ID" no matter what
> register I select!

They qualify the IOR and IOW signals with CS2, hence one will only read from, write
to the chip when CS2 is active. They probably could have achived the same by
connecting CS2 to the CS8900 Chip select pin, and OE to IOR and WE to IOW.

Regards
Anton Erasmus

--
A J Erasmus


Hi Gus,

> > IOR and IOW are gated
> I didn't see that LOL!! But why olimex did that anyways? weard!
>
> >What's your cs8900a_write function
> I removed the changes and trying to use this one unmodefied
>
> void cs8900a_write(unsigned addr, unsigned int data) {
> pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
> *pAdd_CS = data;
> ++pAdd_CS;
> *pAdd_CS = data>>8;
> }

Looks fine; I guess the next step is to scope the waveforms arriving at
the CS8900A.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors




I got it to work last night. The problem is that olimex board has
the chip connected to 16-bit data bus but it will NOT work. It works
in 8-bit mode only.

What are the negative things about uIP? I used telnet and http last
night and it worked fine!

Gus

--- In , "Paul Curtis" <plc@r...> wrote:
> Hi Gus,
>
> > > IOR and IOW are gated
> > I didn't see that LOL!! But why olimex did that anyways? weard!
> >
> > >What's your cs8900a_write function
> > I removed the changes and trying to use this one unmodefied
> >
> > void cs8900a_write(unsigned addr, unsigned int data) {
> > pAdd_CS = (unsigned char*)(CS8900A_BASE+addr);
> > *pAdd_CS = data;
> > ++pAdd_CS;
> > *pAdd_CS = data>>8;
> > }
>
> Looks fine; I guess the next step is to scope the waveforms
arriving at
> the CS8900A.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors