Questions tagged [hal-library]

The HAL drivers include a complete set of ready-to-use APIs which simplify the user application implementation. It was developed by STMicroelectronics for STM32 microcontrollers.

Filter by
Sorted by
Tagged with
0 votes
0 answers
56 views

Weird Letters in Proteus Virtual Terminal

I'm a newbie to Proteus and electronics world. I have an assignment in which I need to use USART communication. Basically, at the end of the assignment, I should have accomplished that when I enter a ...
user avatar
0 votes
0 answers
12 views

Determine BRK Input State or Generating Interrupt on BRK in STM32G0 Timer 1 (STMCUBE IDE, HAL)

I am using an external BRK input for TIM1. I want to count how many BRK events occurred. I have tried callbacks unsuccessfully. Maybe I am not able to understand how to apply them. Tried reading HAL ...
user avatar
1 vote
1 answer
272 views

STM32f7 I2C master transmission using DMA does not work

The problem is the code: HAL_I2C_Master_Transmit_DMA (&hi2c1, (uint16_t)(MCP4725A0_ADDR_A00<<1), (uint8_t *)buffer, 2); Though it returns ...
user avatar
1 vote
0 answers
99 views

STM32 USB Mass Storage on External OSPI Flash

Hardware Target: I am using the STM32L4R9IDISCOVERY board Achievement 1: Building a little-fs file system, reading & writing files in the OSPI Flash memory with these functions: ...
user avatar
  • 159
0 votes
0 answers
44 views

Why is the buffer continue to be filled even when the CODEC is not receiving an input?

I am currently using the HAL function HAL_I2S_Receive(I2S_HandleTypeDef * hi2s, uint16_t * pData, uint16_t Size, uint32_t Timeout) in order to collect an input ...
user avatar
  • 29
3 votes
0 answers
197 views

Migrating from STM32

Our company spent couple years streamlining development and porting everything from a mess of different platforms to one unified STM32-based architecture. And now with global chip shortage it came ...
user avatar
  • 10.3k
0 votes
1 answer
388 views

Trying to use I2C ITs with HAL Functions

Hardware : STM32L452RET6 Software : STM32CubeFW_L4 v1.17 My problem : After using I2C with standard polling functions, i would like to use IT Functions to optimize my firmware. I try to work with ...
user avatar
  • 159
1 vote
1 answer
228 views

Changing PWM Pulse and GPIO Outputs Inside a Function (STM32)

hope you are all doing well. I am trying to learn STM32 for about two weeks now and right now I need to create a Library file which includes just one function. This function changes PWM Duty Cycle and ...
user avatar
  • 191
1 vote
1 answer
749 views

Scanning multiple channels using polling on STM32f401Re

I am using ADC to measure different voltages and I need a total of 15 channels and I need to measure ADC in a polling mechanism. When I use ...
user avatar
  • 121
0 votes
0 answers
135 views

ADC values too large on HAL stm32

Hi I am trying to read in a voltage value from a TDS sensor on my stm32 nucleo144-h723zg. The problem is that the voltage values are too high. The manufacturer only provides code and datasheet for ...
user avatar
0 votes
0 answers
66 views

What mechanism prevents me from initializing multiple peripherals on the same GPIO pin?

Can I initialize multiple peripherals on the same GPIO pin? For example, if I bind a GPIO with a peripheral, can I still manipulate this pin with the GPIO interface? With pseudo-code: ...
user avatar
  • 497
0 votes
2 answers
135 views

Is not it too much memory consumption for a simple thing?

I was trying to lower the memory consumption in my project and realized that a simple change of "uint8_t" value to the "define" shows effect much more and I thought. It seems I'm ...
user avatar
  • 69
1 vote
0 answers
1k views

STM32 - Using Timer as timebase source for HAL in FreeRTOS application

I am learning more about freertos by making a task based program. My problem comes when initializing and configuring the HAL time sources. I read that it is necessary to choose another HW timer as ...
user avatar
  • 31
2 votes
2 answers
3k views

In STM32, How to check the UART Serial Buffer If They Are Available using HAL Library

I am using STM32F429 in my project which connects to an ATmega2560 thru UART. In arduino, there is a function Serial.Available() to check if the serial buffer is empty or not. Is there a function in ...
user avatar
0 votes
1 answer
125 views

STM32F410RB is not outputting the WHOAMI register value of slave MPU9250/6000

Note: I am beginner :) I am trying to read the WHOAMI register in the MPU9250/6000 using i2c communication on STM32410RB Nucleo board MCU. I am using ...
user avatar
0 votes
2 answers
348 views

STM32 UART send broken frames

I have a NUCLEO-F303RE board and try to send some data by one-wire UART with 57600 baudrate. But frames are sent broken (see images below): How must to be: What I get: I've tried to use different ...
user avatar
0 votes
0 answers
3k views

STM32 HAL_GPIO_WritePin not working

I am using an NUCLEO-F411RE and try to use the GPIO with HAL. Its the first time i am facing this problem. I initialized the GPIO Pins like this: ...
user avatar
2 votes
1 answer
310 views

How to read data from slave device using i2c?

I am trying to read cell voltage 1 value with CRC over i2c. I am using bq76942 EVM(BMS) module as my slave device. Following is the code I am using : The CRC I am getting through response is 0x45. ...
user avatar
  • 23
1 vote
1 answer
76 views

STM32F4 get timer to work >2MHz

I have nucleo-401RE (STM32F401) board. I am trying to setup a timer (TIM4) to work above 2MHz (on bare-metal code). Per the timer settings below I am supposed to get 10.5MHz. On scope, I am getting ...
user avatar
  • 133
0 votes
1 answer
75 views

SPI Daisy-chain with paralleled DIN

I'm trying to use daisy-chaining feature on three MAX5318 DAC's. However, I'm not sure how to do it properly. Do I need to turn CS low, then write 9 byte to SPI DIN, then double-trigger LDAC? Or to ...
user avatar
  • 101
0 votes
1 answer
1k views

STM32 HAL I2C always sends 0xFF as first byte when responding to master using HAL_I2C_Slave_Transmit

I have an STM32G4 using the HAL function HAL_I2C_Slave_Transmit to respond with some data when requested by a master on the I2C bus. In the image below you can see the device sends 0xFF followed by ...
user avatar
0 votes
1 answer
290 views

STM32 HAL I2S problems

So I tried to power up codec (CS4272) together with my F401 board. After a lot of tweaking I got I2S to work and send data, but there were gaps. Upon further investigation it looks like ...
user avatar
  • 21
1 vote
1 answer
626 views

HAL_IncTick() not called anywhere

Every time I use hal_delay() the program hangs just before the call to hal_delay(). I have gone through few comments where it is told to add HAL_IncTick() to SysTick_Handler in stm32f4xx_it.c file. ...
user avatar
  • 11
1 vote
1 answer
1k views

STM32G474 signal generation with DMA + DAC using STM32CubeMX HAL

I am trying to generate a periodic signal with the DAC on the STM32G474 using DMA. There are tons of examples of this, and I´ve done the same in the past with an STM32L4 and F4 with no issues. However,...
user avatar
0 votes
2 answers
124 views

Help with the use of STM32 peripheral library, error definition with for example GPIO_Typedef

I really need help here because I'm trying to make a project for stm32f10x microcontrollers, I've found in the following thread of Keil forum Libray forum that the best way to add the library to a ...
user avatar
  • 128
2 votes
1 answer
940 views

STM32 HAL_ADC_Start() ends with HAL_ERROR

I'm new to microcontroller programming and I have a problem I can't solve. I am using STM32 Nucleo board L4R5ZI and I try to read the analog value on one of the pins, and then use the ADC to convert ...
user avatar
  • 29
0 votes
1 answer
658 views

STM32 Unexpected reset when a GPIO pin gets HIGH

I am using the STM32f030C8T6 MCU on a custom PCB. I have 2 inputs on pins PB2 and PB0, wierldy enough, when these pins become high the MCU resets. I had 2 assumption: 1: this somehow causes the ...
user avatar
  • 422
0 votes
0 answers
321 views

STM32G474 HAL Interrupt problem

I've just started learning STM32. I want to make a simple code that uses UART in interrupt mode. Unfortunately I can't make it work. I want an interruption occur when the microcontroller receives a ...
user avatar
  • 27
0 votes
0 answers
91 views

MCU Package of STM32f1 series for stm32CubeMX

I am trying to download MCU Package of STM32f1 series for stm32CubeMX from the following link: https://www.st.com/en/embedded-software/stm32cubef1.html But the given link sends this messege that the ...
user avatar
  • 43
1 vote
1 answer
303 views

NAK in CAN bus for STM32F3 uC

I have a problem with the NAK on the CAN bus. On STM32F303RE I wrote a code for communication via CAN bus with car dashboard (Instrument Panel Cluster). The communication works, I manage to receive ...
user avatar
  • 21
0 votes
2 answers
1k views

Sine Wave generator with DAC

i want to create a 40KHz sine wave with a STM32 Controller and an external DAC. I created my SPI connection to the MCP4922 and sending a sine wave table to it. The init function of the SPI interface ...
user avatar
2 votes
2 answers
3k views

How to wake STM32F103 by RTC using HAL libraries / Registers?

I've started digging into STM32F103 using HAL Libraries and raw registers. It's the first time to program at such low level. Anyway following a video I've successfully implemented "Standby" mode. ...
user avatar
4 votes
1 answer
3k views

Difference between I2C STM32 HAL functions

I'm using I2C in a project on STM32, and i was wondering what's the difference between HAL_I2C_Master_Transmit and HAL_I2C_mem_write, and the difference between HAL_I2C_Master_Receive and ...
user avatar
  • 67
0 votes
1 answer
247 views

Accessing MCP4451 Digital Pot with STM32 using HAL for i2c?

I am using an STM32 NUCLEO-F042K6 dev board to interact with a MCP4451 digital pot. I want to be able to adjust the wiper values through i2c. I am using the STM32CubeIDE and the HAL library to ...
user avatar
5 votes
1 answer
470 views

Large delay between I2C messages on STM32F303 - trying to read as fast as possible

I've got a sensor that I'm reading via I2C. My end goal is to be able to maximize the rate at which I can take these readings. In order to read, I have to write an zero-byte I2C message to the slave ...
user avatar
0 votes
1 answer
950 views

Do I really need to learn how to use registers - Programming a microcontroller? [closed]

I have a curious question. Do I really need to learn how to use registers when I program a microcontroller? I have been using Arduino for a long time. I quit using Arduino and starting to use STM32 ...
user avatar
  • 769
0 votes
1 answer
845 views

HAL Library CAN Bus interrupt sources and callback functions

Im using STM32F407 Discovery board and HAL library in CAN bus(CAN1) Some receive interrupts used with callbacks (for example receive interrupt...
user avatar
0 votes
1 answer
520 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 ...
user avatar
0 votes
1 answer
874 views

Clarification on interrupt triggered DMA transfer in an STM32

I'm trying to learn about DMA and its use in the STM32L4S9VI platform. One thing I'm confused about is what binds the DMA transfer to any one specific interrupt? In the below example, I'm curious ...
user avatar
  • 196
3 votes
3 answers
12k views

STM32 RTC with HAL libraries

I am working on stm32l053 (nucleo 64) and I want to track time with integrated RTC. Since I am quite new to stm32 development I am using CubeMX and HAL libraries. My problem is that the time is not ...
user avatar
  • 81
1 vote
0 answers
207 views

USART6 STM32F746NG isn't working

I'm having trouble configuring the USART6 in my STM32F746NG. I am setting up the USART6 to enable UART comunication, using the code below to initiate it and also create an echo function. ...
user avatar
3 votes
4 answers
869 views

How to use libraries with delays inside within a time critical STM32 HAL application?

I want to use a library for an LCD for STM32: LiquidCrystal, and possibly some other libraries. I noticed this library is full of HAL_Delay calls, not only during initialisation but also during ...
user avatar
1 vote
2 answers
974 views

Inconsistent SPI communication between STM32F4 (Slave) and Raspberry Pi (Master)

I've been having a very specific issues with large SPI transaction and after few days of debugging and trying different approaches I haven't progressed anywhere. To briefly explain the system: Slave: ...
user avatar
  • 11
0 votes
0 answers
657 views

STM32L4 External SPI NOR FLASH WinBond W25Q80DV

I am attempting to communicate with a winbond memory chip over SPI with the STM32L4VG. I am first just trying to read the manufacturing ID and my results are never consistent. Running the same code ...
user avatar
1 vote
2 answers
4k views

STM32F3 I2C hangs on busy flag (interrupts)

I am using two STM32F303K8 Nucleos and hooked up the SDA/SCL (GPIO B PIN 6 & 7) pins to 3.3V across roughly 4.7K resistors to 3V3. When I check the voltage on the pins, both are 3V3 so it's not ...
user avatar
  • 21
0 votes
1 answer
494 views

STM32F746 - DISCO I2C HAL_TIMEOUT

I am attempting to implement I2C interface on the STM32F7-Discovery Board using the a VEML 6070 UV light sensor (https://www.vishay.com/docs/84277/veml6070.pdf). The 7-bit slave address for the ...
user avatar
0 votes
2 answers
614 views

Reliability of STM HAL driver For Safety Critical Application

I'm working on a project which must be used in an automotive application and act as a node into the multiplex CAN-BUS network. There are number of I/O that must be actuated and some of them had a ...
user avatar
0 votes
1 answer
1k views

STM32CubeMX HAL vs CMSIS

If I generate code using STM32CubeMX then which files are related to CMSIS and which files are related to HAL? My toolchain is Atollic TrueSTUDIO.
user avatar
  • 827
2 votes
2 answers
1k views

STM32F407 - ADC in Scan mode setting overrun bit

I want to read 4 ADC channels in continuous scan mode. I am using ADC interrupt to read from the ADC data register. Here is my initialization: ...
user avatar
1 vote
1 answer
434 views

STM32L0: Fast processing of an analog sinusoidal signal

I have an embedded system based on a STM32 ARM Cortex M0+ microcontroller (STM32L051K6) and want to use it to convert an analog sinusoidal input signal into a digital pulse signal and do some SW ...
user avatar