This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I2c protocol.

Dear Sir,

i am using pca10001.

Actually i tried to read and write the data from EEPROM having address 0x50 though i2cbus.

i made po.0 and p0.1 as output pin then clk and sda pin respectively.

i done every thing. but once i start NWF_TWI0->STARTTX=1;

i am not geeting ack from slave.

infact ERRORSRC=2 and EVENTS_ERROR=1.

Is it needed to make data pin again as input to get ack from slave.

and is needed to send slave address or just put in ADDRESS register is sufficient. Kindly suggest me.

if you want i will post my code also.

Regards Balaji

Parents
  • uint8_t addw = 0x39; // address of the device bool f_t = false; uint8_t dataW[2] = {0X03, 0x83}; // commands

    uint8_t addr = (0x39 | 0x01);
    uint8_t dataR[2] = {0x00, 0x00}; 
    

    if(twi_master_init()) {

    f_t = twi_master_transfer(addw, &dataW[0], 1 , true);

    nrf_delay_ms(1000);

    f_t = twi_master_transfer(addw, &dataW[1], 1 , true);

    nrf_delay_ms(1000);

    f_t = twi_master_transfer(addr, dataR, 1, true);

    f_t - is just for debugging purpose to check the return value - true / false

    every tme i am getting f_t as ZERO, that means transfer fails!

Reply
  • uint8_t addw = 0x39; // address of the device bool f_t = false; uint8_t dataW[2] = {0X03, 0x83}; // commands

    uint8_t addr = (0x39 | 0x01);
    uint8_t dataR[2] = {0x00, 0x00}; 
    

    if(twi_master_init()) {

    f_t = twi_master_transfer(addw, &dataW[0], 1 , true);

    nrf_delay_ms(1000);

    f_t = twi_master_transfer(addw, &dataW[1], 1 , true);

    nrf_delay_ms(1000);

    f_t = twi_master_transfer(addr, dataR, 1, true);

    f_t - is just for debugging purpose to check the return value - true / false

    every tme i am getting f_t as ZERO, that means transfer fails!

Children
No Data
Related