|
我现在通过主控芯片的SPI和mcp2515进行通讯,mcp2515进行初始化配置之后,无法正常发送数据,请问是怎么回事?
mcp2515初始化程序如下:
void mcp2515_init(void)
{
unsigned char temp[4] = { 0, 0, 0, 0 };
spi_init();
MCP2515_CS_L;
spi_write( SPI_RESET );
MCP2515_CS_H;
mcp2515_bit_modify( CANCTRL, 0xE0, (1<
mcp2515_write_register( CNF1, (1<
mcp2515_write_register( CNF2, (1<
mcp2515_write_register( CNF3, (1<
mcp2515_write_register( CANINTE, /*(1<
mcp2515_write_register( RXB0CTRL, (1<
mcp2515_write_register( RXB1CTRL, (1<
mcp2515_write_register_p( RXF0SIDH, temp, 4 );
mcp2515_write_register_p( RXF1SIDH, temp, 4 );
mcp2515_write_register_p( RXF2SIDH, temp, 4 );
mcp2515_write_register_p( RXF3SIDH, temp, 4 );
mcp2515_write_register_p( RXF4SIDH, temp, 4 );
mcp2515_write_register_p( RXF5SIDH, temp, 4 );
mcp2515_write_register_p( RXM0SIDH, temp, 4 );
mcp2515_write_register_p( RXM1SIDH, temp, 4 );
mcp2515_write_register( BFPCTRL, 0 );
mcp2515_write_register( TXRTSCTRL, 0 );
mcp2515_bit_modify( CANCTRL, 0xE0, 0);
}
|
|