This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

"OPT3001 Open Failed" error with BOOSTXL-SENSORS

Other Parts Discussed in Thread: OPT3001

Hi, 

I build "i2copt3001_MSP_EXP432E401Y_tirtos_ccs" project by importing "C:\ti\sail_1_50_00_00__all\sail_1_50_00_00\examples\rtos\MSP_EXP432E401Y\sail\i2copt3001\tirtos\ccs" folder as CCS Project.

Then I change two objects in i2copt3001.syscfg:

  1. Use Hardware in I2C 

        "BAS Sensors BoosterPack I2C" to "Sensors BoosterPack I2C"

  2. Use Hardware in GPIO - CONFIG_GPIO_OPT3001_INT

        "None" to "Optical Interrupt" of Optical Sensor (SENSORS BoosterPack)"

Then I build the project and run it. 

I see "I2C Initialized!" message, but it failed showing "OPT3001 Open Failed!" message.

Could you kindly advise me how to solve this problem ?

Any help and advice highly appreciated in advance.

HaeSeungBOOSTXL-SENSORS & MSP-EXP432E401Y.jpg

  • Hi HaeSeung,

    I'm assigning this thread to the MSP team since this seems to be a software issue and not an issue with the sensor itself.

    Thank you,

    Brent Elliott

  • Hi,

    I solved this problem, by fixing OPT3001_writeRegister() function in opt3001.c under C:\ti\sail_1_50_00_00__all\sail_1_50_00_00\source\ti\sail\opt3001 folder as follows:

    /*
     *  ======== OPT3001_writeRegister ========
     *  Writes data to the specified register and OPT3001 sensor.
     */
    bool OPT3001_writeRegister(OPT3001_Handle handle, uint16_t data,
            uint8_t registerAddress)
    {
        I2C_Transaction i2cTransaction;
        uint8_t readBuffer[READ_BUF_SIZE];					// added
        uint8_t writeBuffer[WRITE_BUF_SIZE] = {registerAddress, (data >> 8), data};
    
        i2cTransaction.writeBuf = writeBuffer;
        i2cTransaction.writeCount = WRITE_BUF_SIZE;
    //  i2cTransaction.readCount = 0;						// deleted 
        i2cTransaction.readBuf = readBuffer;                // added
        i2cTransaction.readCount = READ_BUF_SIZE;           // added
        i2cTransaction.slaveAddress = ((OPT3001_HWAttrs *)(handle->hwAttrs))->slaveAddress;
    
        /* If transaction success */
        if (!i2cTransferFxn(((OPT3001_Object *)(handle->object))
                ->i2cHandle, i2cTransaction)) {
            return (false);
        }
    
        return (true);
    }

    Hoping this would be helpful.

    HaeSeung