Page 1 of 1

Help me port a STM32CubeIDE project to Arduino with STM32duino core

Posted: Mon Mar 14, 2022 12:27 pm
by razvitm
Hi,

I am still stuck with Arduino, haven't learned other IDEs, and the libraries I use are for Arduino, and I found a project that I want to run on a Black Pill, STM32F103C8T6 board, that I will modify to work with other hardware modules.
I installed STM32CubeIDE and run the project, it compiles without error and works.
Can someone please take the code from the project and turn it into an Arduino sketch for the latest STM32 core for arduino?

The project is at:
https://deepbluembedded.com/stm32-timer ... terfacing/

Thank you in advance!

P.S.
Or tell me how to do it...

Or point me to an example of encoder quadrature signals being hardware decoded with a STM32 in Arduino using STM32duino core...

Re: Help me port a STM32CubeIDE project to Arduino with STM32duino core

Posted: Wed Mar 16, 2022 11:09 am
by razvitm
From what I understand by reading the source code from this project, it declares functions to use the serial port and IO pins and Hardware Timer, but STM32duino already has these functions in the core.
Basically I need to set up one of the hardware timers in encoder mode and serial print the "distance". And do all this in Arduino with STM32duino latest core installed in boards manager.
Can anybody help me?

Re: Help me port a STM32CubeIDE project to Arduino with STM32duino core

Posted: Wed Mar 16, 2022 11:12 am
by ag123

Re: Help me port a STM32CubeIDE project to Arduino with STM32duino core

Posted: Wed Mar 16, 2022 2:09 pm
by razvitm
Yes, the core's hardware_timer doesn't support encoder mode.

Re: Help me port a STM32CubeIDE project to Arduino with STM32duino core

Posted: Thu Mar 17, 2022 8:15 am
by fpiSTM
You can refers to this example which port an STM32Cube IDE project:

viewtopic.php?f=41&t=110


Some useful link:
https://github.com/stm32duino/wiki/wiki ... odule-only
https://github.com/stm32duino/wiki/wiki ... uild_opt.h

Re: Help me port a STM32CubeIDE project to Arduino with STM32duino core

Posted: Thu Mar 17, 2022 8:48 am
by ag123
HardwareTimer API supports basic use of the hardware timers.
For more elaborate modes, you may need to assess the registers directly. I think it may be possible to use them HardwareTimer API and registers in combination.