I am trying to interface the LMP 91000 evaluation board with a Microchip 16F877 microcontoller.
I have tried the built-in I2C functions but can not get an Ack for the 9th bit. Using a scope the SDA line stays around 1.8V for the Ack bit.
I have also tried programming the MENB, SDA and SCL directly, here the SDA stays low when I convert the PIN from output to input until the SCL line drops for the 9th bit then the SDA line climbs anywhere from 1 V to 5V for around 9 micro-seconds. (see scope picture for fixed unti addr 1001000+0 for a write)
Is this an Ack or Nack response? From the timings section the ACK is valid from the drop of the SCL line for a max of 3.45 us (does not specifiy a min time).
Hi Darren,
i try to do the same, but i use the msp430f2274 with LMP 91000. http://www.ti.com/product/LMP91000#technicaldocumentsIn two msp430f2274 the i2c code it working but when i connet the lmp91000 i can't see the Ack or Nack response.this is parts of the code......while(1){ // minb ____ ________ P1OUT = 0x01; // |_________________________| P1OUT &=~0x01; switch(i) { case 1:// (direc) lock=0x01, (data) unlock=0x00 P1OUT &=~0x01; address=0x48; MSData=0x01; Setup_TX(); RPT_Flag = 1; Transmit(); while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent //Receive process Setup_RX(); Receive(); RXdato[0]=UCB0RXBUF; while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent i=i+1; P1OUT = 0x01; break; case 2: // TIACN =0X10, data=18 ( GAIN=110=>120K , Rload=00=>10 ohm) P1OUT &=~0x01; address=0x48; MSData=0x00; Setup_TX(); RPT_Flag = 1; Transmit(); while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent //Receive process Setup_RX(); Receive(); RXdato[1]=UCB0RXBUF; while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent i=i+1; P1OUT = 0x01; break;.....................................//***********************************SETUP TX + TRANSMIT **************}void Setup_TX(void){ // _DINT(); RX = 0; IE2 &= ~UCB0RXIE; while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent// Disable RX interrupt UCB0CTL1 |= UCSWRST; // Enable SW reset UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset UCB0BR0 = 12; // fSCL = SMCLK/12 = ~100kHz UCB0BR1 = 0; UCB0I2CSA = address; // Slave Address is 048h UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation IE2 |= UCB0TXIE; // Enable TX interrupt} void Transmit(void){ PTxData = &MSData; // TX array start address TXByteCtr = NUM_BYTES_TX; // Load TX byte counter while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts }//*********************************** SETUP RX + RECEIVE **************void Setup_RX(void){ _DINT(); RX = 1; IE2 &= ~UCB0TXIE; UCB0CTL1 |= UCSWRST; // Enable SW reset UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset UCB0BR0 = 12; // fSCL = SMCLK/12 = ~100kHz UCB0BR1 = 0; UCB0I2CSA = address; // Slave Address is 048h UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation IE2 |= UCB0RXIE; // Enable RX interrupt}void Receive(void){ PRxData = (unsigned char *)RxBuffer; // Start of RX buffer RXByteCtr = NUM_BYTES_RX-1; // Load RX byte counter while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent UCB0CTL1 |= UCTXSTT; // I2C start condition __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts}
-----------------------------------------------------------------------------------------------
If anyone has an idea of what the problem could be I would really apreciate it.
Thanks,
Juan
the LMP91000 eval board is provided wiht a I2C level shift. So if you do not receive any ACK or NACK the reaosn is that the Level Shift is not biased.
In order to make it working apply to the GPSI16.13 pin the same voltage you have applied to the VDD pin of the LMP91000.
Please refer to the conenction diagram in page 6 of the Application NOTE AN-2230 (http://www.ti.com/lit/an/snaa138a/snaa138a.pdf)
Best regards,
Domenico
Darren Valantine I am trying to interface the LMP 91000 evaluation board with a Microchip 16F877 microcontoller. I have tried the built-in I2C functions but can not get an Ack for the 9th bit. Using a scope the SDA line stays around 1.8V for the Ack bit. I have also tried programming the MENB, SDA and SCL directly, here the SDA stays low when I convert the PIN from output to input until the SCL line drops for the 9th bit then the SDA line climbs anywhere from 1 V to 5V for around 9 micro-seconds. (see scope picture for fixed unti addr 1001000+0 for a write) Is this an Ack or Nack response? From the timings section the ACK is valid from the drop of the SCL line for a max of 3.45 us (does not specifiy a min time).