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.

I2C issues with displaying data on oscilloscope

Hi,

I'm working on the MSP4305310 along with M24LR64E and using I2C as the method to transmit and receive data. When debugging the code step by step I'm able to see the slave address and later bytes (the later bytes however are shown on the oscilloscope after I restart the debugger and that's when they get released). So my first problem is why that happens? My second is that when debugging the code and just hitting the 'go' button and not stepping through the code, why is it that I only see the slave address and the NACK bit? Even if I do restart the debugger, no data is released then either.

If anyone knows what the issues could be, please let me know. I know I haven't posted any code but I was hoping these were more general questions and did not need code posted.

Thank you

  • Hello Nora,

    The I2C protocol requires the adherence to certain timing conditions.  Single stepping through the code violates the timing condition and the slave controller should reset.  You will be able to see the data produced by single stepping, however, you are not communicating with the slave device.

    If you are only seeing the slave address and the NACK bit, that would mean that the slave device probably not being addressed properly.  Possibly the E0, E1or E2 pins are not configured correctly.

    Thanks,

  • Thanks for the reply greenja.

    I'm a bit confused with how I'm still seeing data even though I'm not actually communicating with the slave device. Can you please elaborate on that.

    According to the data sheet, the Device Select Code is 1 0 1 0 E2 1 1 RW. So for E2, I set the bit to 1 so that I can access user memory and not the control registers. As for the RW bit that's set by the registers from the MSP430 chip. Does that seem okay to you? Because I thought my addressing was being done correctly. Please correct me if I'm wrong.

    Thanks Again

  • I would think that when you single step you should be able to see output up to the point where the slave has to ACK.  Be fore that point, there is no acknowledgement required.  If I remember correctly, after the master starts, there has to be a pulling of the line low.  Do you have a pull proper pullups on both lines?  10k usually works well.

    Philips(NXP) has a very good app note describing the details of their I2C protocol.  Search the Internet for it, it is very helpful.

    Thanks,

  • Nora, apparently your code does not properly wait for the actual transfers. When single-stepping 8especially if the debugger doesn't stop the clock for th ebaudrate generator), the hardware has enough time to complete a transfer. But when you run through the code, the transfer isn't completed whily your code assumes it is and continues.

    You didn't post your code, so I don't know what is really happening. But it is a common mistake to assume that after initiating a process, such as writing to TXBUF or starting an ADC conversion, the CPU will stop until the byte has been sent or the conversion is complete. It won't. You'll have to check interrupt and status flags to be sure that the transfer is done and you can continue. And in the meantime, you can do completely different things with the CPU, if you want.

**Attention** This is a public forum