cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with HTS211 - HardFault Handler

MathieuOKS
Associate II

Hi ST Community,
I'm using the B-L475E-IOT01A card and I have a problem. As soon as I run my code in Debug mode, I get the HardFault Handler (SIGTRAP) error. I want to use the HTS221 temperature sensor and I'm using the BSP for this sensor (hts211.h). This error appears when the function enters HTS221_init -> HTS221_Initialize -> hts221_power_on_set -> hts221_read_reg -> ctx->read_reg which are in the hts221.c and hts221_reg.c files.

 

Here's my code and the variable declaration:

MathieuOKS_0-1704828542054.png

(I'm stuck line 116)

MathieuOKS_1-1704828582371.png

Thank you in advance for your help.

1 REPLY 1
MathieuOKS
Associate II

Little update: The problem is that the i2c bus isn't initialised. But i have still one question: Do I have to create the "HTS221_IO_t" structure myself? Define each of its characteristics?

"typedef struct

{

HTS221_Init_Func Init;

HTS221_DeInit_Func DeInit;

uint32_t BusType; /*0 means I2C, 1 means SPI-3-Wires */

uint8_t Address;

HTS221_WriteReg_Func WriteReg;

HTS221_ReadReg_Func ReadReg;

HTS221_GetTick_Func GetTick;

HTS221_Delay_Func Delay;

} HTS221_IO_t;"

(My goal is to use this function: "HTS221_RegisterBusIO(HTS221_Object_t *pObj, HTS221_IO_t *pIO)")