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.

CC2541 I2C Communication Problem

Other Parts Discussed in Thread: CC2541

Hi,

i am trying to connect Gyroscope (L3GD20) with CC2541 through I2C communication. Im using TI Keyfob Sample program for the same but unfortunately i am not able to establish communication with the device. i have checked the clock pulse in DSO and got the correct clock pulse (33 kHz frequency) and no clock pulses for data were detected on DSO. 

My basic problem is that my code was not able to establish I2C communication with the device. I have checked with only I2C start condition but i am not able to receive acknowledgement from the device that means communication link was not established. Checked with all connections and program as well but unfortunately the result is same. can some one please help me to sort out this issue.

Thanks in advance

  • Hi Sarang,

    We tried doing the same methods as mentioned in the link but unfortunately the result remains the same.

    we are not able to establish basic I2C communication link. we tried to capture SCL and SDA from the ports on CC2541 with out any slave connected(attaching the same for your reference). But with the slave connected, we are not able to recieve any acknowledgement from the slave after start condition.

    will forward you our code if in case needed for further reference

    Thanks in advance

    Regards

  • Hi Sarang,

    please refer to the I2C code that we have implemented for our slave Gyro and let me know if any corrections to be done for establishing basic I2C communication link.

    #include<ioCC2541.h>

    #define BV(n) (1 << (n))

    typedef unsigned char u8_t;
    typedef unsigned short int u16_t;
    typedef short int i16_t;
    typedef signed char i8_t;

    #define I2C_ENS1 BV(6)
    #define I2C_STA BV(5)
    #define I2C_STO BV(4)
    #define I2C_SI BV(3)
    #define I2C_AA BV(2)

    #define RESET P0_6
    #define led1 P1_0
    #define led2 P1_1

    #define I2C_SR 0xE0
    #define I2C_SP 0xD0
    #define I2C_DO 0xC0

    #define CLKCON_OSC32K 0x80 // 32 kHz clock source select/status
    #define CLKCON_OSC 0x40 // system clock source select/status
    #define CLKCON_TICKSPD (0x07 << 3) // bit mask, global timer tick speed divider
    #define CLKCON_TICKSPD_32M (0x00 << 3)
    #define CLKCON_TICKSPD_16M (0x01 << 3)
    #define CLKCON_TICKSPD_8M (0x02 << 3)
    #define CLKCON_TICKSPD_4M (0x03 << 3)
    #define CLKCON_TICKSPD_2M (0x04 << 3)
    #define CLKCON_TICKSPD_1M (0x05 << 3)
    #define CLKCON_TICKSPD_500K (0x06 << 3)
    #define CLKCON_TICKSPD_250K (0x07 << 3)
    #define CLKCON_CLKSPD (0x07) // bit mask for the clock speed division
    #define CLKCON_CLKSPD_32M (0x00)
    #define CLKCON_CLKSPD_16M (0x01)
    #define CLKCON_CLKSPD_8M (0x02)
    #define CLKCON_CLKSPD_4M (0x03)
    #define CLKCON_CLKSPD_2M (0x04)
    #define CLKCON_CLKSPD_1M (0x05)
    #define CLKCON_CLKSPD_500K (0x06)
    #define CLKCON_CLKSPD_250K (0x07)

    #define L3G4200D_OUT_X_L 0x28
    #define L3G4200D_OUT_X_H 0x29
    #define L3G4200D_OUT_Y_L 0x2A
    #define L3G4200D_OUT_Y_H 0x2B
    #define L3G4200D_OUT_Z_L 0x2C
    #define L3G4200D_OUT_Z_H 0x2D

    typedef enum {
    X_AXIS =0x01,
    Y_AXIS =0x02,
    Z_AXIS=0x03
    } axis;

    void i2c_init();
    void gyro_start();
    void gyro_stop();
    void gyro_send(unsigned char x);
    void gyro_write(unsigned char reg,unsigned char dat);
    unsigned char gyro_receive(unsigned char reg);
    void gyro_init();
    void delay(unsigned char n);
    void timer_delay(unsigned char m);

    ******************************************************************************************

    #include<ioCC2541.h>
    #include<gyro.h>
    void gyro_start()
    {
    I2CCFG &=~I2C_SI;
    I2CCFG |=I2C_STA;
    while((I2CCFG&I2C_SI)==0);
    I2CCFG &=~I2C_STA;
    }
    void gyro_stop()
    {
    I2CCFG &=I2C_STO;
    I2CCFG |=~I2C_SI;
    while((I2CCFG&I2C_STO)!=0);
    }
    void gyro_send(unsigned char x)
    {
    I2CDATA = x;
    I2CCFG &= ~I2C_SI;
    while ((I2CCFG & I2C_SI) == 0);
    }

    unsigned char gyro_read()
    {
    I2CCFG &= ~I2C_SI;
    while ((I2CCFG & I2C_SI) == 0);
    return I2CDATA;
    }

    void gyro_write(unsigned char reg,unsigned char dat)
    {
    I2CCFG=I2C_SR;

    I2CDATA=0xD4;
    I2CCFG=I2C_DO;

    I2CDATA=reg;
    I2CCFG=I2C_DO;

    I2CDATA=dat;
    I2CCFG=I2C_DO;

    I2CCFG=I2C_SP;

    }
    unsigned char gyro_receive(unsigned char reg)
    {
    I2CCFG=I2C_SR;

    I2CDATA=0xD4;
    I2CCFG=I2C_DO;

    I2CDATA=reg;
    I2CCFG=I2C_DO;

    I2CCFG=I2C_SR;

    I2CDATA=0xD5;
    I2CCFG=I2C_DO;

    I2CCFG=I2C_DO;

    I2CCFG=I2C_SP;

    return I2CDATA;
    }
    void i2c_init()
    {

    //I2CCFG=0x45;
    I2CWC = 0x00;
    }
    void gyro_init()
    {
    gyro_write(0x20,0x0F);
    gyro_write(0x21,0x29);
    gyro_write(0x22,0x80);
    gyro_write(0x23,0x20);
    gyro_write(0x32,0x2C);
    gyro_write(0x33,0xA4);
    gyro_write(0x34,0x2C);
    gyro_write(0x35,0xA4);
    gyro_write(0x36,0x2C);
    gyro_write(0x37,0xA4);
    gyro_write(0x38,0x00);
    gyro_write(0x30,0x2A);
    }

    i16_t L3G4200D_GetAngRateRaw(axis a)
    {
    u8_t valueL;
    u8_t valueH;
    u16_t value;
    switch (a)
    {
    case X_AXIS:
    valueL=gyro_receive(L3G4200D_OUT_X_L);


    valueH=gyro_receive(L3G4200D_OUT_X_H);


    value = (i16_t)( (valueH << 8) | valueL );
    break;
    case Y_AXIS:
    valueL=gyro_receive(L3G4200D_OUT_Y_L);

    valueH=gyro_receive(L3G4200D_OUT_Y_H);


    value = (i16_t)( (valueH << 8) | valueL );
    break;
    case Z_AXIS:
    valueL=gyro_receive(L3G4200D_OUT_Z_L);


    valueH=gyro_receive(L3G4200D_OUT_Z_H);


    value = (i16_t)( (valueH << 8) | valueL );
    break;
    }
    return value;
    }

    i am also attaching the schematic for your reference

    6607.CC2541 Keyfob with GYRO.pdf

    A quick reply for this problem will be really helpful for us as we are running out of time

    Thanks in advance

    Regards,

    Krishna

  • I am assuming that CC2541 is the Master here.

    1) Please check if SDA and SCL pullup enable needs to be set in I2CWC, depending on your schematic

    2)I guess you already said you get 33 KHz., but please check I2CCFG

    3)Ensure that during init you have the following line of code -I2CCFG |= (I2C_ENS1 | I2C_AA)

    4) After you send start condition, manually clear the STA bit, after the wait for SI ends.

    5) Check I2CSTAT to ensure you read a "Start transmitted" before you write the slave's address

    6) Write slave address to I2CDATA 

    7)Start writing data to the slave, for every byte you should see I2CSTAT.STAC = 0x28 which means ACK received.

  • Hi Sarang,

    Thanks for the quick reply

    yes you are right, CC2541 is our master device 

    we  had followed all points mentioned by you but once again we will try doing all the points mentioned by you for confirmation.

    will post you the result once i have done with all the above mentioned solutions

    Regards,

    Krishna

  • Hi Sarang,

    we made the I2C communication link working on the device with your valuable suggestions

    Once again thanks for your help

    Regards,

    Krishna

  • Hi Sarang,

     I need more help from  you regarding the same I2C communication with another slave(OLED) ssd1306.

    we have been testing our OLED(Slave)to Display via I2C with CC2541 by checking acknowledgements for each commands, we are able to receive acknowledgement from slave till Display offset command. we got stuck at Display Offset command and not going further. We tried and got acknowledgement after Display_Offset (0xD3) but after writing no offset command (0x00),no acknowledgement was received and not going further and same case with Normal Display(0xA6) and Inverse Display Commands(0XA7).

    For the same controller, we are able to communicate with other I2C slave(Gyro) perfectly but in this case communication was not happening with OLED.

    I am also posting the updated code, please kindly check and help us in getting the issue sorted out at the earliest.
    Eagerly waiting for your reply

    #include<ioCC2541.h>
    #include<oled.h>

    unsigned char logo1[4][132] =
    {
    {0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0x0C,0x06,0x03,0x01,0x03,0x06,0xCC,0xE0,0xF0,0xF8,0xFC,0x06,0x03,0x01,0x03,0x06,0x0C,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0x00,0x00,0xE0,0xF8,0x38,0x1C,0x1C,0x1C,0x3C,0x78,0xF0,0xC0,0x00,0x00,0x7C,0xFC,0xC0,0x00,0x00,0x00,0x00,0x00,0xF1,0xFF,0x1F,0x7C,0xE0,0x00,0x00,0x00,0x30,0x38,0x1C,0x8C,0xCC,0xF8,0xF0,0x00,0x00,0x78,0xFC,0x0C,0x0C,0x00,0x78,0xFC,0xCC,0x8C,0x98,0xFC,0xFC,0x00,0x00,0x3C,0xFC,0xC0,0x00,0x7C,0xFC,0xC0,0x00,0x00,0xF0,0xF8,0x1C,0x0C,0x0C,0x1C,0x38,0xF0,0xC0,0x00,0x7C,0xFC,0xC0,0x00,0x00,0x00,0x3C,0xFC,0xC0,0x00,0x78,0xFC,0x0C,0x0C,0x00,0x1C,0x3C,0x7C,0xCC,0x8C,0x0C,0x0C,0x00,0x00,0x00},
    {0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x00,0x00,0x1F,0x7F,0xF0,0xC0,0x80,0x80,0x80,0x80,0xC0,0xF0,0x30,0x00,0x00,0x3F,0x3F,0x0C,0x18,0x38,0x20,0x00,0x3F,0x3F,0x00,0x00,0x03,0x1F,0x3C,0x20,0x00,0x0F,0x1F,0x33,0x31,0x31,0x38,0x18,0x00,0x30,0x3F,0xFC,0xB0,0x30,0x00,0x0C,0x1C,0x31,0x31,0x31,0x3F,0x1F,0x00,0x00,0x7F,0xFF,0x80,0x30,0x7F,0xFF,0xB0,0x30,0x07,0x0F,0x1C,0x38,0x30,0x30,0x38,0x1F,0x07,0x00,0x00,0x3F,0x3F,0x0C,0x10,0x30,0x30,0x3F,0x1F,0x00,0x30,0x3F,0xFC,0xB0,0x30,0x00,0x30,0x30,0x31,0x33,0x3E,0x3C,0x38,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x30,0x60,0xC0,0x80,0xC0,0x60,0x33,0x07,0x0F,0x1F,0x3F,0x60,0xC0,0x80,0xC0,0x60,0x30,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x01,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    };

    unsigned char logo2[4][132] =
    {
    {0x00,0xF8,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x08,0xF8,0x08,0xFF,0x10,0x08,0x18,0xF0,0x00,0x00,0x08,0x00,0x38,0xC0,0x00,0x38,0xC0,0x00,0xE0,0x18,0xE0,0x00,0xE0,0x18,0xE0,0x00,0xE0,0x18,0xE0,0x00,0xE0,0x18,0xE0,0x00,0xE0,0x18,0xE0,0x00,0xE0,0x18,0xE0,0x00,0x00,0x08,0x00,0xF0,0x08,0x08,0x30,0x00,0xF8,0x00,0x00,0x00,0x01,0xE1,0x1E,0xE0,0x00,0x00,0x30,0x88,0x88,0x70,0x00,0xF8,0x08,0x30,0x48,0x48,0x90,0xF8,0x00,0xF8,0x00,0xF8,0x00,0xF0,0x18,0x08,0x18,0xF0,0x00,0xF8,0x00,0x00,0x00,0xF8,0x00,0xF8,0x08,0x18,0x68,0x88,0x08,0x00,0x00,0x08,0x00,0xF0,0x08,0x08,0x30,0x00,0xF0,0x18,0x08,0x18,0xF0,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00},
    {0x00,0x3F,0x02,0x04,0x04,0x03,0x00,0x04,0x3F,0x04,0x3F,0x04,0x07,0x02,0x04,0x06,0x03,0x00,0x00,0x04,0x00,0x00,0x03,0x3C,0x00,0x03,0x3C,0x07,0x00,0x01,0x06,0x01,0x00,0x07,0x00,0x07,0x00,0x01,0x06,0x01,0x00,0x07,0x00,0x07,0x00,0x01,0x06,0x01,0x00,0x07,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x03,0x00,0x07,0x02,0x04,0x00,0x06,0x01,0x00,0x01,0x06,0x00,0x03,0x04,0x04,0x02,0x04,0x3F,0x04,0x03,0x04,0x04,0x04,0x03,0x00,0x3F,0x04,0x3F,0x24,0x03,0x06,0x04,0x06,0x03,0x00,0x07,0x02,0x04,0x04,0x03,0x04,0x3F,0x04,0x04,0x04,0x05,0x06,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x03,0x00,0x03,0x06,0x04,0x06,0x03,0x00,0x00,0x07,0x04,0x04,0x07,0x04,0x04,0x03,0x00},
    {0x00,0xF0,0x0C,0x02,0x02,0x02,0x0C,0x30,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0xF0,0x40,0x40,0x40,0xF0,0x0E,0x00,0x00,0xFE,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x06,0x1A,0x22,0xC2,0x82,0x02,0x00,0x00,0xF8,0x86,0x02,0x02,0x86,0xF8,0x00,0x00,0x18,0x04,0x02,0x02,0x84,0xF8,0x00,0x00,0x06,0x1A,0x22,0xC2,0x82,0x02,0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x02,0x0C,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x06,0x02,0x82,0x46,0x3C,0x00,0x00,0x00,0xF8,0x46,0x42,0x46,0xCC,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x46,0x42,0x46,0xCC,0x00,0x00,0x8C,0x42,0x42,0x22,0x3C,0x00},
    {0x00,0x0F,0x30,0x40,0x40,0x40,0x20,0x18,0x00,0x00,0x00,0x7F,0x41,0x41,0x41,0x41,0x40,0x00,0x00,0x01,0x3F,0x40,0x3E,0x01,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x30,0xFF,0x00,0x00,0x00,0x00,0x30,0xC0,0x80,0x80,0xC3,0x3E,0x00,0x00,0x3E,0xC3,0x81,0x81,0x43,0x3E,0x00,0x00,0x60,0x80,0x81,0x81,0xC3,0x3C,0x00,0x00,0x30,0xC0,0x80,0x80,0xC3,0x3E,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x61,0x41,0x40,0x60,0x18,0x00,0x00,0x00,0x01,0x06,0x04,0x06,0x01,0x00,0x00,0x00,0x07,0x03,0x06,0x00,0x00,0x47,0x00,0x00,0x00,0x01,0x06,0x04,0x06,0x01,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x00},
    };

    void oled_start()
    {
    I2CCFG &=~I2C_SI;
    I2CCFG |=I2C_STA;
    while((I2CCFG&I2C_SI)==0);
    I2CCFG &=~I2C_STA;
    }
    void oled_stop()
    {
    I2CCFG &=I2C_STO;
    I2CCFG |=~I2C_SI;
    while((I2CCFG&I2C_STO)!=0);
    }
    void oled_send(unsigned char x)
    {
    I2CDATA = x;
    I2CCFG &= ~I2C_SI;
    while ((I2CCFG & I2C_SI) == 0);
    }

    unsigned char oled_read()
    {
    I2CCFG &= ~I2C_SI;
    while ((I2CCFG & I2C_SI) == 0);
    return I2CDATA;
    }

    void oled_command(unsigned char cmd)
    {
    I2CCFG=I2C_SR;
    wait_ack(SR_SENT); //start_ack


    I2CDATA=0x78;
    I2CCFG=I2C_DO;
    wait_ack(SLAW_ACK_SENT); //slave address+W ack


    I2CDATA=0x00;
    I2CCFG=I2C_DO;
    wait_ack(DATA_ACK_SENT); //data sent ack


    I2CDATA=cmd;
    I2CCFG=I2C_DO;
    wait_ack(DATA_ACK_SENT); //data sent ack
    led1=1;
    led2=0;


    I2CCFG=I2C_SP;

    }
    void oled_data(unsigned char dat)
    {
    I2CCFG=I2C_SR;
    wait_ack(SR_SENT); //start_ack


    I2CDATA=0x78;
    I2CCFG=I2C_DO;
    wait_ack(SLAW_ACK_SENT); //slave address+W ack


    I2CDATA=0x40;
    I2CCFG=I2C_DO;
    wait_ack(DATA_ACK_SENT); //data sent ack

    I2CDATA=dat;
    I2CCFG=I2C_DO;
    wait_ack(DATA_ACK_SENT); //data sent ack


    I2CCFG=I2C_SP;

    }
    void i2c_init()
    {

    I2CCFG=I2C_DO;
    I2CWC |= ~0x80;
    }
    void oled_init()
    {
    RESET=0;
    delay(128);
    RESET=1;
    delay(128);
    /**oled_command(0xAE);
    oled_command(0xD5);
    oled_command(0x80);
    oled_command(0xA8);
    oled_command(0x1F);
    oled_command(0xD3);
    oled_command(0x00);
    oled_command(0x40);
    oled_command(0x8D);
    oled_command(0x14);
    oled_command(0xA1);
    oled_command(0xC8);
    oled_command(0xDA);
    oled_command(0x02);
    oled_command(0x81);
    oled_command(0xCF);
    oled_command(0xD9);
    oled_command(0xF1);
    oled_command(0xDB);
    oled_command(0x40);
    oled_command(0xA4);
    oled_command(0xA6);
    oled_command(0xAF);***/
    oled_command(0xAE);//--Set Display off

    led1=0;
    led2=1;

    oled_command(0x00);//--set low column address

    oled_command(0x10);//--set high column address

    oled_command(0x81);//--set contrast control register
    oled_command(0x7f);

    oled_command(0xa1);//--set segment re-map 95 to 0

    oled_command(0xA6);//--set normal display

    oled_command(0xa8);//--set multiplex ratio(1 to 16)
    oled_command(0x1f);//--duty 1/32

    oled_command(0xd3);//--set display offset
    oled_command(0x00);//--not offset

    oled_command(0xd5);//--set display clock divide ratio/oscillator frequency
    oled_command(0xf0);//--set divide ratio

    oled_command(0xd9);//--set pre-charge period
    oled_command(0x22);

    oled_command(0xda);//--set com pins hardware configuration
    oled_command(0x02);//disable left/right remap and set for sequential

    oled_command(0xdb);//--set vcomh
    oled_command(0x49);//--0.83*vref

    oled_command(0x8d);//--set DC-DC enable
    oled_command(0x14);//

    oled_command(0xAF);//--turn on oled panel

    oled_command(0xA4);//--Entire Display ON

    timer_delay(100);
    }


    void delay(unsigned char n)
    {
    while(n--)
    asm("nop");
    }
    void timer_delay(unsigned char m)
    {
    unsigned char i;
    T3CTL|=0x10;
    for(i=0;i<m;i++)
    {
    while((TIMIF&0x01)==0);
    T3OVFIF=0;
    }
    }

    void show_bitmap(unsigned char bitmap)
    {
    unsigned char j=0;
    unsigned char i=0;

    for(i=0;i<8;i++)
    {
    oled_command(0x00); //lower column address
    oled_command(0x10); //upper column address
    oled_command(0xB0+i); //set page address
    for(j=0;j<128;j++)
    {
    if(bitmap==0)
    {
    led1=0;
    led2=1;
    oled_data(logo1[i][j]);
    }
    else
    {

    oled_data(logo2[i][j]);
    }
    }
    }
    }

    void wait_ack(unsigned char ack)
    {
    while(I2CSTAT!=ack);
    }

    Regards,
    Krishna.

     

  • Hi Sarang,

    An important addition to the above query, as we are getting stuck at no offset command which is 0x00, whether it might be causing problem in communicating with the device.

    If in that case any solution regarding that command that helps in getting communication work will be very helpful for us. 

    Thanks& Regards,

    Krishna.

  • hi,Krishna
    i am doing the ssd1306 oled, i meer the problem the same as you,hou do you solve the problem? can you give some code. liming1837534@gmail.com

    Regards,
    Liming
  • I encountered a problem now. I followed your code , and exectued, bu it was blocked at the code
    wait_ack(SR_SENT);
    I'm also using CC2541 as a master, and the slave is MPU9250, I write it as a barehardware.
    I had checked the hardware, it's ok. I was confused by this questions a few days. Can you give me some questions?

    Thanks!
  • Hi Krishna,
    Now I use CC2541 as a master, and the slave is MPU9250. It was blocked at wait_ack(SR_SENT); //start_ack;
    The hardware was connected correctly, I was confused by this question some time. Can you give me some questions? I 'm just writing a baremachine.

    Thans & Best Regards
    By a new user