Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add STM32 microcontrollers #363

Open
ghost opened this issue Jun 14, 2022 · 25 comments
Open

Add STM32 microcontrollers #363

ghost opened this issue Jun 14, 2022 · 25 comments
Labels
enhancement New feature or request open for vote Vote at https://wokwi.com/features

Comments

@ghost
Copy link

ghost commented Jun 14, 2022

I suggest adding stm32 support on wokwi to reach more embedded systems developers. Thanks!

@ghost ghost added the enhancement New feature or request label Jun 14, 2022
@urish
Copy link
Contributor

urish commented Jun 14, 2022

Thanks for the feedback! Are you using the STM32 yourself? Can you describe which board / MCU are you working with and what development tools are you using?

@ghost
Copy link
Author

ghost commented Jun 15, 2022

hi Uri,
yes we used stm32 NUCLEO-F401RE before. we used cubeMx back in 2019 but now rather with platformio extension since it offers more features like:

@urish urish changed the title add stm32 microcontroller Add STM32 microcontrollers Jun 15, 2022
@urish urish added the open for vote Vote at https://wokwi.com/features label Jun 15, 2022
@urish
Copy link
Contributor

urish commented Jun 15, 2022

Thanks for the details!

I opened this request for voting.

Do you happen this have an example project with platform io + STM32 that you'd like to be able to simulate on Wokwi?

@prisar
Copy link

prisar commented Jun 20, 2022

adding STM32F103C8T6 would be good for me. I am using this mcu

@urish
Copy link
Contributor

urish commented Jun 21, 2022

Thanks for the feedback, @prisar. What project(s) are you using the STM32F103 for ?

@prisar
Copy link

prisar commented Jun 21, 2022

Not any specific project yet. This is my first chip. I'm using it to learn. Started with things like LED blinking, programming various pins

@urish
Copy link
Contributor

urish commented Jun 21, 2022

This is my first chip

Good luck in your journey! What makes this specific chip appealing for you as a first chip for learning?

@prisar
Copy link

prisar commented Jun 22, 2022

Thank you for providing such a convenient platform to experiment various projects online.

What makes this specific chip appealing for you as a first chip for learning?

I wanted to start with an arm microprocessor because I'm thinking of using some in my future projects. And, it has ARM Cortex-M3. So, I decided to tinker STM32F103

@dzid26
Copy link

dzid26 commented Apr 18, 2023

Thank you for providing such a convenient platform to experiment various projects online.

What makes this specific chip appealing for you as a first chip for learning?

I wanted to start with an arm microprocessor because I'm thinking of using some in my future projects. And, it has ARM Cortex-M3. So, I decided to tinker STM32F103

I saw this:
https://wokwi.com/projects/334824244586218068
But when I upload my binary I get 2% performance and ports aren't set according to my settings, and instead they stay the same as in the demo.
image

EDIT:
Finally, I made it work by making sure the crystal frequency was 8Mhz, as in blue pill. At least that's what I thought.
Because then I reverted back to 16Mhz, and it still works. Wtf.

@urish
Copy link
Contributor

urish commented May 23, 2023

Initial STM32 support is now available!

Starting with NUCLEO-C031C6:

Supported peripherals:

  • Cortex M0+ (including SysTick, NVIC)
  • GPIO
  • USART
  • SPI
  • I2C
  • ADC
  • RCC (partial)

Missing peripherals:

  • CRC
  • DBG
  • DMA
  • EXTI
  • IWDG
  • PWR
  • RTC
  • SYSCFG
  • TIM1/3/14/16/17
  • WWDG

Documentation and new project templates coming soon!

@urish
Copy link
Contributor

urish commented May 27, 2023

Initial docs for the new Nucleo-C031C6 board: https://docs.wokwi.com/parts/board-st-nucleo-c031c6

@urish
Copy link
Contributor

urish commented Jun 11, 2023

Nucleo-L031K6 is now available too: https://docs.wokwi.com/parts/board-st-nucleo-l031k6

@mirkomatontispire
Copy link

Hello,

would it be possible to extend support to other STM32 families like L45X or L4X

@urish
Copy link
Contributor

urish commented Aug 14, 2023

L432KC is available is early alpha: https://wokwi.com/projects/364373191510788097

@mirkomatontispire
Copy link

mirkomatontispire commented Aug 15, 2023

Do you offer paid support/sdk in case we'd like to add custom support to specific boards?

@urish
Copy link
Contributor

urish commented Aug 15, 2023

This is definitely something we can discuss. What's your use case? (we can also discuss over email, if you prefer)

@brightproject
Copy link

@urish Is it possible to add a blue (stm32f103) and black (stm32f401) pill to the project?

@urish
Copy link
Contributor

urish commented Sep 18, 2023

stm32f103 is already partially implemented: https://wokwi.com/projects/334824244586218068

If we see a good business case, we might add the black pill as well.

@brightproject
Copy link

brightproject commented Sep 18, 2023

If we see a good business case, we might add the black pill as well.

As far as I understand, it is not possible to achieve at least approximate speeds for performing certain operations and simulating SRAM memory from a simulator?
I thought that changing ESP32 modules changes the execution time of programs on them, but there is no change.
Therefore, adding a black pill in addition to the blue pill is probably pointless.

@urish
Copy link
Contributor

urish commented Sep 18, 2023

As far as I understand, it is not possible to achieve at least approximate speeds for performing certain operations and simulating SRAM memory from a simulator?

It really depends - some things simulate fast, some things simulate slower. There are also certain optimizations that we can employ for certain use cases. Unfortunately, simulation is not a one-size-fits-all solution: there's always a tradeoff between speed, accuracy and complexity.

@brightproject
Copy link

brightproject commented Sep 18, 2023

As far as I understand, it is not possible to achieve at least approximate speeds for performing certain operations and simulating SRAM memory from a simulator?

It really depends - some things simulate fast, some things simulate slower. There are also certain optimizations that we can employ for certain use cases. Unfortunately, simulation is not a one-size-fits-all solution: there's always a tradeoff between speed, accuracy and complexity.

I would like to simulate some things for esp32 and stm32 at at least 1/4 of the real speed.
But in fact, I get a simulation on ESP32 at a speed 10 times lower than on a real STM32.
For example, the project in the simulator is “executed” on ESP32 at a very low speed.
But on a real stm32 it works great with fps of about 16.

@urish
Copy link
Contributor

urish commented Sep 25, 2023

@brightproject I looked into the project, and done some initial experimentation.

It seems like there are two ways to considerably speed up the simulation:

  1. Skip the full SPI protocol emulation in your project - I assume it'll give us x2 speedup
  2. Use DMA for SPI transactions - I anticipate another speed-up, but it's hard to know how much without trying.

The first item is a kind of optimization that we have to make available in the simulation engine. Instead of transmitting one bit at a time, we will just transmit whole bytes between the simulated MCU and the ILI9341 module.

The second one is something that has to be done in the code that runs in the simulator. Your code currently uses the CPU to write SPI data directly, byte by byte. Using DMA enables to write larger buffers, so it is likely to generate additional speed up.

@Tyrn
Copy link

Tyrn commented Dec 5, 2023

But how can I start a project based on the Blue Pill? The dropdown menus don't offer it.

@urish
Copy link
Contributor

urish commented Dec 5, 2023

But how can I start a project based on the Blue Pill? The dropdown menus don't offer it.

Blue Pill is not officially supported at the moment. You can try to copy from an existing project, but YMMV.

@krr-hws
Copy link

krr-hws commented Oct 1, 2024

Many thanks to the developer of the STM32-devices :) . Is it planned to implement support for hardware timer e.g. TIM1 and TIM3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request open for vote Vote at https://wokwi.com/features
Projects
None yet
Development

No branches or pull requests

7 participants