Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21927

I2C trouble when trying to hookup the MPR121 capacitive touch breakout sensor to an MSP430FR5969

$
0
0

Hi guys,

I've recently been tasked with porting this arduino code https://github.com/sparkfun/MPR121_Capacitive_Touch_Breakout/blob/master/Firmware/MPR121Q/Arduino%20Sketch/mpr121.ino to an MSP430FR5969. I've never used I2C before, and I'm having trouble getting it working on the 5969. You can find my code at http://pastebin.com/KVfe3i2V.

From what I can tell, the device gets stuck in Step 4 in the setup() method while trying to initialize the registers of the MPR121. I used saleae's logic analyzer to snoop the SDA/SCL lines, and this is what shows up: 

It looks like the 5969 sends a start containing the slave address, but it appends a read bit (pretty sure I want to write to the MPR121 regs not read), and the MPR responds by holding the SDA line low indefinitely afterwards. Because of this, the 5969 gets held up waiting for the TX bus to be clear.

There is a bit you can set in the UCB0CTLW0 register called UCTR, which indicates whether the master is receiving or transmitting. I tried to set this in hopes that it would change the 5969's read request to a write, but it causes the program to hang and not even send a start request.

If I understand the protocol correctly, the 5969 should send a write request->MPR sends an ack bit->5969 sends the reg to be written to->MPR sends an ack bit->5969 sends value to be written->MPR sends an ack bit->5969 sends stop request.

Here are the MPR121, MSP430FR5969, and MSP430FR59xx data sheets for reference:

1) https://www.sparkfun.com/datasheets/Components/MPR121.pdf

2) http://www.ti.com/lit/ds/symlink/msp430fr5969.pdf

3) http://www.ti.com/lit/ug/slau367k/slau367k.pdf


Viewing all articles
Browse latest Browse all 21927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>