Hi, I'm using the template from the BOSCH github to write my I2C bus read and write functions however I can't seem to get it working. I'm using the PSOC generated I2C API's to do the process of bit reading/writing but it seems my I2CMasterSendStart function doesn't return anything. Any help would be great! Thank you s8 BNO055_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) { s32 BNO055_iERROR = 0; // this is the "status" we usually use in our R/W functions u8 idx; uint32 timeoutMs = 0; //ms BNO055_iERROR = imu_bno055_I2CMasterSendStart(dev_addr, imu_bno055_I2C_WRITE_XFER_MODE,timeoutMs); //^^error occuring here // Check for BNO055_iERROR before proceeding BNO055_iERROR = imu_bno055_I2CMasterWriteByte(reg_addr,timeoutMs); for (idx = 0; (idx < cnt) && (BNO055_iERROR == 0); idx++) { BNO055_iERROR = imu_bno055_I2CMasterWriteByte(reg_data[idx],timeoutMs); //I2C_UART_UartPutString(" bit writing in progress"); } //I2C_UART_UartPutString(" bit writing done "); // Check for BNO055_iERROR before proceeding BNO055_iERROR = imu_bno055_I2CMasterSendStop(timeoutMs); return (s8)BNO055_iERROR; } s8 BNO055_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) { s32 BNO055_iERROR = 0; // this is the "status" we usually use in our R/W functions u8 idx; uint32 timeoutMs = 0; BNO055_iERROR = imu_bno055_I2CMasterSendStart(dev_addr, imu_bno055_I2C_WRITE_XFER_MODE,timeoutMs); // Check for BNO055_iERROR before proceeding BNO055_iERROR = imu_bno055_I2CMasterWriteByte(reg_addr,timeoutMs); // Check for BNO055_iERROR before proceeding BNO055_iERROR = imu_bno055_I2CMasterSendStop(timeoutMs); BNO055_iERROR = imu_bno055_I2CMasterSendStart(dev_addr, imu_bno055_I2C_READ_XFER_MODE,timeoutMs); //starts reading the data bit by bit and putting them into a buffer for (idx = 0; (idx < cnt) && (BNO055_iERROR == 0); idx++) { reg_data[idx] = imu_bno055_I2CMasterReadByte(imu_bno055_I2C_ACK_DATA, reg_data, timeoutMs); //stores the byte in an array } // Check for BNO055_iERROR before proceeding //I2C_UART_UartPutString(" bit reading done "); BNO055_iERROR = imu_bno055_I2CMasterSendStop(timeoutMs); return (s8)BNO055_iERROR; }
... View more