cancel
Showing results for 
Search instead for 
Did you mean: 

USART - no NACK output

DGabc.1
Associate III

Hello,

I am trying to use STM32L476 to interact with a Smartcard.

I am using USART1 in "SmartCard with Card Clock" mode.

I have the "NACK If Parity Error" enabled.

I am having a problem where the USART receiver detects parity error on the line, but does not bring the line low. I know the PE is detected because USART1->ISR.PE bit is set, but reception proceeds regardless.

I am using ST8034P between the MCU and the smartcard.

I have a logic analyzer connected to the MCU USART1_TX pin (PA9).

My card clock is 1.6MHz, and the baud rate is 4301 Bits/s.

In the waveform captured by the logic analyzer I can clearly see the data that is received, with incorrect parity, and that the TX line stays high, after receiving 1+8+1 bits (start + data + parity). See attached image io-001.jpg:

Moment T is when the start bit is received. Moment A is at the 10 etu point in time (1 etu = 0.2325ms). Time from T to A is 2.325 ms.

Moment B is when the start bit from the second byte, from the card, is received. Time from A to B is ~ 3 etus.

I am also attaching the sample project I used.

I am trying to find out the following:

  1. Why NACK is not output/present on the TX line?
  2. Why the reception continues after parity error is detected?

Thank you,

D.

1 REPLY 1
DGabc.1
Associate III

I think I figured it out. It looks like, for both questions, the setting "Number of retries in receive and transmit mode" is what controls the behavior.

If number of retries is 0 (as I have it), then no NACK.

Changing the setting to 1 or higher, results in NACK being generated.