UART smart card mode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

UART smart card mode

1,793 次查看
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

标签 (3)
标记 (4)
0 项奖励
回复
3 回复数

1,524 次查看
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!
-----------------------------------------------------------------------------------------------------------------------

1,524 次查看
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 项奖励
回复

1,524 次查看
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 项奖励
回复