Forums

CS8900A question

Started by Ian Wraith July 11, 2005
Hello
I am currently writing some low level code for interfacing the
LPC2124 to a CS8900A (it is an Olimex LPC2124 board). I am basing my
code around that on the Rowley Associates website. There are no
problems initialising the CS8900 and I can even read its EISA company
ID correctly. The problem comes when I poll the CS8900 to see if a
frame is waiting. My initial code used the RxEvent (0x0124) register ..

cs8900a_write(ADD_PORT,PP_RxEvent);
u=cs8900a_read_addr_high_first(DATA_PORT);

(where DATA_PORT is 0x0c)

this works fine. But when I tried to read the RXLength (0x402) word
I just received garbage. So to try and diagnose this I thought I
would try and read the RxStatus (0x400) word which according to the
datasheet should be the same as the RxEvent word. But when I tried the
code ..

cs8900a_write(ADD_PORT,PP_RxStatus);
u=cs8900a_read_addr_high_first(DATA_PORT);

I again get garbage and a result different to that contained in
Rx_Event.

Can anyone tell me where I'm going wrong here ? Its very odd how I
can read data from some locations but not others.

Regards

Ian


An Engineer's Guide to the LPC2100 Series

Ian,

Does the original port of the uIP code to the CS8900A run correctly on
your board? You do have an LPC-E2124?

-- Paul.

> -----Original Message-----
> From: Ian Wraith [mailto:i...@i.wr...]
> Sent: 11 July 2005 10:42
> To: lpc2000@lpc2...
> Subject: [lpc2000] CS8900A question
>
> Hello
> I am currently writing some low level code for interfacing the
> LPC2124 to a CS8900A (it is an Olimex LPC2124 board). I am
> basing my code around that on the Rowley Associates website.
> There are no problems initialising the CS8900 and I can even
> read its EISA company ID correctly. The problem comes when I
> poll the CS8900 to see if a frame is waiting. My initial code
> used the RxEvent (0x0124) register ..
>
> cs8900a_write(ADD_PORT,PP_RxEvent);
> u=cs8900a_read_addr_high_first(DATA_PORT);
>
> (where DATA_PORT is 0x0c)
>
> this works fine. But when I tried to read the RXLength
> (0x402) word I just received garbage. So to try and diagnose
> this I thought I would try and read the RxStatus (0x400) word
> which according to the datasheet should be the same as the
> RxEvent word. But when I tried the code ..
>
> cs8900a_write(ADD_PORT,PP_RxStatus);
> u=cs8900a_read_addr_high_first(DATA_PORT);
>
> I again get garbage and a result different to that contained
> in Rx_Event.
>
> Can anyone tell me where I'm going wrong here ? Its very
> odd how I can read data from some locations but not others.
>
> Regards
>
> Ian >
>
> Yahoo! Groups Links



Hello
I tried compilng the uIP code but it came up with a number of
errors. To tell you the truth I wasn't to bothered about these as
I just wanted the code to use the CS8900 low level interface code as
I want to have a go at writing my own limited interface stack.

The cs8900a_init function was fine but the cs8900a_poll function was
indicating a frame was ready at all times even when I had no network
connected. The problem seemed to be this ..

if ((cs8900a_read(DATA_PORT) & 0xd00) == 0)
return 0;

as this isn't checking the status of bit 8 the RxOK bit which indicates
a valid frame is waiting. When I changed this to ..

u=cs8900a_read_addr_high_first(DATA_PORT);
// Check if the RxOK flag is set //
if ((u&RX_OK)==0) return 0;
// Now check that either the Broadcast or Individual Addr bits are set
if ((u&(RX_BROADCAST_ACCEPT+RX_IA_ACCEPT))==0) return 0;

all was well but I still can't read the value of the RxLength word.
The original code did this ..

// Read receiver status and discard it.
cs8900a_read_addr_high_first(RX_FRAME_PORT);

// Read frame length
len = cs8900a_read_addr_high_first(RX_FRAME_PORT);

but that just returns garbage in the form of an alternating pattern
of 1's and 0's.

Oh and yes I do have an LPC-E2124.

But I might be missing something as it is just far to hot to think
at the moment :(

Regards

Ian



Hello

--- In lpc2000@lpc2..., Ian Wraith <i.wraith@s...> wrote:
> There are no problems initialising the CS8900 and I can even read
> its EISA company ID correctly.

I have just double checked this and it seems I can't read the
company ID correctly after all. When I check this my program returns
a value of 0x6355 where as the actual value should be 0x630E. So
I can read the first byte correctly but the lower one is always
0x55 (an alternating pattern of 0's and 1's). My problem therefore
is in the code that reads a word from the CS8900.

My apologies for wasting peoples time.

Regards

Ian


I had the same problem.

Solution: insert some delay cycles between the write and the read. (I put :
static int dummy = 1;
#define delay() {int
delayCtr=0;for(delayCtr=0;delayCtr<10;delayCtr++){dummy+=dummy;dummy+ay;
}}
) and didn't give a second tought about it. (yes, it's dumb, but it seems to
work. Yes, it can be improved).

What can be? I think it has something to do about the pin toggle time (lower
than the time between the read and the write of de arm) or to the timings of
the CS8900 (I think it says something like 135 ns between the write and read
times). (This is a guess, remember.)

As you can guess, I didn't investigate it...

Funny thing is that I only saw this with the GCC, when I tried the
crossworks, the code worked. (I used the uIP and FreeRTOS).

Best of lucks,

Luciano

> -----Original Message-----
> From: lpc2000@lpc2...
> [mailto:lpc2000@lpc2...] On Behalf Of ian_wraith
> Sent: Monday, July 11, 2005 4:17 PM
> To: lpc2000@lpc2...
> Subject: [lpc2000] Re: CS8900A question
>
> Hello
>
> --- In lpc2000@lpc2..., Ian Wraith <i.wraith@s...> wrote:
> > There are no problems initialising the CS8900 and I can
> even read its
> > EISA company ID correctly.
>
> I have just double checked this and it seems I can't read
> the company ID correctly after all. When I check this my
> program returns a value of 0x6355 where as the actual value
> should be 0x630E. So I can read the first byte correctly but
> the lower one is always
> 0x55 (an alternating pattern of 0's and 1's). My problem
> therefore is in the code that reads a word from the CS8900.
>
> My apologies for wasting peoples time.
>
> Regards
>
> Ian > Yahoo! Groups Links




Hello Luciano
Many thanks for your mail. I added a delay where you
suggested and everything worked fine. Later I suppose I will
have to fine tune the program to make the delay as short as
possible but right now I am just happy to be able to read data
from the CS8900A.

Thanks Again.

Ian