【转】Ultra simple ISO-7816 Interface
原文出自 http://hilbert-space.de/?p=135
While laying out a PCB for my SWP reader project I realized that I haven’t ever tested the ISO-7816 (aka contact) interface yet. I probably forgot that because it’s not all that difficult and not that interesting, but I’d rather see it working before I order PCBs.
So I spend an hour or two in the internet looking for inspiration how other people did it. There are lots of specialized chips for this purpose out there, but sourcing is always a problem and since it’s “just” a simple serial interface I was more interested in a simple hack that will work.
Turns out there are a lot of simple SIM/Smart-card readers out there that just do this, and they pretty much all look like this:

Here Q1 is running as a open collector driver with R1 as a pull-up resistor. This transistor will invert the signal, that’s why there is an additional inverter A1 in front of the base. R2 and C1 are the usual base-resistor and speed-up capacitor.
You’ll find variations of this basic circuit all over the net. Sometimes they omit the speed-up capacitor, sometimes you find buffers in the RX-UART path, but that’s it basically.
I heated up my soldering iron and gave this circuit a test drive, and lo and behold: It works as expected (aka good enough in practice).
So problem solved, move on.
Not so. In the
middle of the night it came to me, that almost the entire circuit is
unnecessary. What does it really do? On the Q1 collector we see a
replica of the TX-UART signal. The SIM card IO pin (which is just an
open collector IO-pin) is able to pull the signal down at will without
causing a short to TX-UART.
RX-UART picks up
this signal and echoes back either what comes from TX-UART or from IO.
Neither pin is pulling up the signal, that’s what R1 is doing.
So how about this:

It’s working just the same, just faster and with less parts.
In case that
TX-UART is transmitting, and IO is listening the singal will just pass
R1. If TX-UART stops transmitting the UART will go into idle-state
(logic high). This effectively ties R1 to VCC and we have exactly the
same behaviour as with the more “complex” circuit.
If the SIM transmit
something SIM-IO just pulls the line down to ground. A bit of current
will flow out of TX-UART, but that’s fine. Compared to drive a LED from a
GPIO pin that’s nothing.
If you feel inspired to try this out, here is a short how-to:
- Configure the UART on the micro-controller side for 9600 baud, 8 data bits, two stop-bits and even parity.
- Power the SIM VCC pin, have reset low.
- Apply a clock signal 372 times the UART baud-rate: 3.57 Mhz.
- Wait a little for the SIM/SmartCard to stabilize.
- Raise the reset line to taking the SIM-card out of reset.
And then watch the
Answer to Rest (ATR) signature arriving at your micro-controller UART-RX
pin. You’re now ready to implement the ISO7816-3 T=0 or T=1 protocol
and do some real data-exchange. With practically any micro-controller
and just a simple resistor.
Oh, by the way.
You’re allowed to let the IO pin of the SIM to pull down up to 500µA, so
if you get problems with stray capacitance just lower R1. Minimum
values are:
- 3.6k for 1.8V supply
- 6.6k for 3.3V supply
- 10k for 5V supply.

【转】Ultra simple ISO-7816 Interface的更多相关文章
- a simple and universal interface between web servers and web applications or frameworks: the Python Web Server Gateway Interface (WSGI).
WSGI is the Web Server Gateway Interface. It is a specification that describes how a web server comm ...
- STM32F401
The STM32F401 line is the entry level to the STM32 F4 series. It is designed for medical, industrial ...
- ISO 7810 协议小结
ISO 7816规定了Smart Card的传输协议分为 T=0 异步半双工字符传输协议 T=1 异步半双工块传输协议 T=0命令介绍 命令总是由接口设备启动,他以一个5字节的报头通知卡要做什么,然后 ...
- Common Gateway Interface Python CGI编程
https://en.wikipedia.org/wiki/Gateway_(telecommunications) In telecommunications, the term gateway r ...
- Awesome C/C++
Awesome C/C++ A curated list of awesome C/C++ frameworks, libraries, resources, and shiny things. In ...
- awesome cpp
https://github.com/fffaraz/awesome-cpp Awesome C/C++ A curated list of awesome C/C++ frameworks, lib ...
- Styles and Themens(4)android自定义主题时可使用的属性
A list of the standard attributes that you can use in themes can be found at R.styleable.Theme. Cons ...
- [转]awsome c++
原文链接 Awesome C++ A curated list of awesome C++ (or C) frameworks, libraries, resources, and shiny th ...
- Pyhton开源框架(加强版)
info:Djangourl:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 ...
随机推荐
- hdu2069-2071
hdu2069 选取硬币组成定值,暴力 #include<stdio.h> ]={,,,,,}; int main(){ int n; while(scanf("%d" ...
- hdu 5182 结构体排序
BC # 32 : 打 BC 的时候没看全三个关键字,WA 了五发,花了近一小时,问了一下才发现少看一个条件,于是顺利给跪. 题意:给出若干城市的两次空气质量,首先按空气质量差排序,若相等则按第二次排 ...
- LG1801 【黑匣子_NOI导刊2010提高(06)】
看到各路dalao用平衡树的做法,表示本人不才,并不会. 然而我会优先队列_huaji_,并且发现用堆解题的dalao们并没有基于在线的做法 于是我的showtime到了 评测结果:https://w ...
- ASP.NET MVC Area 的使用
MVC提供Area机制,在同一个项目之内就能够切割出不同的ASP.NET MVC网站. 插入:首先在相同的位置,比如说同一个文件夹(如:Controllers)是不能创建俩个相同名称的文件(如:Hom ...
- ASP.NET MVC中如何实现页面跳转
1,最简单的方式:超链接 以下分别是连接到HomeController控制器下的SharpL动作方法,以及百度首页.代码如下: <a href="Home\SharpL"&g ...
- AppBox Mvc数据库初始化
下载AppBoxMvc后,以为CTRL_F5运行后就能数据库初始化了.一直报失败 我的环境是VS2017,利用VS2017自带的数据库 后修改: 1. 修改AppBoxContext.cs publ ...
- Angular 4 管道
一.date管道 1.html 2. 控制器中的定义brithday 3.效果图 如果时间格式 为: 我的生日是{{birthday | date:'yyyy-MM-dd HH:mm:ss'}} 则效 ...
- thinkphp 3.2.3在nginx+php下的url重写配置经验
环境:centos7.2+lnmp1.3(nginx+php7.0+mysql5.5) 进入服务器配置路径:cd /usr/local/nginx/conf/nginx.conf 修改nginx.co ...
- asp.net如何使用cookie(创建、保存、读取)
Cookie的用法也和ASP中差不多.比如我们建立一个名为aspcn,值为大众的cookie HttpCookie cookie = new HttpCookie("aspcn") ...
- java IO字符流
字节流:因为内存中数据都是字节,二进制数据. 字符流:方便处理文本数据.字符流是基于字节流的. ascii 编码表,并且各国都有自己的编码表. unicode码表,世界码表.优化后 utf-8码表. ...