cancel
Showing results for 
Search instead for 
Did you mean: 

Minimal MCU spec or smallest/cheapest STM32 for implementing ISO7816

pkolarov
Associate II

Hello to all, 

Our design is using STM32F042G6 MCU to implement STSW-STM32011 firmware interface based on STM32Cube which implements ISO7816 protocol for us to talk to smart card. Unfortunately it does not seem to move beyond ATR.

Is our MCU we use not good enough to support this FW, can it support only T=0 without T=1? If not good enough, what is the minimal MCU that would support the above FW or similar for ISO7816 over USART?

Thanks for your help, 

Peter

14 REPLIES 14
Andrew Neil
Chief III

@pkolarov wrote:

Our design is using STM32F042G6 MCU to implement STSW-STM32011


So this: https://www.st.com/en/embedded-software/stsw-stm32011.html

It says it's for STM32F10x and STM32L1xx:

 AndrewNeil_0-1708430382042.png 

 so you're going to have to do some porting for your F0.

Here's a Migration Guide from STM32F1 series to STM32F0 series:

AN4088, Migrating between STM32F1 and STM32F0 series  microcontrollers: 

https://www.st.com/resource/en/application_note/an4088-migrating-between-stm32f1-and-stm32f0-series-microcontrollers-stmicroelectronics.pdf

See also AN3364, Migration and compatibility guidelines for STM32 microcontroller applications:

https://www.st.com/resource/en/application_note/an3364-migration-and-compatibility-guidelines-for-stm32-microcontroller-applications-stmicroelectronics.pdf

 

Thanks Andrew! I made a small mistake, we have actually used FW example from note AN4800. Which mentions F0 directly though for some reason L0 is mentioned as the only one supporting T=1 protocol.

So we are trying now a reference dev kit (with L0) to get working sample.  We have directly connected IO to smartcard pins without translator chip so I hope that is not some major issue for testing. For now we do get ATR but after waiting for response to command in HAL_SMARTCARD_Receive we just time out. So the card does not seem to answer further. Is there some good reference card or initial command we could use to test the example? card.jpg

I don't have experience with the smartcard protocol on STM32, but to clarify things, are you trying to use 'F0 or 'L0?

The general description for both in RM appears to be identical, though:

waclawekjan_0-1708434738823.png

 

JW

We have this AN4800 

4bd1b56e-7d2c-4710-a915-879cee963168.png

 

 


@pkolarov wrote:

We have directly connected IO to smartcard pins without translator chip so I hope that is not some major 


So what voltage is the card?

Not sure that it's a great idea to solder directly to the card like that - looks like high risk of damaging the card!

It also means that you can't pop the card into a "standard" reader to confirm that it is still working.

Do you have a logic analyser to see what's going on ?

 

 

AN4800 is not a generic smartcard appnote, but a specific manual to the X-CUBE-SMCARD firmware.

So, "L0" there just means, that from the selection of microcontrollers this firmware is aimed at (An application example based on STM3210B-EVAL, STM3210E-EVAL, STM3210C-EVAL, STM32L152C-Discovery and STM32L0538-Discovery evaluation boards), only 'L0 supports T1.

But that also means, that unless you want to read the manual and develop software yourself, and instead just rely on what's already ready, namely X-CUBE-SMCARD, then you have to stick to these boards.

If I'm not mistaken, it's STM32L0538-Discovery what you have on your foto above. So, do you want to use 'F0 or 'L0?

Also, if you want to use software without attempting to understand what does it do, you have to use also the hardware used to develop that software. AN4800 in chapter 3 Smartcard reader hardware connection says:

To interface to the Smartcard, the ST8024 device was used.

So, you should start replicating that hardware, if you want to use the related ready-made software; and then, from understanding of what's going on, proceed, perhaps towards reducing the requirements.

As I've said, I have no personal experience and have no intention to guess, whether some software does or does not rely on given hardware; that's basically the core of your job at the moment.

JW

Yes, we have fixed the soldering card issue meanwhile and put in some card reader connector to test multiple cards. We have found cards that present themselves with T=0 protocol in ATR and those seem to work fine returning some response to commands. But cards (most of them now) that only support T=1 dont give any response yet. We may have to go down the logic analyzer route but I was wondering if T=1 should work on the dev kit with L0 or its not really well tested with the setup above.

In our design we use F0 but we decided to test now with the STM32L0538-Discovery which is what AN4800 references and hoping T=1 would be supported there. But it looks like T=1 does not quite work there too (T=0 card seems to work ok.) Missing ST8024 should not affect protocol level issues, even note seems to imply so. 

Hello,

If I recall, originally this firmware was developed internally by myself in 2009 or 2010 😉 and it was on the first STM32 released: STM32F103. Its UART doesn't feature T=1 but it runs well on it. The FW was reworked and packaged in an application note (AN4800) by another guy and released on the web years later 🙂

So yes you can run ISO7816 T=0 and T=1 on any STM32 (unless it doesn't have any UART.. which is not the case)

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.