各位大神!!求问啊,我在使用MSP430F6638的SPI主从机例程时,主机的数据UCA0TXBUF确实在增加,我调试从机时,发现没有进入USCI_A0_ISR中断里面进行数据接收啊,请问这是怎么回事啊?而且从机里面有一个p1.4的中断,主机里面也没有啊,不太明白到底是怎么做的额?下面是例程中主机和从机的功能注释,主机:MSP430F66x Demo - USCI_A0, SPI 3-Wire Master Incremented Data//
// Description: SPI master talks to SPI slave using 3-wire mode. Incrementing
// data is sent by the master starting at 0x01. Received data is expected to
// be same as the previous transmission. USCI RX ISR is used to handle
// communication with the CPU, normally in LPM0. If high, P1.0 indicates
// valid data reception. Because all execution after LPM0 is in ISRs,
// initialization waits for DCO to stabilize against ACLK.
//
// ACLK = ~32.768kHz, MCLK = SMCLK = DCO ~ 1048kHz. BRCLK = SMCLK/2
//
// Use with SPI Slave Data Echo code example. The master code example uses
// a GPIO P1.1 to reset the SPI slave state machine.
从机: MSP430F66x Demo - USCI_A0, SPI 3-Wire Slave Data Echo
//
// Description: SPI slave talks to SPI master using 3-wire mode. Data received
// from master is echoed back. USCI RX ISR is used to handle communication,
// CPU normally in LPM0. Prior to initial data exchange, master pulses
// slaves USCI RST using an interrupt on P1.4.
//
// ACLK = ~32.768kHz, MCLK = SMCLK = DCO ~ 1048kHz
//
// Use with SPI Master Incremented Data code example.
我把程序下载进去,连接好两块单片机的引脚,那个指示灯也没有亮啊!有人知道怎么验证这个代码吗?
此帖出自
小平头技术问答
调试主模块数据确实在输出,UCA0TXBUF__SPI的数据时在递增的。但是怎么调试从模块啊,我单步看从机的程序, 运行到这里__bis_SR_register(LPM4_bits + GIE); // Enter LPM4, enable interrupts就不走了啊,rx寄存器也没有值,是我调试的方法不对吗?硬件接线我把spi三线接在一起,再把片选从机也也接好了,这样接不对吗??求解啊
从机一样调试,主机的MOSI输出接从机的MISO,主机的输入MISO接从机的MOSI,时钟接在一起,片选接在一起,去除那个__bis_SR_register(LPM4_bits + GIE); 代码。这个进入低功耗模式4,肯定测不了
一周热门 更多>