【转】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)风格的 ...
随机推荐
- hdu1224 dp(dp + 栈/父亲数组记录路径)
题意:给定 n 个城市的有趣度,并给出可以从那些城市飞到那些城市.其中第一个城市即起始城市同样也作为终点城市,有趣度为 0,旅行途中只允许按有趣度从低到高旅行,问旅行的有趣度最大是多少,并输出旅行路径 ...
- Struts2重新学习1
一:框架 1:框架的意义在于可以大大提高我们的开发效率.框架时一种主动设计,使用框架必须遵守框架指定好的开发流程. 2:框架的强大之处不是源自它能让你做什么,而是它不能让你做什么.有规有矩,方可成方圆 ...
- StreamSets 管理 SDC Edge上的pipeline
可选的方式: ui (data colelctor) 发送命令 UI 主要是创建edge pipeline 的时候进行edge server 的配置 默认是 http://localhost:1863 ...
- Understanding Safari Reader
Interesting enough to find out the Reader function in Safari is actually Javascript and there are ma ...
- bzoj 3674 可持久化并查集加强版——可持久化并查集
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3674 用主席树维护 fa[ ] 和 siz[ ] .改 fa[ ] 和改 siz[ ] 都 ...
- mysql 微信用户昵称emoji 完整保存
微信用户昵称现在丰富多样,一些个性的名称中经常包含有特殊字符,以及emoji表情.起先,我总以为MySQL只能保存纯文本数据.但其实mysql(5.7版本)已非常强大,完整保存微信用户昵称(emoji ...
- EXPLAIN执行计划中要重点关注哪些要素(转)
EXPLAIN的结果中,有哪些关键信息值得注意呢? MySQL的EXPLAIN当然和ORACLE的没法比,不过我们从它输出的结果中,也可以得到很多有用的信息. 总的来说,我们只需要关注结果中的几列: ...
- 利用Python玩微信跳一跳
创建python项目jump_weixin,新建python程序jump.py 需要4个辅助文件[adb.exe,AdbWinApi.dll,AdbWinUsbApi.dll,fastboot.exe ...
- 如何在eclipse中安装angularjs插件
1,首先,在eclipse中使用angularjs的时候,由于没有相应的提示,导致在开发的时候给我们带来了很多的不便,需要在这上面耗费一些时间.那么这时候我们都在想可不可以让eclipse也和一些前端 ...
- NSWindow添加NSViewController
大概这样,笔记一下,防止忘记 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { MyViewControl ...