1
\$\begingroup\$

I need to create STM32L0 firmware for communication with a smartcard (ISO 7816). I will use Tx pin from USART2.

Is STM32CubeMX helpful for setting smartcard related stuff?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ The Cube thing can help you make the basic SW skeleton, such as setting up peripheral pins and clocks. But in reality I would suggest you to write it from scratch and structure the code the way you want it. Surely you can use the Cube output as a reference. \$\endgroup\$
    – Eugene Sh.
    Jan 16, 2018 at 18:07

1 Answer 1

1
\$\begingroup\$

As mentioned earlier, STM32CubeMX creates a project directory and generates all the files you need to set up the peripheral pins and clocks. In addition, the Cube generates files for the HAL (Hardware Access Layer).

In terms of using the TX (which I am thinking you mean UART?), you could use the HAL functions to use the UART.

[Conversely, you could write your own functions and set registers but the path of least resistance is to use their library, which is what I am sensing is the goal here?].

The HAL is a whole bunch of source files and headers that STMicro wrote, that allows you easy access to set the UART configuration you need and then send actual data out of the UART.

Here is a link to a STM HAL UART TUTORIAL showing you the basic usage of the STM HAL for UART.

There's definitely a learning curve, to seeing how all these pieces link up.

Once you are sending data from the UART TX pin, hook it up to your smartcard and than you get to read the smartcard documentation on how to commnicate to it.

Good luck, you'll learn a lot if this is your first time doing this.

\$\endgroup\$
1
  • \$\begingroup\$ There's lots of tutorials on the STM HAL functions and samples how to use them. They are probably the best way to get started. Once you get it working, I recommend deep diving in to "why" the things work the way they do. Once you get into the why, you can start seeing how writing your own functions might be more efficient. \$\endgroup\$
    – Leroy105
    Jan 16, 2018 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.