Forum: Mikrocontroller und Digitale Elektronik SLE4442 kein ATR


von Mario G. (estummel)


Lesenswert?

Hi Leute,

ich möchte eine SLE4442 Smart Card lesen. Nun als erstes einfach einen 
ATR ausführen. Beim einstecken der Karte wird folgendes ausgeführt, 
Spannung ist auf VCC Kontakt der Karte vorhanden.

Ich habe folgenden Ablauf - Pseudo Code:


I/O Leitung auf Tri-State
RST high
delay 5ys
CLK high
delay 20ys
CLK low
delay 5ys
RST low
delay 5ys

So und jetzt sollen lt. Datenblatt die 32 Bits / 4 Byte von der SLE4442 
kommen.

ATR Bytes sollten so aussehen:

Byte 1 0xA2
Byte 1 0x13
Byte 1 0x10
Byte 1 0x91

ich bekomme aber nur 0x00

Was habe ich da falsch gemacht ???

von Axel H. (axelh)


Lesenswert?

Hmm....da gibt es einiges, z.B.

I/O Leitung nicht als Input gesetzt?
CLK Signale vergessen für jedes Bit der ATR?

von Mario G. (estummel)


Lesenswert?

Hi Axel,

ok hier noch mal die ATR Routine


sbi(IO_DDR,   IOPIN);    // output
sbi(CLK_DDR,   CLKPIN);  // output
sbi(RST_DDR,   RSTPIN);  // output

// initial state
cbi(RST_PORT, RSTPIN);
cbi(CLK_PORT, CLKPIN);
sbi(IO_PORT,   IOPIN);
_delay_us(5);

// begin to ATR procedure
sbi(RST_PORT, RSTPIN);
_delay_us(1);

sbi(CLK_PORT, CLKPIN);
_delay_us(1);

cbi(CLK_PORT, CLKPIN);
_delay_us(1);

cbi(RST_PORT, RSTPIN);
_delay_us(5);


// release the IO - tri state
cbi(IO_DDR,   IOPIN);
cbi(IO_PORT,   IOPIN);

// and no the ATR data are ready to take

for ( i=0; i<4; i++) {
  b= 0x00;
  mask= 0x01;

  // for any byte
  for ( x=0; x<8; x++) {

  // clock
  sbi(CLK_PORT, CLKPIN);
  _delay_us(5);

  // check bit
  if ( bit_is_set(IO_REG, IOPIN) )
    b |= mask;

  mask <<= 1;
                      cbi(CLK_PORT, CLKPIN);
  _delay_us(5);

 }

 data[i]= b; // save byte
}

WhileCardIsPrecence();

}

Jetzt sollte der ATR String vorhanden sein.

Was ist da falsch ???

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.