【转】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)风格的 ...
随机推荐
- linux 的dmesg命令
dmesg命令参考博客 http://www.linuxso.com/command/dmesg.html dmesg用来显示内核环缓冲区(kernel-ring buffer)内容,内核将各种消息存 ...
- dup and dup2的剖析
转:http://www.cnblogs.com/sdphome/archive/2011/04/30/2033381.html dup和dup2都可用来复制一个现存的文件描写叙述符,使两个文件描写叙 ...
- ThinkPHP 更新 5.0.23 和 5.1.31
ThinkPHP 更新 5.0.23 和 5.1.31 FastAdmin 也跟着更新. V1.0.0.20181210_beta 修复 ThinkPHP5.0发布了一个重要安全更新,强烈建议更新 修 ...
- SimpleSocket
项目地址 : https://github.com/kelin-xycs/SimpleSocket SimpleSocket 一个 用 C# 调用 Win Socket 2 的 程序 , 对 Win ...
- java中<load-on-startup>含义
java中 load-on-startup 含义 java中的 load-on-startup 用于表示该servlet是否在servlet容器启动的时候加载. 示例: <load-on-sta ...
- maven工程下的“run as application”
为了让maven能够在Terminal窗口执行(比在Console执行方便多了,命令行总是比右键选择run要快),需要配置如下的profile:然后敲入 mvn -test -Prun 即可. ...
- LOJ 6053 简单的函数——min_25筛
题目:https://loj.ac/problem/6053 min_25筛:https://www.cnblogs.com/cjyyb/p/9185093.html 这里把计算 s( n , j ) ...
- windows环境下把Python代码打包成独立执行的exe可执行文件
有时候因为出差,突然急需处理一批数据.虽然写好的脚本存储在云端随用随取,然而编译的环境还需要重新搭建,模块也需要重新装载,从头到尾这么一遍下来,也是要花费可观的时间成本的. 有没有什么办法,可以让.p ...
- asp.net 网站 发布时 去掉.cs文件
VS2013在WIN8下扁平的UI和我今天锈垢的大脑,让找这个设置找了好半天!!! OK,言归正传. 在要发布的网站上右键,选择"发布网站". 在发布窗口中,会让你选择 ...
- BASIC-28_蓝桥杯_Huffuman树
题目: 问题描述 Huffman树在编码中有着广泛的应用.在这里,我们只关心Huffman树的构造过程. 给出一列数{pi}={p0, p1, …, pn-1},用这列数构造Huffman树的过程如下 ...