Show Posts
Pages: [1]
1  Using Arduino / Storage / Re: Inerfacing with smart card on: March 01, 2011, 06:42:25 am
I have made no progress...
Since you have called Wire.begin() you can't modify analog pin #4 and #5 unless with Wire lib functions...
Doing something like "digitalWrite(A5, HIGH); ... ; digitalWrite(A5, LOW)" doesn't work...
I can't understand how the Wire lib (or in general how the I2C protocol) threat the clock process: there is an explicited called clock() function or internally there is something like an oscillator that works continuously?
Any help?
2  Using Arduino / Storage / Re: Inerfacing with smart card on: February 24, 2011, 12:58:42 pm
Thanks for the answers.

@PaulS
Quote
Since you have connected the clock pin (#3 on the card), to an analog pin, which is, by definition, input only, how did you "send one clock"?
That's my problem. Since I want to use the Wire lib to read the data (it makes things a lot easier), i had to plug the CLK line and the data line to analog pin #5 and #4. So I have no idea how to send one clock, i tried to do it in my code (see clock() function) but it doesn't work.
The problem with the Wire library is that it doesn't provide any support for a third line (the reset one trough which i need to send the ATR command) so i need to manually do the clock-thing...

@philicoe
Thanks for the infos!
3  Using Arduino / Storage / Inerfacing with smart card on: February 24, 2011, 05:53:54 am
Hi all,
I want to read the data of a smart card with arduino but it isn't as simple as i thought.
I have a smart card that I don't know of which type it is, so I discover that by sending a "answer to reset" command to the card I should get a 4 byte string that identify the card type. My problem now is how to get this code.

I've  plugged the card to arduino by following this image:

1. VCC (alimentation)
2. RST (remise à zéro)
3. CLK (horloge)
4. D+ (USB Inter-chip)
5. GND (masse)
6. SWP
7. I/O (entrée/sortie)
8. D- (USB Inter-chip)

I've plugged 1 with the 5v pin
2 with the 3 analog pin
3 with the 5 analog pin
5 with the GND pin
7 with the 4 analog pin

To send an ATR command you have to held the reset pin high, send one clock, relase the reset pin and then you can read the 4 byte data.
Here is shown well:

I've wrote this code:
Code:
#include <Wire.h>

int resetPin=3;
int clockPin=4;
int dataPint=5;

void clock(){
  analogWrite(clockPin, 1023);
  delay(70);
  analogWrite(clockPin, 0);
}

void setup(){
 
  Wire.begin();
  Serial.begin(9600);
  Wire.beginTransmission(0x00);

  analogWrite(resetPin, 1023);
  clock();
  analogWrite(resetPin,0);
  Serial.println(Wire.receive());
 
  Wire.endTransmission();
}

void loop(){}

Obviously it doesn't work... Any idea about how to do this operation? I can't find any reference on the internet...

Thanks
Pages: [1]