Tool/software: Code Composer Studio
Dear team,
My customer is using MSP430FR5738 I2C with DMA mode. He encountered a problem during debug the FR5738, which seems to be a bug in the 430 microcontroller.
1. P1.6/1.7 is configured as I2C Slave communication mode, and I2C Slave RX and Slave TX are configured in DMA mode. The configuration code is as follows:
Since the I2C accepts data, the reception length is not known in advance. So when the DMA is received, it indicates the end of one frame of data
when the STOP signal arrives, When the STOP signal arrives, the current DMA transfer ends.
I2C Config
void I2C_Slave_Init(unsigned char address)
{
UCB0CTLW0 |= UCSWRST; //reset I2C Module
UCB0CTLW0 |= UCMODE_3 + UCSYNC; //I2C Slave
UCB0CTLW1 &= ~USCI_I2C_UCCLTOIFG;
UCB0CTLW1 |= (0x01 << 6);
UCB0I2COA0 = address + UCOAEN; //I2C ADDRESS
//Set P1.6 & P1.7 on I2C MODE
P1SEL1 |= BIT6 + BIT7;
P1SEL0 &= ~BIT6;
P1SEL0 &= ~BIT7;
UCB0CTLW0 &= ~UCSWRST; //release reset I2C Module
UCB0IE__I2C |= UCSTPIE;//Enable I2C INTERRUPT
}
I2C Slave RX DMA config
void I2C_Slave_RX_DMA_Config()
{
DMA0CTL =
(0x00 << 12) //Single Transfer
|(0x03 << 10) //Dest Inc
|(0x00 << 8) //Src Unchange
|(0x01 << 7)
|(0x01 << 6);
DMA0SA = (unsigned int)&UCB0RXBUF;
DMA0DA = (unsigned int)buf;
DMA0SZ = 40;
DMACTL0 |= 18;//MSP430FR5738 I2C Slave RX Trigger
DMA0CTL |= DMAIE;
DMA0CTL |= DMAEN;
}
switch(__even_in_range(UCB0IV,0x1E))
{
case 0x08:
if(UCB0CTLW0_bit.UCTR == 0) //Receive
{
DMA I2C Slave RX ReConfig
}
else //Transmitter
{
DMA I2C Slave TX ReConfig
}
UCB0IFG = 0;
break;
default:
break;
}
main()
{
.....
I2C_Slave_Init();
I2C_Slave_RX_DMA_Config();
_EINT();
while(1)
{
...
....
//P2DIR_bit.P2DIR2 = 1;
}
}
a) If the configuration of the IO register is involved in the while(1) loop, the I2C Slave RX DMA reception will be problematic.
At present, two situations are detected. One is that the STOP signal is not recognized, and no interrupt is generated. The other is that the interrupt IFG flag has been generated, but there is no interrupt service routine. If it is paused once in the emulator and then run at full speed, Interrupt service routine
b) If there is no operation on the IO port in while(1), there is no problem with the entire I2C Slave RX DMA.
Please help.
BR,
Susan