How to read & write in a Compact flash register, addressing problem?

Status
Not open for further replies.

Sems

New Member
Hi,

It's my first post here, I have an embedded system, a pcb which have an AT89C51SND which communicates with a CompactFlash by a latch 74573 (for P0 signals address and data) and I want to test this communication.

I want to read a sector (register) in the Compact Flash so I try first to write on the external ram and read this values but it doesn't work ( I read FFh only).

Howewher ALE is set it does'nt seems to work.

For true ide mode for the CompactFlash, I must set the bit EXT16 and my AUXR register has this config : 0xCDh.

My code is in Keil compilator:

Code:
Code:
/* READ registers AT-interface */

#define atBASE 0xc000
unsigned char volatile xdata atrDATMSB _at_ 0xF000; /* MSB register op interface-kaart  */
unsigned char volatile xdata atrALTERN _at_ 0xF006;
unsigned char volatile xdata atrDRIVAD _at_ 0xF007;
unsigned char volatile xdata atrDATLSB _at_ 0xF008;
unsigned char volatile xdata atrERROR  _at_ 0xF009;
unsigned char volatile xdata atrSECCNT _at_ 0xF00A;
unsigned char volatile xdata atrSECNR  _at_   0xF00B;
unsigned char volatile xdata atrCYLLOW _at_ 0xF00C;
unsigned char volatile xdata atrCYLHIG _at_ 0xF00D;
unsigned char volatile xdata atrDRHEAD _at_ 0xF00E;


/* AT89 config & registers */

  CS0 = 0x01; //CSO
  CS1 = 0x00; //CS1
  AUXR = 0x4D; // the  bit 7 is set by default so AUXR = 0xCD
             printf("test loop...\n\r");
             for(j=0;j<256;j++)
       {
            atrSECNR = j;
            for (z=0;z<1000;z++);
            delayrout(50000);
            printf("-[%X]\n",atrSECNR);
         }

/* results is : */

..
-[FF00]
-[FF00]
...


When I try to read or write it's not work.
Is there a programming problem or addressing external registers?
Can you help me please ?

Is that the good way to test an external register of the compactflash ?

Thank you.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…