2023-06-09 07:41 AM
Hello,
I am looking at the smartcard example application - https://github.com/STMicroelectronics/STM32CubeG4/tree/master/Projects/STM32G474E-EVAL/Examples/SMARTCARD/SMARTCARD_T0_MFX
In the project .ioc file, I see that the Baud Rate is set to 10752 Bits/s, and the smartcard clock frequency is 3.863636 MHz.
How was that baud rate calculated/determined, considering the above clock frequency?
Thank you,
D.
Solved! Go to Solution.
2023-06-09 08:55 AM
Hi @Community member
I'm trying to explain the method, even if I think the baudrate in the example has to be adjusted.
In your project, you have USART3 clocked with PCLK2 at 170Mhz. On this, a Prescaler (value 22) is applied, leading to have SCLK signal supplied to Smartcard equal to 170/(22*2) => 3.86Mhz.
At startup, communication with smartcard will be based on a F/D ratio of 372/1 (372 clock cycles per etu). This 372/1 ratio in G4 SMARTCARD ip (USART3) is achieved by implementing a corresponding baudrate of 3.863636/372 => 10386.
So in my opinion, I think the exact value of the baudrate to be set in USART3 configuration in Smartcard mode, with a initial clock of 170Mhz, a prescaler equal to 44 (22*2), should be 10386 (rather than 10752).
10752 is applied in case of SCLK at 4Mhz. with 3.86Mhz, 10386 is better.
Hope this helps.
2023-06-09 08:55 AM
Hi @Community member
I'm trying to explain the method, even if I think the baudrate in the example has to be adjusted.
In your project, you have USART3 clocked with PCLK2 at 170Mhz. On this, a Prescaler (value 22) is applied, leading to have SCLK signal supplied to Smartcard equal to 170/(22*2) => 3.86Mhz.
At startup, communication with smartcard will be based on a F/D ratio of 372/1 (372 clock cycles per etu). This 372/1 ratio in G4 SMARTCARD ip (USART3) is achieved by implementing a corresponding baudrate of 3.863636/372 => 10386.
So in my opinion, I think the exact value of the baudrate to be set in USART3 configuration in Smartcard mode, with a initial clock of 170Mhz, a prescaler equal to 44 (22*2), should be 10386 (rather than 10752).
10752 is applied in case of SCLK at 4Mhz. with 3.86Mhz, 10386 is better.
Hope this helps.
2023-06-09 10:25 AM
Hi Guenael,
Thank you for explaining.
I was calculating 10386 as well, and was confused why the demo uses 10752.
Best regards,
D.
2023-06-12 12:11 AM
@Community member
FYI, I submitted an internal ticket (154558) to get this corrected in next STM32Cube G4 package.