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

twim (I2C) doesn't send anything

Hy everyone!

I'm trying to write a non-volatile memory position of a device via I2C (twi), the device, a flash memory is the slave.

In my application, I have configure the twi, enable it, then, I send the data. But, in my event handler, any event is trigered of the three posible, neither transfer done, nor not acknowledge after dev addres or after data.

To find the problem, I connected the oscilloscope to the SDA pin, and the only thing that SDA makes is tho start low ath the beginning of the execution, and then goes up forever : image description Debugging, i have found that SDA makes this just after nrf_drv_twi_init

I have compared muy code with the examples given in the SDK and I d'ont see any diferent, here is my code: main.c, what I'm doing wrong?

If it can help, here is the write secuence, and the device addres

The byte write secuence is the following: image description

here is how Dev Select and Byte address are formed image description

Thank you all guys!!

Parents
  • Finally I have solved the problem, first of all, to capture correctly the SCL and SDA signals, I have configured the triger of the oscilloscope and the mode in single, instead continous samples. The problem was that the signal wasn't correct, and this makes that the slave doesn't recieve all the bits of the device address correctly, so the respose hasn't ACK, this is the signal that caused me problems: image description

    Connecting a 2K2Ohms resistors in both SDA and SCL lines improves the signal quality, and the slave deice can "undertand" the bits (in this case I was trying random bytes and there isn't ACK in the response because this isn't my slave device address): image description

Reply
  • Finally I have solved the problem, first of all, to capture correctly the SCL and SDA signals, I have configured the triger of the oscilloscope and the mode in single, instead continous samples. The problem was that the signal wasn't correct, and this makes that the slave doesn't recieve all the bits of the device address correctly, so the respose hasn't ACK, this is the signal that caused me problems: image description

    Connecting a 2K2Ohms resistors in both SDA and SCL lines improves the signal quality, and the slave deice can "undertand" the bits (in this case I was trying random bytes and there isn't ACK in the response because this isn't my slave device address): image description

Children
No Data
Related