Hello,
I have problem with communication to DS1803 using hardware I2C of msp430 .
My code is
#include "cc430x513x.h"
void I2C_init(void)
{
PMAPPWD = 0x02D52; // Get write-access to port mapping regs
PMAPCTL |= PMAPRECFG; //Allow reconfiguration of port mapping
P1MAP1 = PM_UCB0SCL; // Map PM_UCB0SCL output to P1.1
P1MAP0 = PM_UCB0SDA; // Map PM_UCB0SDA output to P1.0
PMAPPWD = 0;
UCB0CTL1 |= UCSWRST; // Enable SW reset
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB0CTL1 |= UCSSEL_3 + UCSWRST; // Use SMCLK, keep SW reset
UCB0BR0 = 12; // fSCL = SMCLK/12 = ~100kHz
UCB0BR1 = 0;
UCB0I2CSA = 0x28; // Set slave address
P1SEL |= BIT0+ BIT1;
P1DIR |= BIT0+ BIT1;
UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
}
void I2C_send(void)
{
__disable_interrupt(); // Global interrupt disable
UCB0CTL1 |= UCTR+UCTXSTT; // Switch to I2C transmit mode, send START condition
UCB0TXBUF = 0xAF; // Send control byte 10101111 -setting both wipers
UCB0TXBUF = 0xFF; // Send wipers position on FULL(VCC)
UCB0CTL1 |= UCTXSTP; // STOP condition send
__enable_interrupt(); //global interrupt enable
}
and when I call up the I2C-send function it goes through whole code without hunging, but on the scope I can see that were send only start condition, adress, write mode, and control bite marked by yellow. Next in the row should be sent data bate, but as you can see below on the picture it is not. My ask have someone had similar problem and can help me? Is there any very simple example how to use hardware I2C?