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.

need some help~~ sending complex I2C data

hi all~

chip: 3530

os:wince6.0

we have to have to send I2C data like this

 

 

R/W

 

 

 

 

 

R/W

 

 

S

ADDR_1

0

0x00

0xFF

0xFF

Sr

ADDR_2

0/1

DATA1...DATAn

P

(S: start, Sr: restart, P: stop )

and the ADDR_1 is not the same as  ADDR_2 ,the problem is that OALI2CWrite and OALI2CTransaction can't do this job because:

1) we will never generate "restart" with OALI2CWrite,

2)OALI2CTransaction use the same slave I2C address in the overall communication.

and will 3530 send the slave address right behind it generates a start condition?

thanks in advance!

  • Hi,

    I have very similar problems, did you get it to work?

     

    thanks in advance!

  • whether this feature is supported by the haradware is not confirmed officially. but I do get it work by modifying the driver. the most important part is the OALI2CTransaction function.

    The I2C function in the BSP is designed to send data in packets, so you can define the device address in each pack, for example:

    typedef struct __I2C_PACKET_INFO_Ex_t
    {
        BYTE                    slaveAddress;
        UINT                    count;          // number of elements in array
        I2C_OPERATION_TYPE_e    opType;         // operation type (read/write)
        UINT                    result;         // number of bytes written/recieved
        I2C_BUFFER_INFO_t      *rgBuffers;      // reference to buffers   
    }
    I2C_PACKET_INFO_Ex_t;

    and in the OALI2CTransaction :

            // packet complete
            if (stat & I2C_STAT_ARDY)
                {
                // this notificaiton is needed to progress to next packet
                OUTREG16(&pI2CRegs->STAT, I2C_STAT_ARDY);
               
                // move to next transaction           
                if (idxPacket < pInfo->count)
                    {           
                    // get next packet
                    //               
                    pPacket = &pInfo->rgPackets[idxPacket];
                    ++idxPacket;

                    // initialize packet info
                    idxBuffer = 0;
                    pData = pPacket->rgBuffers[idxBuffer].pBuffer;
                    remainingInBuffer = OALI2CGetBufferSizeEx(pPacket, idxBuffer);
                    remainingInPacket = OALI2CGetPacketSizeEx(pPacket);

                    // Set slave address
                    OUTREG16(&pI2CRegs->SA, pPacket->slaveAddress );

    you have to change some other functions for these modifications. Good luck!