This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5529: usci_b0_vector : Interrupt is not getting generated.

Part Number: MSP430F5529
Other Parts Discussed in Thread: TLV320DAC3100

Interrupt is not getting generated for my code.

here is my code:

#include "driverlib.h"
//*****************************************************************************
//! This example shows how to configure the I2C module as a master for
//! multi byte transmission in interrupt driven mode. The address of the slave
//! module is set in this example.
//!
//! This example uses the following peripherals and I/O signals. You must
//! review these and change as needed for your own board:
//! - I2C peripheral
//! - GPIO Port peripheral (for I2C pins)
//! - SCL2
//! - SDA
//!
//! This example uses the following interrupt handlers. To use this example
//! in your own application you must add these interrupt handlers to your
//! vector table.
//! - USCI_B0_VECTOR.
//
//*****************************************************************************
//*****************************************************************************
//
//Set the address for slave module. This is a 7-bit address sent in the
//following format:
//[A6:A5:A4:A3:A2:A1:A0:RS]
//
//A zero in the "RS" position of the first byte means that the master
//transmits (sends) data to the selected slave, and a one in this position
//means that the master receives data from the slave.
//
//*****************************************************************************
#define SLAVE_ADDRESS 0x30
//*****************************************************************************
//
//Specify number of bytes to be transmitted
//
//*****************************************************************************
#define TXLENGTH 0x04
#define RXCOUNT 0x02

uint8_t transmitData[40] = { 0x00,
0x01,
0x01,
0x01};

uint8_t transmitCounter = 0;

unsigned char receiveBuffer[10] = { 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char *receiveBufferPointer;
unsigned char receiveCount = 0;

void Transmit_enable(void);
void Receive_enable(void);

void main()
{
//Stop WDT
WDT_A_hold(WDT_A_BASE);

//Assign I2C pins to USCI_B0
GPIO_setAsPeripheralModuleFunctionInputPin(
GPIO_PORT_P3,
GPIO_PIN1 + GPIO_PIN2 + GPIO_PIN0
);

GPIO_setOutputHighOnPin(GPIO_PORT_P2,
GPIO_PIN0);

//Initialize Master
USCI_B_I2C_initMasterParam param = {0};
param.selectClockSource = USCI_B_I2C_CLOCKSOURCE_SMCLK;
param.i2cClk = UCS_getSMCLK();
param.dataRate = USCI_B_I2C_SET_DATA_RATE_400KBPS;
USCI_B_I2C_initMaster(USCI_B0_BASE, &param);

//Specify slave address
USCI_B_I2C_setSlaveAddress(USCI_B0_BASE,
SLAVE_ADDRESS
);

//Enable I2C Module to start operations
USCI_B_I2C_enable(USCI_B0_BASE);

while(1)
{
Transmit_enable();
//Enable transmit Interrupt
USCI_B_I2C_clearInterrupt(USCI_B0_BASE,
USCI_B_I2C_TRANSMIT_INTERRUPT
);
USCI_B_I2C_enableInterrupt(USCI_B0_BASE,
USCI_B_I2C_TRANSMIT_INTERRUPT
);

//Delay between each transaction
__delay_cycles(50);

//Load TX byte counter
transmitCounter = 1;

//Initiate start and send first character
USCI_B_I2C_masterSendMultiByteStart(USCI_B0_BASE,
transmitData[0]
);

__disable_interrupt(); // To avoid a race condition

//__bis_SR_register(LPM0 + GIE);
//__bis_SR_register(GIE);
//Enter LPM0 with interrupts enabled
__bis_SR_register(LPM0_bits + GIE);
__no_operation();

//Delay until transmission completes
while(USCI_B_I2C_isBusBusy(USCI_B0_BASE))
{
;
}

Receive_enable();
receiveBufferPointer = (unsigned char *)receiveBuffer;
receiveCount = RXCOUNT;

//Initialize multi reception
USCI_B_I2C_masterReceiveMultiByteStart(USCI_B0_BASE);

//Enter low power mode 0 with interrupts enabled.
__bis_SR_register(LPM0_bits + GIE);
__no_operation();
}
}

void Transmit_enable(void)
{
//Set Transmit mode
USCI_B_I2C_setMode(USCI_B0_BASE,
USCI_B_I2C_TRANSMIT_MODE
);
}

void Receive_enable(void)
{
//Set Transmit mode
USCI_B_I2C_setMode(USCI_B0_BASE,
USCI_B_I2C_RECEIVE_MODE
);

//Enable master Receive interrupt
USCI_B_I2C_enableInterrupt(USCI_B0_BASE,
USCI_B_I2C_RECEIVE_INTERRUPT
);

}

//******************************************************************************
//
//This is the USCI_B0 interrupt vector service routine.
//
//******************************************************************************
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_B0_VECTOR
__interrupt
#elif defined(__GNUC__)
__attribute__((interrupt(USCI_B0_VECTOR)))
#endif
void USCI_B0_ISR(void)
{
switch(__even_in_range(UCB0IV,12))
{
case USCI_I2C_UCTXIFG:
{
//Check TX byte counter
if(transmitCounter < TXLENGTH)
{
//Initiate send of character from Master to Slave
USCI_B_I2C_masterSendMultiByteNext(USCI_B0_BASE,
transmitData[transmitCounter]
);

//Increment TX byte counter
transmitCounter++;
}
else
{
//Initiate stop only
USCI_B_I2C_masterSendMultiByteStop(USCI_B0_BASE);

//Clear master interrupt status
USCI_B_I2C_clearInterrupt(USCI_B0_BASE,
USCI_B_I2C_TRANSMIT_INTERRUPT);

//Exit LPM0 on interrupt return
__bic_SR_register_on_exit(LPM0_bits);
}
break;
}
case USCI_I2C_UCRXIFG:
{
//Decrement RX byte counter
receiveCount--;

if(receiveCount)
{
if(receiveCount == 1)
{
//Initiate end of reception -> Receive byte with NAK
*receiveBufferPointer++ =
USCI_B_I2C_masterReceiveMultiByteFinish(
USCI_B0_BASE
);
}
else
{
//Keep receiving one byte at a time
*receiveBufferPointer++ = USCI_B_I2C_masterReceiveMultiByteNext(
USCI_B0_BASE
);
}
}
else
{
//Receive last byte
*receiveBufferPointer = USCI_B_I2C_masterReceiveMultiByteNext(
USCI_B0_BASE
);
__bic_SR_register_on_exit(LPM0_bits);
}
break;
}
}
}

I am Interfacing MSP430F5529 as a master and TLV320DAC3100 Audio DAC which is a slave device.

As per the datasheet of TLV320DAC3100 slave address is 0x30.

I am using the library code as a reference.

I am not able to generate a interrupt. Is there anything is wrong with the Code?

**Attention** This is a public forum