Pages: [1] 2   Go Down
Author Topic: Smartcard access library  (Read 6508 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

As I just started to check out the features the Arduino provides and after finishing several LED, Shift Register etc. projects the time had come for a more demanding project ... And after disassembling a old settop box a Smart Card access lib was started. It is based on the TDA8024T smart card interface chip, which is more or less just a "electrical" protection device and has only minor effect on the communication, it should be also possible to connect the Arduino directly to the smart card contacts (Which I never has tried, but this should work as the eletrical parameters match).

Currently it is able to communication (send / receive) to synchronous (2wire) and asynchronous cards, has autodetection of card type and can be compiled to support only one or the other type.

The checked card base is not representiv as I only could get my hands on the "smart cards" in my wallet ... All of them worked, but only up to a certain level, as most of the communication requires registration for specifications ... The german "Krankenversichertenkarte" is working greatly (Synchronous card - 256Byte EEPROM Card with an open specification).

The next steps I want to take are to remove the "interface chip" (Just buy me a card slot, without any additional hardware) and check out some other cards I can get my hands on, optimizing the library and all the other things a developer does in his spare time smiley-grin

The current version is attached and updates can be found on sourceforge (http://sourceforge.net/projects/arduinosclib/)

Regards
 
  angus






* sclib_v0.0.2.zip.zip (9.29 KB - downloaded 11 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
i'm a little confused about your library. Is it designed to work with the TDA8024 interface IC or can it be used to communicate directly between the arduino and the smart card. Secondly some form of schematic as to its connection (if we are connecting directly to the smart card) would help.
thanks.
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

To answer your question in a short way .. It's designed to work with the TDA8024 as this IC was available to me, but as the TDA8024 is mainly used to "decouple" the controling curcit and the smartcard it should be able to communicate directly to the smartcard from the Arduino.

A description "how to connect" the TDA8024 / smart card can be found in the wiki page on sourceforge (http://sourceforge.net/p/arduinosclib/wiki/Home/). I hope this helps ... If more information is needed or you have any comments ... Just let me know

regards

  angus
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 Thanks alot, i'm trying to use your library for a smartcard implementation, i'll sure be in touch if i have more questions.
thanks
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Angus,
I'm trying to use your library for a project. I am connecting the smartcard (an ACOS3 contact card 64KB EEPROM) directly to the Arduino without any chip. I want to know which mode, synchronous or asynchronus mode is suitable for the card?
A schematic for direct connecting of the contact pins to the Arduino would be of help too.The card is ISO7816-1,2,3 compliant 8-contact module supporting T=0 direct protocol.

Thanks a lot.
Niyi.
« Last Edit: July 16, 2012, 12:38:25 pm by niyigbada » Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Niyi,

For the mentioned card it should be okay to use it with in asynchronus mode, as it supports the T=0 protocol, which is defined to be asynchronus.

As there is a popular demand for a direct connection of smartcards to the arduino board, I will modify the code / description to reflect the needed wiring, when I'm able to get my hands on a smartcard slot. (I think one of my old set-top boxes is missing it's smart card slot in a minute. So if I'm not burning myself, unsoldering the smart card slot, I will start right away doing the needed modifications.)

If a SCLib version is available I will post an update here (But this might take a week or two smiley).

regards

  Angus
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

As promised I updated the SCLib to be able to talk directly to a smartcard, without the need to have any interface chip (Just be carefull not to fry any 3.3V GSM cards etc., as currently it works with 5V).

The updated  release (0.0.4) can be found here http://sourceforge.net/p/arduinosclib/wiki/Home/. I also provided a schematic how to connect a smartcard slot to the Arduino.

Regards

   Angus
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Angus,

I'm trying to use your library with the Arduino Mega. Unfortunately so far, I wasn't able to receive the correct ATR.
I'm able to detect when the card is inserted, but then during the cold reset the ATR received isn't the one I'm supposed to received.
And also, each time I reset then plugged I got a different ATR.
I only change PIN CLK by PIN 20.
Do you have some advise?

Thanks,
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi quertyn,

Nice to hear that you are actually using the Lib. As you are using the Arduino Mega the change to the PIN 20 for the CLK generation might be the problem. I've checked the pin mapping sheet for the Mega (http://arduino.cc/en/Hacking/PinMapping2560) and the digital PIN 20 can not be used as "Timer/Counter OutputCompare Match Output". In my case "OC1A", which is mapped to digital PIN 11 on the Arduino Mega.

First I would recommend to use digital pin 11 as CLK (Currently the use of OC1A is hardcoded, as I didn't found a fast way to determine if a counter is attached to the choosen CLK pin and how to configure it, so that it works all the time). I will look into this problem, but in your case it should work, if you use digital pin 11 and put the Vcc function to another pin.

Secondly. Which version are you using? Currently 0.0.7rc2 is the lastest and releases before 0.0.7 have problems getting certain cards recognized. This process is much more secure in 0.0.7rc2.

Please let me know if this helps.

regards

  Angus
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Angus,

Sorry for the late reply, i didn't receive any info from the forum about your answer.
Anyway it was very helpful. I made the change using the PIN11 for the CLK.
Now i'm able to retrieve ATR. smiley-lol
Thanks for your help.

Quertyn
Logged

India
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I'm doing a work with SIM card, i want to copy the entire phonebook and message from one sim to another with arduino. Is it possible to use this library for the purpose?? how can i access and copy the phonebook and message location in the sim card?
plz help me
thank you smiley
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi s_premkumar999,

In general this should be possible with the library, but first you should check out the voltage used by the SIM card you are talking to, as the Arduino might use a voltage a little bit to high, if the SIM card is connected directly to the Arduino.

It should be possible to generate the needed APDU commands (Select File, Get Response etc.) to retrieve the data from the SIM cards, but I can't help you with the commands needed to retrieve the information. You need to check the documentation online available regarding the SIM card protocol and file layout.

Are you able to retrieve the ATR (Answer to reset) message from your SIM card? This is normally a good starting point for finding out, what protocol is supported (T=0 or T=1) and what communication parameters are needed. 

I would recommend the "apdu_t0_communication" example in the latest release (0.0.7rc3) as a starting point, this should give a framework for further experiments.

With kind regards

  Angus
Logged

Zurich
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Angus,
do you have a schematic on how to connect the TDA8024T in between?
Thanks,
Michael.
Logged

Kind Regards/Mit freundlichen Grüssen,
Dr. Michael Kroll.
---
Blog: http://www.mkroll.mobi
Forum: http://forum.mkroll.mobi
Twitter: @dr_m_kr

India
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Angus  smiley

I'll try these thing and will tell u the details soon.

i have one more doubt, i found some IC like, DS8007 (http://www.maximintegrated.com/app-notes/index.mvp/id/4029), TDA 8024 actually what is the function of these ICs when connecting with a microcontroller??
you said that with the library you given we can directly connect the card with arduino so if i'm using 3.7v SIM cards, to match the voltage can we connect the sim card to the arduino through a buffer like CD4050? is that enough??
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi s_premkumar999, Hi mkroll

As both of you have similar questions, I will try to answer them in one post.

@s_premkumar999

If I understand the datasheets I found for the CD4050 correctly, this is a "one way" level shifter, which will not help you in this case as at least the C7 (I/O) contact of the smart/sim card is driven by both communications partners. What you might need is a transceiver, which works in both ways. (This is actually what the TDA8024, TDA8035, DS8024 or DS8113 are doing + additional smart/sim card features). So the CD4050 won't work in my opinion in this case.

The chips you found or the ones I've mentioned above are in my opinion just level shifter (The DS8113 supports 5V, 3.3V and 1.8V smart/sim cards). They just take care of the conversion of the voltage levels between modern MCU (Mostly 3.3V or 5V) and smart / sim cards, they also provide some convenience functions, like correct reset timing etc. and last but not least as you can not control what card a use might insert, they protect the MCU against the "outside" world. So for actual products I would recommend using this chips. If you just want to learn how the smart / sim card functions work or have a controlled environment, you can connect your 3.3V SIM (I'm not sure what you meant by 3.7v as I wasn't able t find information's about 3.7v SIM cards, so I thought it's just a typo and you meant a 3.3Volt SIM card) card directly to an Arduino supporting 3.3V (Like the new DUE or a lot of the Mega Version, which support 3.3V / 5V logic).

@mkroll

I don't have a schematic how to connect the TDA8024 with the Arduino, as I've reused a old smart card slot of a set-top box I had laying around. This Smart Card slot is based on a TDA8024, but if you google NXP TDA8024 or NXP TDA8035 you will find a lot information right on the NXP site (there is also a application note AN11058 on how to replace a TDA8024 with a TDA8035). Also Maxim provides a lot information about there maxim DS8024 or maxim DS8113 chips and about the underlying communication protocols. If you read the data sheets closely it talks a lot about high frequency problems and there avoidance, which is quite out of my scope, but with the data from the NXP/MAXIM datasheets it should be possible to build quite decent shields / smart card interfaces.

With kind regards

  Angus

PS: I wasn't sure about giving direct links to the data on the NXP or Maxim sites, so I used the "google" way, which in my case led to very useful links on the first page ...
 
Logged

Pages: [1] 2   Go Up
Jump to: