cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U585 Smart Card Communication

PJose.4
Senior

Hi All
We are testing the STM32U585 Smart Card mode with clock and trying to connect with external SAM module. We are able to get the USART-ISO7816 frame format from the controller but we are unable to capture the ATR value from the module in a correct manner. From the logic analyzer with the setup connected we are getting correct ATR values but inside the controller the ATR values are in the wrong format. Following is the expected card ATR response:

PJose4_0-1687771024546.png


This waveform is obtained from the card reader connected to the STM32U585 board. and the ATR waveform is the correct format as described in the standards. the same signals we are capturing in the STM32U585 debug mode and getting the data as shown in the below figure.

PJose4_1-1687771062858.png


We have used the Smart Card with card clock mode in STM32 side with the following configuration:

  /* USER CODE END USART3_Init 1 */
  hsmartcard3.Instance = USART3;
  hsmartcard3.Init.BaudRate = 9758;
  hsmartcard3.Init.WordLength = SMARTCARD_WORDLENGTH_9B;
  hsmartcard3.Init.StopBits = SMARTCARD_STOPBITS_1_5;
  hsmartcard3.Init.Parity = SMARTCARD_PARITY_EVEN;
  hsmartcard3.Init.Mode = SMARTCARD_MODE_TX_RX;
  hsmartcard3.Init.CLKPolarity = SMARTCARD_POLARITY_LOW;
  hsmartcard3.Init.CLKPhase = SMARTCARD_PHASE_1EDGE;
  hsmartcard3.Init.CLKLastBit = SMARTCARD_LASTBIT_DISABLE;
  hsmartcard3.Init.OneBitSampling = SMARTCARD_ONE_BIT_SAMPLE_DISABLE;
  hsmartcard3.Init.Prescaler = 22;
  hsmartcard3.Init.GuardTime = 0;
  hsmartcard3.Init.NACKEnable = SMARTCARD_NACK_DISABLE;
  hsmartcard3.Init.TimeOutEnable = SMARTCARD_TIMEOUT_DISABLE;
  hsmartcard3.Init.BlockLength = 0;
  hsmartcard3.Init.AutoRetryCount = 0;
  hsmartcard3.Init.ClockPrescaler = SMARTCARD_PRESCALER_DIV1;
  hsmartcard3.AdvancedInit.AdvFeatureInit = SMARTCARD_ADVFEATURE_NO_INIT;

This is the first time we are working with ISO7816 protocol. We need the guidance from the team to find were we went wrong either in the configuration side or in any other side. Awaiting your valuable support in this regard.
Thanks and Regards
Psj

13 REPLIES 13
Guenael Cadier
ST Employee

Hi @AdarshTR 

GPIO configuration seems ok.
Yes, STM32U575 evaluation board (MB1550) includes a ST8024 between STM32U575 USART IO and card connectors. Schematics of the board could be found here.

Please click on

GuenaelCadier_0-1688021508256.png

Hope this helps

Bubbles
ST Employee

Hi, there's also the AN4800 and X-CUBE-SMBUS example. It's not directly working with STM32U5, but it should be reasonably easy to port the SW and it may be helpful.

BR,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @Bubbles,

I think it is X-CUBE-SMCARD which you are referring to.

Regards,

Hello @AdarshTR ,

yes, of course. Thanks.

At least I got the AN number correct.

BR,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.