Quantcast
Channel: Power management
Viewing all articles
Browse latest Browse all 81025

Forum Post: TPS65180* I2C

$
0
0

Hello. I'm using msp430f5438a and tps65180a.

I'll tried to I2C communication msp430 with tps65180. but it doesn´t work.

I hope V3P3_SW_EN set by 1.

const unsigned char TxData[] =              // Table of data to transmit
{
 0x01, // ENABLE Register address
 0x20 // set V3P3_SW_EN 1 (Switch is ON)
};

void I2C_UCB3_Send(unsigned char *data, unsigned int count) {
 PTxData = (unsigned char *)data;  // TX array start address
 TXByteCtr = count;      // Load TX byte counter
}

void PMIC_Init(void)
{
 // WAKEUP High :: P2.7 & PWRx ALL Low :: P2.3~2.6
 P2DIR |= 0xF8; // 11111000(2)

 // PMIC STANDBY Mode
 P2OUT |= 1 << 7; // WAKEUP High

 P2OUT &= ~(1 << 3); // PWR3 Low
 P2OUT &= ~(1 << 4); // PWR2 Low
 P2OUT &= ~(1 << 5); // PWR1 Low
 P2OUT &= ~(1 << 6); // PWR0 Low

 // PMIC I2C Initialize
 P10SEL |= 0x06;       // P10.1, P10.2 option select

 UCB3CTL1 |= UCSWRST;                      // Enable SW reset
 UCB3CTL0 = UCMST + UCMODE_3 + UCSYNC;     // I2C Master, synchronous mode
 UCB3CTL1 = UCSSEL_2 + UCSWRST;            // Use SMCLK, keep SW reset
 UCB3BR0 = 12;                             // fSCL = SMCLK/12 = ~100kHz
 UCB3BR1 = 0;
 UCB3I2CSA = 0x48;                         // Slave Address is 048h
 UCB3CTL1 &= ~UCSWRST;                     // Clear SW reset, resume operation
 UCB3IE |= UCTXIE;

 TXByteCtr = 1;
 while(UCB2CTL1 & UCTXSTP);
 UCB3CTL1 |= UCTR + UCTXSTT;             // I2C TX, start condition
 I2C_UCB3_Send(PTxData, 2);
}

#pragma vector = USCI_B3_VECTOR
__interrupt void USCI_B3_ISR(void)
{
 switch(__even_in_range(UCB3IV,12))
 {
  case  0: break;                           // Vector  0: No interrupts
  case  2: break;                           // Vector  2: ALIFG
  case  4: break;                           // Vector  4: NACKIFG
  case  6: break;       // Vector  6: STTIFG
  case  8: break;                           // Vector  8: STPIFG
  case 10: break;                           // Vector 10: RXIFG
  case 12:        // Vector 12: TXIFG
   if (TXByteCtr)                          // Check TX byte counter
   {
     UCB3TXBUF = *PTxData++;               // Load TX buffer
     if(TXByteCtr > 0)
      TXByteCtr--;                      // Decrement TX byte counter
   }
   else
   {
     UCB3CTL1 |= UCTXSTP;
     UCB3IFG & ~UCTXIFG;
     __bic_SR_register_on_exit(LPM0_bits);
   }
  default:
   break;
 }
}

I wantsomeoneto findthe problem.

Greetings

JH.KIM


Viewing all articles
Browse latest Browse all 81025

Trending Articles



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