Quantcast
Channel: MSP 低功耗微控制器论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 3634

I2C从机问题

$
0
0

使用MSP430FR2311 I2C作为从机,主机发送从机地址后,没有返回正确的状态(没有收到ACK???)。示波器能量到发送出去的从机地址波形

从机代码如下:

P1SEL0 |= BIT2 | BIT3;

//Disable the USCI module
UCB0CTLW0 = UCSWRST;

//Clear USCI master mode
UCB0CTLW0 &= ~UCMST;

//Configure I2C as Slave and Synchronous mode
UCB0CTLW0 |= UCMODE_3 | UCSYNC;

//Set up the slave address.
UCB0I2COA0 = SMspI2c_SlaveAddr | UCOAEN; // own address is 0x48 + enable

//UCB0CTLW1 &= ~UCETXINT;

UCB0CTLW0 &= ~UCSWRST; // clear reset register

//Clear the I2C interrupt source.
UCB0IFG &= ~(UCRXIFG0 | UCTXIFG0);

//Enable the interrupt masked bit
UCB0IE |= (UCRXIE0 | UCTXIE0);

__bis_SR_register(GIE);


Viewing all articles
Browse latest Browse all 3634

Trending Articles