TRYING to make a smart card reader: with rs232 to TTL - Page 1
Forum section: electronics / projects

author: Rizzrack89
author_rank: Newbie
timestamp: March 08, 2023, 04:12:29 am
content: Hey!So…Im trying to make this smartcard reader, but also to interface it to my Rpi4b.Heres the smartcard reader schematic:Https://http://ladyada.net/make/simreader/simreaderv1_0.png74HC04AN hex inverter datasheet:https://www.ti.com/lit/ds/symlink/sn74hc04.pdfHeres the RS232 to TTL module schematic i used:https://cdn.sparkfun.com/datasheets/BreakoutBoards/MAX3232_Breakout_v11.pdfSP3232EBCN datasheet:https://assets.maxlinear.com/web/documents/sp3222eb_sp3232eb.pdfCouple of questions….im not pro.1) the SP3233 reads 3.3v at pin 16 when i connect the 9v battery.Shouldnt it be zero? And then 3.3v when i connect the rpi 3.3v rail?Im pretty sure the rpi 3.3v rail goes connected to this pin.The sparkfun schematic says: 3.3v > VCC > 5v for the sp3232 module.The tx/rx pins read 3.3v. Good. I think this is correct.2) the 9v battery’s negative side is supposed to be on ground for thereader. Can someone help me understand ground loops. Do i connect theSp3232 ground pin15 to the rest of the grounds from the smart card schematic?What about the Rpi ground rail, when i finally finish,do i use a jumper and connect the rpi GND to these grounds?

author: pqass
author_rank: Super Contributor
timestamp: March 08, 2023, 06:18:38 am
content: I'm not sure how you are connecting the RPi4 to the to the smartcard reader...through a SP3232 module whose RS232 side connects to the X2 port (and FTDI port left open)?If so then...Quote from: Rizzrack89 on March 08, 2023, 04:12:29 amX2 connector only has signal wires (RX,TX,RTS) and GND; ie. power from the smartcard reader board isn't being offered to the module (like via a Vcc pin, naturally because this is a classic DTE wired RS232 port). Therefore, the sp3232 module is expected to get power from the host it's connected to. If the module is un-powered, sometimes chips get phantom power through one of the signal pins because there are protection diodes on these pins (that power is backfed from). Though, I'd expect these interface chips to be robust given many times there are RS232 signals present when the equipment it's connected to is off.If the  TX/RX pins (TTL/CMOS side) read 3.3V it could be because they have an internal pullup to Vcc or, if connected to the RPi4b, because the idle state of UART signals default to high (when not transmitting).QuoteYes, the SP3232 module GND and the reader GND should be connected via X2 GND pin.Then the SP3232 module GND and RPi4b GND should also be connected too.RPi4 J8 header pin 8 (GPIO 15, TxD) should be connected to the TTL/CMOS side of the SP3232 module IC (*either pin 10 or 11).RPi4 J8 header pin 10 (GPIO 16, RxD) should be connected to the TTL/CMOS side of the SP3232 module IC (*either pin 9 or 12).You will need another pin** (under app software control) on the RPi4 to source the RTS signal that toggles the RST (reset?) pin on the smartcard.*I don't know which since you didn't provide the SP3232 module schematic JP2 to RPi4b pin mapping.**It could be any other pin in the RPi4 header; look for a configuration parameter or application docs.FYI: the smartcard board cheaps-out on the RS232 signal side by just sending TTL-level signalling (5V/0V) hoping the SP3232 will correctly interpret it (which technically is +/-3V to +/-15V; anything between +3 to -3 is illegal). The receive side just clamps any high voltages to 5.1V, low voltages to -0.7V via zener diodes (which is okay).

author: Rizzrack89
author_rank: Newbie
timestamp: March 08, 2023, 08:00:07 am
content: Thank you!!!!Ill continue it soon, I hope its ok to ask if I get stuck again.