Questions tagged [hal]

For questions about hardware abstraction layers (HALs). A HAL is software that provides an interface to a class of similar hardware devices so that applications can access the hardware in a device-independent manner in order to improve portability.

Filter by
Sorted by
Tagged with
2 votes
0 answers
100 views

STM32 - I²C Slave HAL Callback ACK

Objective: implement a single byte I²C slave on STM32. Materials: STM32L452RE Nucleo-64 board, HAL Library, CH341 USB-I²C adapter(1), Artix Linux with Runit, Rhode & Schwarz RTB2004 oscilloscope ...
user avatar
  • 21
1 vote
0 answers
47 views

STM32F746 I2S clock fails

I have discovery board STM32f746NG In first try I've set this: Activate I2S2 with piout: PB4->WS - PI3->SD - PI1->CK. Instantly after activating I2S periferal with command ...
user avatar
0 votes
1 answer
58 views

HAL_SPI_Transmit does not send the bit pattern expected way

As a beginner, to test HAL_SPI_Transmit function for this Nucleo board, I wanted to send 0b10101010 on MOSI line and observe it on scope. But I don't see that bit pattern on scope, instead I see the ...
user avatar
  • 1,419
4 votes
1 answer
80 views

STM32F030 High current in stop mode

I would like to put STM32F030K6T6 into STOP mode (low power mode), in which there should be current consumption around 5 μA. But whatever I do the current consumption is around 450 μA in stop mode. ...
user avatar
  • 5,187
0 votes
1 answer
35 views

A question about types of STM32 HAL initializations

For a peripheral PPP(), there is an initialization function in HAL as: HAL_PPP_Init(); and there is also the following which is a called a callback: ...
user avatar
  • 1,097
0 votes
3 answers
208 views

Why are MSPs in STM32 HAL defined as callback functions?

Please see my edit: I asked this question stackoverflow and no one answered. In STM32CubeMX MSP stands for MCU Support Package and of all here is what it basically about: MSPs are user callback ...
user avatar
  • 1,097
1 vote
1 answer
142 views

stm32f7 QSPI (QUADSPI) in indirect mode can't read/write on NOR flash memory

I'm using STM32F746G-Discovery included Micron NOR flash memory n25q128a. In CUBE example we can see this (ReadWrite_IT, Automatic polling): ...
user avatar
4 votes
3 answers
668 views

What is the meaning of the keyword "__weak" in this callback function in HAL GPIO function?

I have started learning STM32 programming in HAL and I am confused about what this function exactly does: ...
user avatar
1 vote
1 answer
147 views

STM32 HAL SPI communication issue

I have two STM32F407VET6 boards and I want to use one as master and second as slave and connect them with SPI. I connected the master's SCK to the slave's ...
user avatar
  • 121
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
2 answers
261 views

STM32 and dreaded HAL: something wrong with only using HAL for basic setup and skip it for the application part?

Many have a hate relationship with ST's HAL. I have a like/hate one and was wondering if my approach will bite me later on. I like the peripheral and clock setup of current CubeMx. The code generated ...
user avatar
0 votes
0 answers
110 views

HAL_Delay fails after flashing code

My code runs differently if reset vs. power-cycle. My board has a status LED. My program flashes an LED on and off. When I flash my code via my STLink V2 and hit my reset button, the light turns on, ...
user avatar
0 votes
0 answers
108 views

STM32 SSD1306 number display problem

I am currently doing an environment parameter monitoring module, based on STM32F401RE microcontroller. The module measures the environment temperature, relative humidity and dust concentration in the ...
user avatar
  • 1
0 votes
1 answer
302 views

UART doesn't work with ADC enabled

I'm trying to send some data through UART using DMA. I'm also using DMA to control ADC and DAC. When ADC is enabled and I try to send data I get a HardFault error. The HardFault occurs exactly during ...
user avatar
0 votes
1 answer
1k views

What if you enable both DMA and Interrupt for a STM32 ADC

Imagine this scenario: You are using a timer driven ADC in DMA mode, nothing special. Now, because you are interested in having a Watchdog, you also enable the ADC Global Interrupt in CubeIDE (...
user avatar
  • 41
0 votes
0 answers
434 views

STM32F103C8 I2C BUSY flag reset

I'm using HAL to use I2C and somemtimes I'm getting HAL_BUSY flag, I read STM32F103 errata and added BUSY flag clear according this, i2c busy flag clear But I changed error handling little bit and is ...
user avatar
1 vote
1 answer
237 views

STM32 with encoder

I'm using stwinkt1 board connected to encoder to timer 3. I want to get a interrupt every time that the encoder count is 300, so the code in the interrupt is: void TIM3_IRQHandler(void){ // do things ...
user avatar
  • 11
0 votes
1 answer
14 views

Pointer to a reception buffer seems to have zero in all the other elements differents but the zero index , why with an STM32F401VE

how are you?. I'm having some trouble analizing streamed data. Recently I made a program that analizes streamed data and works for the first message of the stream as you can see in the following post ...
user avatar
  • 128
1 vote
1 answer
44 views

Problem managing streamed data with struct pointers, some of the streamed data seems to be stored, some not with an STM32F401VE

I've recently been teached about how to manage streamed data in this case for managing commands, then my code is like the following explanation: I've programmed the uart2 to receive the streamed data ...
user avatar
  • 128
0 votes
1 answer
258 views

Problems reading correct data from AD7746 using STM32 I2C HAL library

I am trying to read capacitance and temperature from the AD7746 capacitance-to-digital converter, using STM32F103 and HAL I2C library (SDA and SCL pulled up with 2k and Vcc = 3.3 V). I did it before ...
user avatar
  • 19
0 votes
1 answer
431 views

si7060 I2C temperature sensor with STM32 CubeIDE?

I am trying to read an SI7060. It's my first time using i2c and it doesn't seem to work. Do I make something wrong here? SI7060 datasheet ...
user avatar
  • 27
3 votes
2 answers
348 views

Last address of program in STM32 HAL?

Is there a way to find the last address or last page of the program which is stored in an STM32(F1) using a HAL (or LL?) function? Background: I'm using EEPROM emulation in Flash and this works great....
user avatar
0 votes
1 answer
949 views

STM32F103 bxCAN not working

I'm trying to make use of the bxCAN of STM32F103C8 on a bluepill but it doesn't work and I don't know what is the problem.I'm using the hal API here is the main code in the while loop ...
user avatar
  • 145
1 vote
3 answers
548 views

Boot problem with STM32 HAL, I2C HDD44780 and 1602 LCD

I'm using the following (relevant) combination: STM32F103C8T6 devboard (bluepill) 1602 LCD with I2C (HDD44780) STM32CubeIDE HAL Also I have a keypad and some other components attached, but these are ...
user avatar
1 vote
1 answer
507 views

CMSIS without HAL

Is it possible to create a project in System Workbench for STM32 with CMSIS but without HAL library? My target microcontroller is STM32L053R8 on a Nucleo board. When I create a with HAL and delete all ...
user avatar
2 votes
1 answer
2k views

STM32 - HAL SPI receive interrupt not entering EXTI callback

I designed a breakout board for the STM32F401CEU6. (Schematic attached) I am using it to receive data from an ADC chip over SPI. The ADC chip has a data ready output which should be used as an ...
user avatar
2 votes
2 answers
3k views

STM32 L4 HAL_FLASH Writes in one function but not another

I am working with an STM32 L476RG evaluation board on a project. The goal currently is to utilize STM's mass storage library to write data to flash over USB. I've got the USB library working properly (...
user avatar
0 votes
0 answers
578 views

HAL SCCB Commuincation via I2C: HAL_ERROR Status

I am using an STM32f4 Discovery board to interface with an OV2640 Camera. When attempting to set the SCCB registers, I am using I2C. However, when doing a simple test I cannot connect to the device. ...
user avatar
2 votes
0 answers
731 views

stm32 does not exit sleep

When trying to implement sleep mode it appears the code enters and exits sleep mode once and then gets stuck in sleep mode after and will not wake back up. I posted some code below of what I believe ...
user avatar
1 vote
0 answers
516 views

STM32 ADC & HAL - EOC selection for polling continiously

I will ask my question via linking some other question asked by someone. S/he got his/her answer on how to solve, but I am more interested on WHY? Thanks in advance. Link to the question: STM32 ADC ...
user avatar
  • 1,966
0 votes
0 answers
2k views

Why HAL_I2C_Master_Transmit always returns HAL_BUSY?

I'm trying to use I2C between an STM32F103C8T6 development board and an Arduino Uno. However, I always get a HAL_BUSY error when I call HAL_I2C_Master_Transmit in ...
user avatar
1 vote
1 answer
817 views

PWM output on pin using STM32F030K6T6, CubeMX, Attolic and HAL libraries

...
user avatar
  • 49
4 votes
4 answers
2k views

STM32 USB CDC: packet loss with active PC usage

I got a strange error in the USB CDC on the STM32F2. I use HAL implementation of the driver. The size of the buffer transferred in USBD_CDC_SetTxBuffer () is 4096 bytes. On the PC side, I accept the ...
user avatar
  • 51
0 votes
1 answer
336 views

Why I can't change variable in it.c?

I have stm32vldiscovery project. I want to use external interrupt by PA0 (user button). When I press the button (PA0), then function EXTI0_IRQHandler must set ldOn equal 0. But ldOn always is 1. ...
user avatar
  • 31
1 vote
0 answers
2k views

STM32 HAL PWM output with DMA misbehavior

I use the Blue pill STM32F103C8T6 to generate variable duty cycle PWM with DMA and using HAL library. And stuck with undesired results. First, I generated code with STM32CubeMX v5.0.1, HAL v1.7.0, ...
user avatar
  • 11
0 votes
1 answer
387 views

Reading STM32F timer value

I am trying to implement a hardware timer for STM32F and read the value from it. So far, this is my implementation: ...
user avatar
  • 3
1 vote
2 answers
2k views

Questions about DMX512 protocol/STM

I want to make a DMX512 transmitter with a STM32F103 using HAL, CubeMX. I found some documentation like here about the protocol: Lighting-Control-using-DMX512-protocol-on-STM32. Sadly it does not ...
user avatar
1 vote
0 answers
822 views

driving WS2812B using DMA and timers

I am trying to port the octoWS2811 for STM32F103c8T6. This guy hubmartin has already done the heavy lifting and created a library using STM32 HAL. But the problem is that i am unable to get it to ...
user avatar
0 votes
1 answer
363 views

CAN via SPI over STM32F103C8T6

Since I could not get CAN to work with the internal CAN of an STM32 (F103C8T6), I bought a few CAN boards working with SPI, like these: However, when I send something I get the following results ...
user avatar
0 votes
1 answer
5k views

SMT32 HAL UART crash on possible overrun

I increased my baud rate from 56000 to 115200 and my serial communication stops working when pinging continuously after 10-20 seconds. I am running at 16 MHz. As far as I know HAL driver will handle ...
user avatar
  • 133
0 votes
1 answer
2k views

How to get a Timer started without interrupt?

I use an STM32F103c8t6. What I want is to measure time between several statements. I found out HAL_getTick does not work since the resolution is too small (1 ms). However, I cannot seem to initialize ...
user avatar
0 votes
1 answer
1k views

HC-SR04 with STM32 gives unexpected values

On an Arduino it is easy to get an HC-SR04 ultrasonic sensor getting to work. However, on my STM32(F103C8T6) I get strange values. I assumed I connect it correctly, since I get values on the trigger ...
user avatar
2 votes
1 answer
3k views

STM32F4 I2C Address Timeout

I have here a Problem with an I2C bus configuration, that runs in a timeout after a certain time. The I2C slave is a fujikura ap4/ag4 pressure sensor and the master a STM32F4. I read continiously the ...
user avatar
  • 51
1 vote
1 answer
949 views

Making 100 microseconds delay for STM32L0

I need to create 100 microseconds delay for STM32L0 using HAL. I have HSE 12 MHz. APB1 timer clocks 12MHz. ...
user avatar
  • 127
0 votes
2 answers
3k views

Possibility for UART receive data loss?

In a lot of examples using STM32, HAL, where UART data is received by interrupt the code looks like: Initially (to start the receiving): ...
user avatar