1
\$\begingroup\$

In my current project, I'm trying to implement a smart card reader using LPC1788 which has a built-in smart card interface. Smart cards use the ISO7816-3 standard to communicate with the outside world. Smart cards need clocks which must be between 1MHz to 5MHz. This clock will be used to generate a baudrate with a fraction that is implemented in the card as default. ISO7816 states that if I connect a 3.58MHz signal to the card, the baudrate will be 9600.

On the other hand, the LPC1788 datasheet states that:

If the smart card to be communicated with requires (or may require) a clock, program one IOCON register for the UART SCLK function. The UART will use it as an output.

Then it states:

Enable the UART clock and set up UART clocking for an initial UART frequency of 3.58 MHz.

So I'm confused! If I set the baudrate to 9600 and program UART SCLK , will I get 3.58 MHz?

What does it mean by: "set up UART clocking for an initial UART frequency of 3.58 MHz"?

How can I do that?

\$\endgroup\$
0
\$\begingroup\$

You have to apply a clock to the smart-card. The baudrate used for communication is clockrate/372. So for a clock of 3.58Mhz you'll end up with a baud-rate of 9632.6 That's close enough to be read by an ordinary UART.

If you configure the UART for smart-card IO then you have to program the clock pin for UART functionality. If you don't it's just a ordinary GPIO.

Once done it will start to output the clock signal as defined in the baudrate registers. The actual communication will run with the slower (divided by 372) frequency.

The chapter is a bit misleading because in the manual they use baud-rate for both the clock and the acutal transmission speed.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ thanks for your answer but I mixed up again! Should I connect the clock pin from Micro to smart card clock pin?if yes is it clock in 3.58Mhz?if no so what is the use of this pin? \$\endgroup\$ – Alireza Jan 6 '18 at 11:13
  • \$\begingroup\$ Yes, connect the smart-card clock-in pin to the UART clock-out pin. The frequency should be around 3.58Mhz. The reason why all this stuff exist is, that smart-cards are so thin and cheap that they can't generate a proper clock signal on their own. That's why you have to feed in a time-base from the outside. \$\endgroup\$ – Nils Pipenbrinck Jan 6 '18 at 13:31
  • \$\begingroup\$ I tested your word on clock but that wasn't true or I made a mistake.I set the buadrate to 9600 in smart card mode and I measure the clock with Oscilloscope and I see the frequency of 153.6KHz . What's the problem \$\endgroup\$ – Alireza Jan 8 '18 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.