UART smart card mode

cancel
Showing results for 
Search instead for 
Did you mean: 

UART smart card mode

687 Views
rudomanenko
Contributor II

Hello! I'm try to implement connection between LPC11u12 and smart card via UART. To provide the right clock to the smart card I should to fill UART DLL and DLM registers this way:

uint32_t divider = ((( sys_clk / ((scale) / 2) ) / baudrate) + 1) >> 1;

LPC_USART->DLM = (divider >> 8) & 0xff;     
LPC_USART->DLL = divider & 0xff;

It is work correctly. But (scale/2)/baudrate it is a card clock and initialy equal to 3.57MHz. When I change this equation to value in Hz, it doesnt work. It is stgange, bacause value of divider with equation and value are absolutely the same! Where is a mistake??

P.S. I saw the LPC example

Labels (3)
0 Kudos
3 Replies

418 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Anton Rudomanenko,

   It seems your baudrate calculate code have the problem, please refer to the user manual, this baud rate calculation formula:

pastedImage_1.png

To get your DivAddval, MulVal, DLM, DLL.

Then test it again.

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

418 Views
rudomanenko
Contributor II

Thanks, Kerry, but unfortunately this formula is invalid in case of smart card mode.I've already slove this problem (there are some mistakes in anither part of firmware). Maybe it should be usefull to know: when we speak about smart card the 16 in divider in this formula shlould be changed to Fi/Di (ISO7816-3)

0 Kudos

418 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Thanks for your updated valuable information.

Yes, maybe the user manual really also need to add the according formula for smart card.

Anyway, thanks a lot for your information.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos