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

TWI : Is there a Nordic sample app that uses twi_hw_master.c

I have implemented my own I2C driver and I am getting issues with NACKs. On review my code is doing what twi_hw_master.c is doing.

I then went looking for a Nordic sample app that uses twi_hw_master.c

Could not find it in obvious places.

Does anyone know where I can find a .uvproj that references that file?

Thank you in advance

Parents
  • Hi

    When I write data to a slave using the TWI peripheral (my driver based on code from twi_hw_master.c) the ACK from the slave does not go all the way down to the same level as when I read and the nrf is ACKing the data to the slave.

    In desperation, I have changed my code so that it calls the helper functions in twi_sw_master.c and this time I see that the ACK from the same slave goes down as low as an ACK from the nrf.

    My next step is take twi_hw_master.c and use helper functions in there and see if I see any changed behaviour. I still cannot find any Nordic sample apps that use twi_hw_master.c

    Will keep you updated.

    I wonder why Nordic provided twi_sw_master.c which bit-bangs in the first place !!

Reply
  • Hi

    When I write data to a slave using the TWI peripheral (my driver based on code from twi_hw_master.c) the ACK from the slave does not go all the way down to the same level as when I read and the nrf is ACKing the data to the slave.

    In desperation, I have changed my code so that it calls the helper functions in twi_sw_master.c and this time I see that the ACK from the same slave goes down as low as an ACK from the nrf.

    My next step is take twi_hw_master.c and use helper functions in there and see if I see any changed behaviour. I still cannot find any Nordic sample apps that use twi_hw_master.c

    Will keep you updated.

    I wonder why Nordic provided twi_sw_master.c which bit-bangs in the first place !!

Children
  • I incorporated twi_hw_master.c in my app and it works. That code polls the EVENT_TXDSENT bit

    My own code, seems to do all the same preperation work but instead of polling EVENT_TXDSENT it enables irq and then waits for a flag that the irq handle sets.

    In my irq scheme the ACK from the slave is not going down low enough implying that the S0D1 is not functioning when the address is written.

    I must be doing something wrong but cannot understand what.

  • I incorporated twi_hw_master.c in my app and it works. That code polls the EVENT_TXDSENT bit

    My own code, seems to do all the same preperation work but instead of polling EVENT_TXDSENT it enables irq and then waits for a flag that the irq handle sets.

    In my irq scheme the ACK from the slave is not going down low enough implying that the S0D1 is not functioning when the address is written.

    I must be doing something wrong but cannot understand what.

Related