2024-02-20 03:27 AM
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
2024-02-20 04:00 AM
@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:
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:
See also AN3364, Migration and compatibility guidelines for STM32 microcontroller applications:
2024-02-20 05:06 AM - edited 2024-02-20 05:09 AM
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?
2024-02-20 05:09 AM - edited 2024-02-20 05:12 AM
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:
JW
2024-02-20 06:14 AM
We have this AN4800
2024-02-20 06:29 AM
@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 ?
2024-02-20 06:29 AM - edited 2024-02-20 06:30 AM
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
2024-02-20 07:43 AM
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.
2024-02-20 07:51 AM
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.
2024-02-20 08:40 AM - edited 2024-02-20 09:27 AM
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)