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.

CC1310: Sensor Controller Studio :: i2c bitbang protocol

Part Number: CC1310

Hello,

Any good reference to the protocol of the i2c bitbanged Sensor Controller Studio?

The sensor is 8 bit, the i2cTx(foo) appears to be 16 bit. Which is first, the low or high or is only 8 bit sent w/ i2cTx to the device?

For example...

The sensor has an 8 bit configuration register, and I dont know if the i2cTx is sending all 16 bits and if so, the MSByte may be overriding the LSByte.

// boot and reset the chipset

i2cStart();

i2cTx(I2C_OP_WRITE | LM298_I2C_ADDR);

i2cTx(LM298_CFG_SD); // AUTO draws 585 uAmps

i2cTx(LM298_CFG_REGISTER);

i2cStop();

Would something like this be more appropriate?

i2cStart();

i2cTx(I2C_OP_WRITE | LM298_I2C_ADDR); // this is a seven bit address on 16 bit bus

i2cTx(LM298_CFG_SD <<8); // this is simply to work around the i2c bitbang 16 bit sensor controller studio protocol

i2cTx(LM298_CFG_SD <<8); // this is the final 8 bit configuration sent to the sensor which will over ride the 1st data packet

i2cTx(LM298_CFG_REGISTER); // 8 bit register 0x00, so both MSByte and LSByte are 0x00 and it doesnt really matter which is sent first in the data packet chain.

i2cStop();

Thank you and have a great day!

Patrick

  • Hello Patrick,

    The sensor controller architecture is 16-bit. That is why only 16-bit variables and constants are used (for simplicity). The i2cTx() procedure will only transmit the least significant 8 bits of the 16 bit argument and discard the rest (they will be left-shifted out). The least significant 8 bits will be transferred over the SDA line as MSb.

    C:\Program Files (x86)\Texas Instruments\Sensor Controller Studio\proc_defs\i2c_tx_byte.asm

                                ; Output the bit to SDA
                                lsl         R7, #1               // Left shift by 1
                                tst         R7, #0x0100     // Check if MSb of the LSB is 1 or 0
                                bz          /dataSdaLow
    /dataSdaHigh:                   iobset      #(AUXIO_I2C_SDA & 0x7), [#(IOP_AIODIO0_GPIODOUT + (AUXIO_I2C_SDA >> 3))]
                                bra         /dataSdaDone
    /dataSdaLow:                    iobclr      #(AUXIO_I2C_SDA & 0x7), [#(IOP_AIODIO0_GPIODOUT + (AUXIO_I2C_SDA >> 3))]
                                nop
    /dataSdaDone:

  • ...ok so the

    i2cStart(); // master starts exchange

    i2cTx(I2C_OP_WRITE | LM298_I2C_ADDR); //is a seven bit address, left shifted for a write bit, and the sensor replys w/ ack.... then

    i2cTx(command code_foo16bit); // is left shifted by the SCS i2c protocol to the low 8 bit, and the upper 8 bits are tossed away and the sensor replys w/ ack... then

    the master places the low 16 bit on SDA with

    i2cTx(send_16bit_register); // is left shifted by the SCS i2c protocol to the low 8 bit and the upper 8 bits are tossed away and the sensor replys w/ ack ... then

    i2cTx(send_16bit_register >>8); // move upper 8 to lower 8 because the SCS i2c protocol will then move the upper 8 (now 0x00) out and the lower 8 (really the upper 8 of the data packet) is place on SDA and the sensor replys w/ ack... then

    i2cStop(); // master stops the exchange.

    ... and then on to reading the 16 bit results (edit to follow) PAB