AN2320 Freescale Semiconductor / Motorola, AN2320 Datasheet - Page 21

no-image

AN2320

Manufacturer Part Number
AN2320
Description
Interfacing the MCF5272 to a Standalone CAN Controller
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
CAN Transmit and Receive
/*Msg obj interrupt pending flag reset*/
QSPI_SendByte(CAN_MSG_CTRL + (Msg*0x20), 0xFD);
/*Msg obj remote request flag reset*/
QSPI_SendByte(CAN_MSG_CTRL+ (Msg*0x20),0x7F);
/*Msg obj transmission request flag reset*/
QSPI_SendByte(CAN_MSG_CTRL+1 + (Msg*0x20), 0xDF);
/*Inhibit transmission for Tx or reset data lost flag for Rx */
if (TxRx == Tx)
else if (TxRx == Rx)
/*Reset msg obj new data flag */
QSPI_SendByte(CAN_MSG_CTRL+1 + (Msg*0x20), 0xFB);
/*Assign Msg obj Node, ID, no bytes*/
QSPI_SendByte(CAN_MSG_CONFIG + (Msg*0x20), (uint8)(NoBytes<<4|Node|ID|TxRx));
/*Set Msg obj ID*/
if (ID == Stand)
QSPI_SendByte(CAN_MSG_ARB
QSPI_SendByte(CAN_MSG_ARB+1 + (Msg*0x20), (uint8)(IDnum>>8));
QSPI_SendByte(CAN_MSG_ARB+2 + (Msg*0x20), (uint8)(IDnum>>16));
QSPI_SendByte(CAN_MSG_ARB+3 + (Msg*0x20), (uint8)(IDnum>>24));
}
CAN_MsgObj_TxData
two 32-bit data registers which may be loaded with up to 8 bytes of data for transmission or may store up
to 8 bytes of data when configured as a receive object.
void CAN_MsgObj_TxData(uint8 Msg, uint8 NoBytes, uint32 data1, uint32 data2)
{
uint16 n;
/*Split data into bytes and load into the 2x32 bit data register*/
for (n=0; n < NoBytes; n++)
}
21
{
}
if ((NoBytes>4)&&(n>=4))
else
QSPI_SendByte(CAN_MSG_CTRL+1 + (Msg*0x20), 0xFD);
QSPI_SendByte(CAN_MSG_CTRL+1 + (Msg*0x20), 0xF7);
IDnum = IDnum << 18;
QSPI_SendByte(CAN_MSG_DAT + n + (Msg*0x20), (uint8)(data2>>(n-4)*8));
QSPI_SendByte(CAN_MSG_DAT + n + (Msg*0x20), (uint8)(data1>>n*8));
loads the message data register with data to be transmitted. Each message object has
Interfacing the MCF5272 to a Standalone CAN Controller
Freescale Semiconductor, Inc.
For More Information On This Product,
+ (Msg*0x20), (uint8)(IDnum));
Go to: www.freescale.com
MOTOROLA

Related parts for AN2320