2024-09-13 04:38 AM
Hello. I have LIS3DH accelerometer and I would like to use it with my ST32F4 board.
I have found the BSP drivers :
STM32Cube\Repository\STM32Cube_FW_F4_V1.28.0\Drivers\BSP\Components\lis3dsh
and also available here:
https://github.com/STMicroelectronics/stm32-lis3dsh/blob/main/lis3dsh.c
I have simple created a blank STM32 project for my MCU and copy/pasted the lis3dsh.c, lis3dsh.h and accelero.h to my project directory and configured the project.
When I try to build my project, I got the following error:
C:/Users/petrikas.lu/Desktop/WORK/my_project/Debug/../LIS3DH/src/lis3dsh.c:109: undefined reference to `ACCELERO_IO_Init'
I have then started to search for ACCELERO_IO_Init() function and its declaration but it is nowhere to be found.
I have the following questions:
1. Is there are example somewhere that shows how to use this driver exactly?
2. Is there instructions available on how to use provided BSP drivers and how to correctly import them to your project?
3. Where can I find ACCELERO_IO_Init() and other missing functions such as: ACCELERO_IO_Write() and ACCELERO_IO_Read()
2024-09-13 05:15 AM - edited 2024-09-13 05:20 AM
Looking at line 190 in lis3dsh.c:
/* Configure the low level interface */
ACCELERO_IO_Init();
So that must be the function that performs the hardware setup - GPIOs, SPI, etc
@LPetr.1 wrote:3. Where can I find ACCELERO_IO_Init() and other missing functions such as: ACCELERO_IO_Write() and ACCELERO_IO_Read()
Those would be the things that are specific to your hardware - so I guess you're expected to provide them.
You'd have thought this should be described - or, at least, linked - in the README at https://github.com/STMicroelectronics/stm32-lis3dsh - but no.
:frowning_face:
EDIT:
@LPetr.1 wrote:I have then started to search for ACCELERO_IO_Init() function and its declaration but it is nowhere to be found.
The declarations are in lis3dsh.h:
/* Accelerometer IO functions */
void ACCELERO_IO_Init(void);
void ACCELERO_IO_ITConfig(void);
void ACCELERO_IO_Write(uint8_t* pBuffer, uint8_t WriteAddr, uint16_t NumByteToWrite);
void ACCELERO_IO_Read(uint8_t* pBuffer, uint8_t ReadAddr, uint16_t NumByteToRead);
(currently lines 1210-1214: https://github.com/STMicroelectronics/stm32-lis3dsh/blob/main/lis3dsh.h#L1210 )
Again, they could've provided documentation there.