单位的一个项目,cc2540外扩一个AD芯片采集数据,spi接口通信,Ti提供的demo里面没有spi驱动,所以在lcd基础上改动了一下,运行后,示波器测量SCK引脚没有信号呢?
U1DBUF寄存器里面时钟显示为0x00,求大侠们帮助看看,急~
void halENC28J60_SPI_Init(void)
{
//*********USART1,Alternative 2****************
PERCFG |= 0x02; // PERCFG.U1CFG = 1
P1SEL |= 0xE0; // P1_7, P1_6, and P1_5 are peripherals
P1SEL &= ~0x10; // P1_4 is GPIO (SSN)
P1DIR |= 0x10; // SSN is set as output
// init_Baudrate
//********** Set baud rate to 9600*************
U1BAUD = 0x3B; // BAUD_M = 59
U1GCR &= 0xA0; // Positive clock polarity; MOSI @ __/^^ clk; MSB first
U1GCR |= 0x08; // BAUD_E = 8
// SPI Master Mode
U1CSR &= 0x01;
// Configure phase, polarity, and bit order
U1GCR |= 0x80; // CPOL = 1
U1GCR |= 0x20; // ORDER = 1
P1_4 = 1;
while(1)
{
HalENC28J60_HW_WriteByte(0x11);
}
}
/**************************************************************************************************
* @fn HalENC28J60_HW_WriteByte
*
* @brief Write 1 byte to the ENC28J60
*
* @param uint8 data - data to be written to the ENC28J60
*
* @return None
**************************************************************************************************/
void HalENC28J60_HW_WriteByte(uint8 data)
{
ENC28J60_SPI_BEGIN();
ENC28J60_SPI_TX(data);
ENC28J60_SPI_WAIT_RXRDY();
ENC28J60_SPI_END();
} |