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
Hi Anton Rudomanenko,
It seems your baudrate calculate code have the problem, please refer to the user manual, this baud rate calculation formula:
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!
-----------------------------------------------------------------------------------------------------------------------
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)
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!
-----------------------------------------------------------------------------------------------------------------------