Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 216120

Forum Post: RE: I2C- MSP doesn't send data from UCB0TXBUF for 2nd byte to be sent

$
0
0

Hello Jens,

 When reading the slave device, I need to first send the register address of the slave I wish to read and then send the repeated START to start reading the device after setting the UCTR to 0(to set MSP as master receiver). but the repeated start never goes when I set the UCTR to 0 and then send START bit. Here is the code snippet :

UCB0CTL1 |= UCTXSTT;              // Send Start and slave address     UCB0TXBUF = 0x01;                 // Load TX buffer to send reg address     while(( UCB0CTL1 & UCTXSTT) != 0); // Wait for address to be sent     while(!(UCB0TXIFG & IFG2));      I2CReadInit();                    // Init I2C module for a read operation while(UCB0STAT & UCBBUSY); // wait for channel to become free     UCB0CTL1 |= UCTXSTT;              // re-start condition generation while (( UCB0CTL1 & UCTXSTT) != 0); // Wait for address to be sent

The MSP doesn't send the second START in the code. Could you explain why?. The busy bit is set though.

Viewing all articles
Browse latest Browse all 216120

Trending Articles



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