2019-11-11 07:17 AM
Hi.
I have found the STM32L1 HAL generated by CubeIDE doesn't have compatibility with the one generated by CubeMX.
For example, According to the UM1816 "Description of STM32L1 HAL and low-layer drivers", I2C has API like following :
HAL_I2C_Master_Sequential_Transmit_IT()
As I wrote, this is the right name in the User's Manual, and I was using this API with HAL generated by CubeMX.
But, this API causes compile error. The STM32L1 HAL. accept only following :
HAL_I2C_Master_Seq_Transmit_IT()
I checked HAL, and found the API name with "Sequential" is legacy. The problem is, ST doesn't define a compatibility macro in the stm32_hal_legacy.h for STM32L1 MCU.
This bug raises compatibility problems with existing code.
Attached zip file has project to demonstrate the problem. See line 100 of the main.c file. I have tested this project with following condition :
This is severe problem. Please investigate and fix.
2019-11-13 03:56 AM
Hello @Takemasa ,
The root cause of the issue (as you have already identified it) is that STM32L1 wasn't added in the defines related to I2C sequential transfer functions (stm32_hal_legacy.h):
#if defined(STM32H7) || defined(STM32WB) || defined(STM32G0) || defined(STM32F4) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4)
#define HAL_I2C_Master_Sequential_Transmit_IT HAL_I2C_Master_Seq_Transmit_IT
#define HAL_I2C_Master_Sequential_Receive_IT HAL_I2C_Master_Seq_Receive_IT
#define HAL_I2C_Slave_Sequential_Transmit_IT HAL_I2C_Slave_Seq_Transmit_IT
#define HAL_I2C_Slave_Sequential_Receive_IT HAL_I2C_Slave_Seq_Receive_IT
#define HAL_I2C_Master_Sequential_Transmit_DMA HAL_I2C_Master_Seq_Transmit_DMA
#define HAL_I2C_Master_Sequential_Receive_DMA HAL_I2C_Master_Seq_Receive_DMA
#define HAL_I2C_Slave_Sequential_Transmit_DMA HAL_I2C_Slave_Seq_Transmit_DMA
#define HAL_I2C_Slave_Sequential_Receive_DMA HAL_I2C_Slave_Seq_Receive_DMA
#endif /* STM32H7 || STM32WB || STM32G0 || STM32F4 || STM32F7 || STM32L0 || STM32L4 */
I'll report this issue internally. Thanks for bringing it to our attention.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2019-12-20 10:34 PM
Hi
Thanks. Adding STM32L1 as conditional compile parameter fixed issue.
By the way, I found also STM32F0 is missing. Please check and fix.
Takemasa