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