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.

Issues with reading from TCA8418 through I2C (on Launchpad)

Other Parts Discussed in Thread: TCA8418, MSP430G2553

Hi there,

I'm trying to read from register once an interrupt is set by a button press on a keypad hooked up to a TCA8418 (EVM). I followed this setup guideline in the datasheet:

But only perform the first four since that's all I'm testing right now:

Everything works fine, the interrupt trips and the microcontroller detects it. I then try to read register 0x02 to see what tripped the interrupt using the datasheet directions:

..trying to perform a read as asked:

I'm not sure if the TI_USCI_I2C_master can perform repeated starts, but here's what I tried:

read8418 has the 0x02 address, and readed8418 is just an empty char array.

When run however, transmission starts but it just randomly stops and both lines just pull low:

Would anyone happen to know if this is a failed transmission or a coding issue on my part? Thank you for reading!

  • Hi Oscar,
    What LaunchPad are you using? Does the code get stuck?

    It LOOKS like your problem is that you are using interrupt driven functions within an interrupt, which will prevent the interrupt flags from being reset, and therefore causing the USCI to wait for UCTXIFG to reset. This would cause SCL to pull low.

    From Users Guide:
    "The UCSCLLOW bit is also active if the USCI holds SCL low because it is waiting as transmitter for data
    being written into UCBxTXBUF or as receiver for the data being read from UCBxRXBUF."

    Try implementing this using software flags, so that these functions can be called outside of an interrupt.

    If that doesn't work, let me know.


    Best regards,
    Cameron
  • Hello Oscar,

    You did a great job documenting your steps.

    There are some threads in the MSP430 forum that deal with how to do a repeated start: 

    This looks to be rather involved in the MSP430 case, but it is acceptable to do a STOP condition followed by a START condition instead of a repeated start. The easily fix for your software would be to have a STOP bit, then send a start bit again. Simply add a stop bit after the ACK (before the line you attempt to repeated start) and you should be ok.

  • This did it! Moving everything outside the interrupt.

    Jonathan was also correct, a repeated start can be substituted with a stop then start again. I was using the MSP430G2553 as well.

    Thanks again guys!
  • Oscar,
    Excellent job!
    Would you mind zipping up your project and attaching to a post here so that others may learn from it about this issue?

    Best regards,
    Cameron

**Attention** This is a public forum