cancel
Showing results for 
Search instead for 
Did you mean: 

Smartcard mode

ari_v
Associate II
Posted on May 20, 2009 at 04:17

Smartcard mode

17 REPLIES 17
ari_v
Associate II
Posted on May 17, 2011 at 12:37

Hi,

I have a problem to receive data on USART3 when using the smartcard mode. IO line is connected to Port B.10.

I put USART3 into smartcard mode and I can send data via TX interrupt.

The card responds to my message but incomming data it is not recognised by the reciever. Meanning, that the flag RXNE remains low, even though RX interrupt is enabled, and port is configured to alternate-open drain.

What am I missing? Any suggestion?

Thanks,

Ari

16-32micros
Associate III
Posted on May 17, 2011 at 12:37

Hi Ari_v,

I presume that you have to configure USART Rx Line as ''Input Floating'' as it is used for reception.

/* Configure USART3 Rx (PB.11) as input floating */

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

GPIO_Init(GPIOB, &GPIO_InitStructure);

Cheers,

ST1 🙂

ari_v
Associate II
Posted on May 17, 2011 at 12:37

Thanks for reply.

I probably didn't explain enough.

The smartcard mode is used so PB.10 is used as bidirectional port, also for the RX. Therefore, the RX (PB.11) is used as regular GPIO.

Some more details:

IO line is connected to Port B.10 – port is configured to alternate-open drain.

USART3 is put into smartcard mode.

USART3 RX ant TX interrupts is enabled.

Data is sent properly to via TX interrupt. And then TX interrupt is disabled.

The card responds as expected to my message. (With the same setting as outgoing message in terms of baud rate, 8 data bits, 1 stop bit, no parity).

...

This leads me to the conclusion that USART3 is put properly into smartcard mode…

USART3 does not recognize the incoming data, meaning that the flag RXNE remains low.

What am I missing?

BTW, the reference manual mentions: ''… SW_RX must be connected on the same I/O than TX at product level''. I understand that configuring the USART to smartcard mode covers this issue. Is this correct?

Thanks,

Ari

ari_v
Associate II
Posted on May 17, 2011 at 12:37

Hi,

It seems to me that smart card IO needs to be connected only to the TX pin, and this pin functions as a bidirectional uart when put in to smartcard mode.

Could anyone confirm that RX and TX need to be tied in smartcard mode?

Thanks,

Ari

jj
Associate II
Posted on May 17, 2011 at 12:37

From latest version of RM0008:

''To do so, SW_RX must be connected on the same I/O than TX at product level.'' Due to your inability to receive - I wonder if this statement means that you must tie PB10 and PB11 together? (don't see ''how'' PB10 can be ''forced'' into a receive mode)

Also note that during receive you must configure for 0.5 Stop Bits.

(this all theory - haven't this hardware)

Good luck - plz post your outcome...

ari_v
Associate II
Posted on May 17, 2011 at 12:37

Hi,

I posted my question regarding smartcard mode to ST support and i recieved the following:

================================

=> yes this is correct. This is done at product level once the smart card mode is enabled this is the RX and TX are connected internally, the user does not have to connect by hardware SW_RX to TX. We confirm only the TX is used for smart card IO and should be configured as alternate open drain. The PB.11 RX pin can be used as normal GPIO.

Customer may check his hardware. I would suggest to refer to the Smart card Application note (AN2598 in attachment) as software and hardware guideline.

================================

I still have the problem to collect incomming data from smartcard.

I can see on scope data comming in from smartcard on the TX_RX pin (PB.10), but RXNE flag does not rise... as though UART ''thinks'' that he is in transmit mode.

If anyone has an insite, I'll be happy to hear!

Thanks,

Ari

asterix
Associate II
Posted on May 17, 2011 at 12:37

Hi Ari,

Have a look at :

http://www.st.com/stonline/products/literature/an/13750.pdf

http://www.st.com/stonline/products/support/micro/files/an2598.zip

then Go to ''Smartcard_AN/source'' subfolder and finally to ''smartcard.c'' file.

Regards,

Magigimix

alex_bauer80
Associate II
Posted on May 17, 2011 at 12:37

Hello Ari,

I have the same problem on an STR71xxx. Did you solve the above mentioned problem with the smartcard? If yes, please let me know how.

Thanks

Alex

cs20046230
Associate
Posted on May 17, 2011 at 12:37

Refer DOC13902 STM32 reference manual 24.3.10 smartcard,

''In Smartcard mode an EMPTY transmit shift register triggers

the guard time counter to count up to the programmed value

in the Guard Time register.''

So you should fine tune your Guard Time register to fit your

card. The AN2598 sets to 16. This is not suitable for each

type of cards. The value is depend on how fast your card can

endurance and response. Too much Guard Time value will eat

your RX data actually.

Mark