Questions tagged [stm32cubemx]
Anything related to the STM32CubeMX. It is a program to ease developers' life by reducing development efforts, time and cost. STM32Cube covers the STM32 portfolio.
223
questions
33
votes
7
answers
105k
views
How do I use the printf function on STM32?
I am trying to figure out how to use the printf function to print to the serial port.
My current setup is STM32CubeMX generated code and SystemWorkbench32 with the STM32F407 discovery board.
I see ...
15
votes
6
answers
22k
views
Why not always use DMA in favor of interrupts with UART on STM32? [closed]
I spend last month a lot of time getting UART (for MIDI) to work with an STM (STM32F103C8T6) using interrupts, without very much success.
However, this evening using DMA it worked quite fast.
Since ...
10
votes
8
answers
48k
views
STM32: Busy flag is set after I2C initialization
For the reference: the same problem is described there, but the author's solution doesn't work for me - I2C busy flag strange behaviour
I used STM32CubeMX to generate project template with I2C ...
9
votes
1
answer
5k
views
STM32 interrupts and C++ don't go well together [duplicate]
I set up TIM3 to fire an interrupt in my project and it just wouldn't work. I tried everything I could and still couldn't find whats the problem. Then I created a clean project and copy/pasted only ...
8
votes
7
answers
82k
views
Getting PWM to work on STM32F4 using ST's HAL libraries
I'm trying to switch to the ST HAL libraries and can't seem to get the PWM to work. Compiles fine, just doesn't start.
In my main() I call the Timer initialization function:
...
8
votes
3
answers
3k
views
STM32 - How does analog configuration of MCU pins affect the power usage?
When I was creating a new project using the STM32CubeMX, I saw a check box stating that setting all free pins as anlog will decrease the power consumption. I couldn't figure out how it works. How can ...
8
votes
1
answer
13k
views
Cube IDE : Error: unknown type name 'HAL_StatusTypeDef'
I am taking code from a stm32f0 series and trying to convert it to a stm32l4 series dev kit. I have already changed the necessary addresses and include files that I needed to migrate, but I keep on ...
8
votes
4
answers
21k
views
Toolchains for STM32CubeMX IDE: what to choose from?
I just installed the STM32CubeMX (original ST Microelectronics's ARM IDE if I understand right). Once installed I tried to open a new project for a DISCOVERY kit I have (STM32F0DISCOVERY).
Howether ...
7
votes
1
answer
4k
views
LED blinks even when I don't press the button
I have written a program in Keil that blinks a LED via External GPIO Interrupt. Here is how I have configured it in STM32CubeMX:
At first, I enabled and configured RCC as you can see and configured ...
7
votes
2
answers
11k
views
FreeRTOS on STM32 - What API should be used: CMSIS-RTOS API (v1 or v2) or FreeRTOS API? [closed]
According to ST's user manual UM1722 "Developing wireless applications on STM32Cube with RTOS" there are two APIs available:
Generic CMSIS-RTOS API (v1 or v2)
FreeRTOS API
The CMSIS-RTOS API ...
6
votes
5
answers
17k
views
I2C busy flag strange behaviour
I've been using STMCUBE combined with Keil for some time now. For most part I like the HAL library and the documentation for STM32f1xx drivers is quite good.
I'm doing a project where I am using ...
4
votes
4
answers
4k
views
Did I kill my STM?
I have (had?) an STM32F429ZI. I was working with the ADC on PC0 and due to a hardware malfunction, 12V ran through the pin when the maximum voltage an ADC pin supports is 3V. Since then, whenever I ...
4
votes
2
answers
6k
views
Why does __libc_init_array cause an exception?
After a long time trying to debug why my simple blinky code for my STM32F446RE microcontroller was not working i discovered a line in the bootup assembly file that i was linking to it which was ...
4
votes
1
answer
701
views
Why operations on float variable are performed on a double? STM32F401RE, MDK-ARM v5
I am debugging a simple line of code:
float temp_f;
...
...
temp_f= temperature[0] +(temperature[1] >> 5)*0.125;
that is assembled into
...
4
votes
3
answers
2k
views
How to debug current consumption with STM32 Nucleo board?
I'm trying to configure an STM32L011-Nucleo developement board to consume about 600 uA of current or so. It uses an STM32L011K4.
The datasheet states that this should be possible if I drive the MCU ...
4
votes
2
answers
993
views
Jitter of UART TX pin
I'm developing a small robot using the STM32L152C Discovery board. I'm currently trying to configure the board using the STM32CubeMX. I've never worked at this very-low level (my experience is much ...
4
votes
3
answers
36k
views
How to read from multiple channels of the ADC on an STM32F407?
I am working on a project wherein, I need to read the Analog outputs from 4 sources and convert them to a digital value using a single ADC module on the STM32F407 microcontroller. I want to sample the ...
4
votes
1
answer
664
views
Why does STM32 use a two-stage initialization process? What is the primary purpose of each stage?
I'm learning to use STM32 microcontrollers using CubeMX to generate a project. I've noticed that CubeMX generates two basic stages of initialization for nearly every peripheral:
(A) Within the ...
4
votes
1
answer
3k
views
STM32F303 STM32CubeMX __HAL_TIM_SetCompare macro does not exist
I am using CubeMX to generate code for my NucleoF303. I am a bit confused how to set the pulse width of a timer in PWM mode.
Previously (using an F4) there has been a __HAL_TIM_SetCompare macro in ...
4
votes
1
answer
3k
views
stm32 which timer and DMA channel should I use?
I am trying to control two lines of digital LEDs (WS2812b) with my STM32F103 using Timers with DMA and PWM. LED strips data lines are connected to PB5 and ...
4
votes
0
answers
4k
views
UART reception problem when SysTick Interrupt is enabled
I'm using a STM32F411RE-Nucleo board and generating a project with Cube MX for System Workbench. The problem is that HAL_UART_Receive function doesn't receive input ...
3
votes
3
answers
26k
views
STM32 HAL UART transmission
I'm trying to send data by STM32f103 to an Arduino board using UART. Data isn't received properly. The code is generated using STM32CUBEMX and here is the part I added:
STM32 code (Transmit):
...
3
votes
3
answers
14k
views
STM32 USART 1-wire communication
I'm fairly new to embedded developping and I'm trying to read and write to a 1-wire device (DS18B20) using USART.
After digging around I found two alternatives:
Connecting USART RX and TX pins with ...
3
votes
2
answers
729
views
Multiple(five) alarm time setting in stm32f0 mcu
I am working on my hobbyist project and need to develop the alarm timings.
And RTC and Timer are new for me and I am confused in RTC Alarm time setting.
I need to make alarm with RTC for five ...
3
votes
5
answers
3k
views
USB on STM32F107RCT and Stm32CubeMX
I have STM32f107 MCU soldered on custom board. I would like to use USB peripheral in CDC mode. I connected pins PA11 (D-), PA12 (D+) and GND directly to a USB CDC cable which leads to the computer. ...
3
votes
1
answer
3k
views
single or multiple interrupt handlers in stm32
I am coming from 8-bit world to 32-bit world specifically stm32f103.
At present I am only doing study and discussion with my fellows to know the major differences in the two worlds and also to select ...
3
votes
1
answer
1k
views
STM32 USB HID Keyboard skipping key presses
I have an STM32F3DISCOVERY evaluation board which has an stm32f3 mcu on it. I am trying to use the board to emulate a USB keyboard.
I used the STM32CubeIDE to enable USB communication, configure the ...
3
votes
1
answer
5k
views
STM32F3DISCOVERY board using STM32CubeIDE download fails "No ST-LINK detected!" but CubeProgrammer works
Using the STM32CubeIDE with an STM32F3DISCOVERY board I was able to use the Run menu option to download and start running a program. After a Windows Update which involved updating USB drivers, the Run ...
3
votes
1
answer
3k
views
how to enable FPU in cubemx
For STM32F407 Discovery board how do I enable its FPU from CubeMX?
The following instruction is used in handwritten code. How can I get it generated from CubeMX?
// Enable FPU
SCB->CPACR |= ...
3
votes
1
answer
377
views
Can't run code in Keil for STM32L433RCT6P on NUCLEO-L433RC-P
Recently at Embedded World 2018 in Nuremberg I got, for free, NUCLEO-L433RC-P with STM32L433RCT6P chip onboard. I want to broaden my knowledge in STM32 chips. Before, I did simple stuf on STM32F4.
...
3
votes
1
answer
10k
views
STM32F4 HAL Library Button Interrupt
I'm trying to toggle built in LED with external interrupt instead of while loop. Probably I'm doing something wrong with EXTI functions. Can you help me to fix it?
...
3
votes
2
answers
2k
views
Why doesn't my program execute (work)?
I have bought this board for working on Cortex-M0 series microcontrollers. its MCU is STM32F030F4P6. this is the board:
and its schematic:
I used STM32CubeMX for configure the MCU and then used MDK-...
3
votes
1
answer
4k
views
STM32CubeIDE HAL_Delay not working
I am trying to toggle the GPIO port 8 with:
...
3
votes
1
answer
4k
views
STM32L4 USB Device with VBUS Sensing
I'm trying to get the CubeMX generated sample CDC application working on STM32l475VG IoT board.
By following a document from ST Community, I was able to get the clock configuration right and the CDC ...
3
votes
1
answer
448
views
PWM event each second not works STM32F4
I have a STM32F429 Discovery and wants set a PWM to toggle led with period of 1 second using Timer 1, channel 1.
So, I follow this equation:
My clock APB1 is set to 1MHz.
So by my calculations I ...
2
votes
2
answers
625
views
Implementing direct digital synthesis in STM32 microcontroller
I am working on a project that requires phase locking (digitally) of an output signal from a sensor to the reference signal which needs to be done on STM32 microcontroller. I am new to this area, and ...
2
votes
1
answer
1k
views
I2C problem on STM32F303 processor, what is happening with SDA?
I am trying to add an I2C display to my remote control drone. I can't get the display to work. I took the same code and copied it to a stm32f303k8 nucleo and got the display to work. I moved the ...
2
votes
1
answer
469
views
Can I use the same serial1 port to communicate with two modules?
My MCU is STM32L432KC, it has two serial ports 1 and 2. But I’m wondering if I can use the same serial port1 only to communicate with two modules (not on the same Tx & Rx pins but 4 different pins ...
2
votes
1
answer
9k
views
STM32F - how to config DMA transfer to SPI triggered by Timer?
I am trying to make a project with the STM32F746ZG Nucleo board using the DMA to make a transfer of 16-bit values to a DAC connected to the MCU by SPI. I am using the STM32CubeMX to generate the init ...
2
votes
1
answer
128
views
Activate VREF+ pin on STM32L073VBT6
I would like to read ADC over STM32L073VBT6. When I try this, I see that the value is always 4095 and does not change (expected to be 0 or close to it). While searching for the error I noticed that ...
2
votes
1
answer
767
views
Where does STM32CubeMX generate AF GPIO initialization?
i was wondering where does CubeMX (when you export it to an IDE such as Atollic) generate GPIO initialization for alternate functions such as Timer capture pins, UART pin ect. (we are talking about ...
2
votes
3
answers
15k
views
HAL_CAN_Transmit_IT and HAL_CAN_Receive_IT simultaneously use problem
Synopsis: STM32 HAL Library functions HAL_CAN_Transmit_IT and HAL_CAN_Receive_IT can't be used simultaneously effectively ...
2
votes
1
answer
9k
views
STM32F4 - Reading general purpose timer count
I'm using the STM32F4 HAL library on an emulated [in QEMU] STM32F4 Discovery board, and trying to configure TIM2 (general purpose timer) and read its' count register (without an interrupt). Currently ...
2
votes
1
answer
338
views
STM32G0 Stuck on SMBUS Slave
This question has been "self answered". Please see answer below.
I am trying to communicate with SMBUS Master and Slave configuration on both STM32G070RB (NUCLEO Boards). So the master ...
2
votes
1
answer
1k
views
STM32 : set APB1 and APB2 to same clock frequency
When configuring a STM32 (or at least my STM32F722ZE based nucleo board), there are 2 clock frequencies, one for APB1, the other for APB2. The annoying thing is that some timers use APB1, other use ...
2
votes
1
answer
2k
views
Configuring STM32 timer as frequency counter
I am trying to configuring one of the timer inputs on a STM32 to behave as a frequency counter for an external signal. The STM32 datasheet describes a "input capture mode" in section 17.3.6 (page 342)
...
2
votes
1
answer
3k
views
STM32L1xx HAL_GPIO_Init Problem
I am developing an application for a University project on my STM32L1DISCO board with the STM32L152RC MCU.
I have configured the pins and generated the init code via STM32CubeMX. I am using Atollic ...
2
votes
1
answer
281
views
STM32F746 Clock not reporting as expected
I'm using an STM32F746VGT6 microcontroller configured from STM32CubeMX for all the clocks and I'm getting roughly 220% higher clock rates when compiled.
For instance I have an HSE crystal at 11....
2
votes
1
answer
1k
views
Booting modes of STM32 microcontrollers
I am creating a custom board and using STM32F303 chip. I have looked into the datasheet and there are 3 boot modes and according to the datasheet the bootloader resides in the ROM memory.
I got ...
2
votes
1
answer
350
views
Interface TFT display with STM32 parallel connection
I am searching for an explanation for the coding idiom for changing TFT
display resolution that is used in the PORT from mcufriend’s Arduino code.
...