Skip to main content
11 votes

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

The __weak keyword means that the function can be overridden by creating another function with the same declaration. Many of the interrupt-functions etc. in the STM ...
Klas-Kenny's user avatar
  • 5,612
8 votes

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

As explained in this stackexchange question a function defined as "_weak" can be overwritten by a user-defined function with the same name. It basically is a default function. If you don't ...
jusaca's user avatar
  • 9,749
5 votes

STM32 L4 HAL_FLASH Writes in one function but not another

It appears that the actual issue is that the FLASH_PECR_ERASE (or at least that is what is called on the L0) is left set by the typical flash erase routines. This ...
Chris Stratton's user avatar
5 votes

CMSIS without HAL

I've found it. In the properties of the project, you need to go to C/C++ build -> Settings -> Tool Settings -> Includes. In the Include paths (-l), remove the HAL-related directories and add a ...
Marco Svizzeri's user avatar
5 votes

STM32 USB CDC: packet loss with active PC usage

USB has no way for a (non-isochronous) device endpoint to send data proactively – your host needs to poll the device for new data. It looks like your PC isn't keeping up with that task, and your ARM-...
Marcus Müller's user avatar
5 votes

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

It has nothing to do with STM32 or embedded programming. It's just a compiler dependent extension to tell the C compiler that an object is weakly declared, as by default objects are strongly declared. ...
Justme's user avatar
  • 172k
4 votes
Accepted

Last address of program in STM32 HAL?

Your compiler might define a name for the last address used by code and/or const data sections. I know in the one I use, it has definitions for the end of code, something like ...
brhans's user avatar
  • 14.8k
4 votes

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

Yes you can mix HAL code with whatever custom code you like. The initialization of clocks and peripheral by using the mouse is quite nice and easy so in practice you have a prototype working within ...
Justme's user avatar
  • 172k
3 votes
Accepted

STM32 L4 HAL_FLASH Writes in one function but not another

Update: The problem was the usage of the FLASH_PageErase() function, which does not reset the proper control bits for the flash to allow writing again. It just coincided with the order of the function ...
kbrown323's user avatar
3 votes
Accepted

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

You usually get the bad with the good. In a recent project I had to read pins statuses even though they were set as outputs. This is where the bare metal stuff comes in handy. Another aspect is speed ...
electrophile's user avatar
  • 1,360
3 votes

STM32 USB CDC: packet loss with active PC usage

There does appear to be an issue with the Windows 10 serial driver (also see MSDN). The workaround that we use is sending at most 63 bytes (in one packet) per USB frame. This results in 1 packet per ...
Robert_ps's user avatar
3 votes

Possibility for UART receive data loss?

The interrupt driven UART communication is probably about 50 - 60 lines of the code using the registers. HAL is a huge black hole - who knows what is inside? For MIDI you do not have too much option ...
0___________'s user avatar
  • 2,634
3 votes
Accepted

Possibility for UART receive data loss?

H/W flow control between UART's RTS/CTS with 16 byte Rx buffers are intended to prevent overflow. But it useful to include parity to improve signal integrity in case flow control latency is too long. ...
D.A.S.'s user avatar
  • 148k
3 votes

STM32F4 I2C Address Timeout

I have witnessed this on other STM32 devices I have used. The basic issue is that in some cases there is a read-modify-write operation to I2C control register which ends up setting STOP and START bits ...
user205616's user avatar
3 votes
Accepted

Questions about DMX512 protocol/STM

DMX transmitters are superficially easy, but there are a number of traps if you want your kit to play nice with at least most of the really trashy end of the DMX receiver market.... In particular if ...
Dan Mills's user avatar
  • 17.6k
3 votes
Accepted

STM32F030 High current in stop mode

I put it aside for couple of days. Now I got back to it. And it works OK without changing anything. 20 μA in stop mode (LDO + MCU), and 2.6 mA in run mode. When I flash firmware, disconnect SWD ...
Chupacabras's user avatar
  • 5,528
3 votes

HAL_TIM_PeriodElapsedCallback firing very prematurely

You don't show the full code, but my guess is, you set and enable the callback after the timer has already elapsed once or many times, so there is a pending elapsed event which triggers immediately ...
Justme's user avatar
  • 172k
2 votes
Accepted

SMT32 HAL UART crash on possible overrun

What happens is that I have the overrun error as my microcontroller cannot keep up with everything. There's a strange combination of overrun and RXNE that is not handled in HAL UART and will just make ...
Carlos's user avatar
  • 143
2 votes
Accepted

How to get a Timer started without interrupt?

The code generated looks fine so far, however it isn't included the call to the timer start function, hence the timer is initialized but not started. To start it in non interruption mode use ...
user162889's user avatar
2 votes

Last address of program in STM32 HAL?

Note this only answers the max page 31 issue. My main issue (finding the last address or last page is not solved. By coincidence searching in hal_stm32f1xx_hal_flash_ex.h, I found the following code (...
Michel Keijzers's user avatar
2 votes
Accepted

STM32F103 bxCAN not working

TxMailbox -> &TxMailbox. The manual: pTxMailbox pointer to a variable where the ...
Lundin's user avatar
  • 22.2k
2 votes

Boot problem with STM32 HAL, I2C HDD44780 and 1602 LCD

I had the same problem as you, I was using TCA9555 IO expander for driving LCD ST7565 & button... I set low RST,A0,RW,E before init and it got solved.
laksono budi's user avatar
2 votes
Accepted

Boot problem with STM32 HAL, I2C HDD44780 and 1602 LCD

The delay before initialization will not help in the long run. The state of IO expander controlling the LCD bus and the LCD controller are reset to known state only when there is a power-up, as they ...
Justme's user avatar
  • 172k
2 votes
Accepted

Problems reading correct data from AD7746 using STM32 I2C HAL library

It solved! if you use just one: HAL_I2C_Mem_Read(&hi2c2,144, 4, 145, (uint8_t *)&VT1,6, 100); instead of 6 times, it read the correct 6 registers because AD7746 increases address automatically,...
saleh's user avatar
  • 29
2 votes

Why are MSPs in STM32 HAL defined as callback functions?

You have a misconception what a callback means. It just means a function that is called back from e.g. some library code, whether or not you provide the library with info what to call or not. Maybe ...
Justme's user avatar
  • 172k
2 votes

Why are MSPs in STM32 HAL defined as callback functions?

Callback functions is a well-defined term meaning "function defined by my application but called by someone else". Someone else being a library or an OS. Take for example the pthreads ...
Lundin's user avatar
  • 22.2k
2 votes
Accepted

HAL_SPI_Transmit does not send the bit pattern expected way

But I don't see that bit pattern on scope Yes you do. Or you don't. Since MOSI idles high, we can't really tell if the scope pattern is 0x55 or 0xAA without seeing the clock at the same time. You can'...
Lundin's user avatar
  • 22.2k
2 votes
Accepted

Reading and writing from the BMP180 E2PROM

The device's I2C slave address is 0x77 - in binary, 0b01110111. In order to write to the device, you must send the slave address bit shifted left by one, with a WRITE bit (0). Therefore 0b01110111 ...
InBedded16's user avatar
  • 1,302
2 votes

HAL_TIM_PeriodElapsedCallback firing very prematurely

A couple of gurus at community.st.com answered this for me. "Cube/HAL functions generate an Update during setup, so the UIF flag is already set." I had to reset the UIF flag before calling <...
Brian Dotson's user avatar
2 votes
Accepted

HAL_SPI_TransmitReceive not working properly

You have configured your SPI peripheral to work with 16-bit instead of 8-bit data. Then you request transmitting 2 units of data which result to 2x16-bit => 32-bit transmission. Alternatively you ...
Misaz's user avatar
  • 385

Only top scored, non community-wiki answers of a minimum length are eligible