Tool/software: Code Composer Studio
Hi,
I am trying to modify and run the existing example code for the I2C of CC26X2R1 for the one of I2C slave device but when I ran the code I got the Hard Fault: FORCED: BUSFAULT: IMPRECISERR error. I am very new to this device and I searched for the error in the forum but didn't get much information to solve it. So I'm here attaching my code snippets and ROV screen shots if anyone knw how to solve this issue please help me. Thank you.
I am using CCS8 and sdk 3_10_00_53
bool maxim_max30102_read_reg(uint8_t uch_addr, uint8_t *puch_data) /** * \brief Read a MAX30102 register * \par Details * This function reads a MAX30102 register * * \param[in] uch_addr - register address * \param[out] puch_data - pointer that stores the register data * * \retval true on success */ { //char ch_i2c_data; I2C_Params i2cParams; I2C_Handle i2c; I2C_Transaction i2cTransaction; //ch_i2c_data=uch_addr; // Configure I2C parameters. I2C_Params_init(&i2cParams); i2cTransaction.slaveAddress = I2C_WRITE_ADDR; i2cTransaction.writeBuf = &uch_addr; i2cTransaction.writeCount = 1; i2cTransaction.readBuf = puch_data; i2cTransaction.readCount = 1; // Open I2C i2c = I2C_open(Board_I2C_TMP, &i2cParams); if(I2C_transfer(i2c, &i2cTransaction)) { // Close I2C I2C_close(i2c); return true; } else { // Close I2C I2C_close(i2c); return false; } } void Spo2TestFunction() { Display_Handle display; UART_Handle uart; UART_Params uartParams; uint8_t ucUartData= "App Start"; Display_init(); GPIO_init(); I2C_init(); maxim_max30102_read_reg(0xff , &ucReadData); while(1) { } } int main(void) { pthread_t thread; pthread_attr_t attrs; struct sched_param priParam; int retc; /* Call driver init functions */ Board_init(); /* Initialize the attributes structure with default values */ // pthread_attr_init(&attrs); //dhananjay /* Set priority, detach state, and stack size attributes */ // priParam.sched_priority = 1; //dhananjay // retc = pthread_attr_setschedparam(&attrs, &priParam); // retc |= pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED); // retc |= pthread_attr_setstacksize(&attrs, THREADSTACKSIZE); Spo2TestFunction(); if (retc != 0) { /* failed to set attributes */ while (1) {} } // retc = pthread_create(&thread, &attrs, Spo2TestFunction, NULL); if (retc != 0) { /* pthread_create() failed */ while (1) {} } // BIOS_start(); return (0); }
Regards,
Dhananjay