Tool/software: Code Composer Studio
I'm working with the LaunchPad at the moment. I can't get CAN to read a message, but I can send and the transceiver is acking messages properly.
When the interrupt (Status Change interrupt) runs, the resister CAN_ES shows that RxOK is flagged, but CAN_INT.INTI0D always reads back 0x8000 (Error). How messages are setup is below. The IPEN register doesn't change either (all show 0), eventhough the RxIE (or TxIE for transmit boxes) is set on the mailboxes.
1. What am I doing wrong, that CAN_INT.INTI0D always comes back with an error, and not the proper mailbox?
2. For RX messages, does the DLC (length) value matter in the MCTL message, or does setting a 6 mean it will only receive 6 byte long message. Is there a way to allow all lengths, if that is the case?
NOTE: On TxOK interrupts, CAN_INT.INTI0D also reads back 0x8000 (error), but the messages are being sent properly and acked properly by the other devices on the bus.
Thanks,
Kyle M
Rx message setup:
for(i = FIRST_MAILBOX_FOR_STANDARD_MESSAGES; i <= LAST_MAILBOX_FOR_STANDARD_MESSAGES; i++)
{
HWREG_BP(CANA_BASE + CAN_O_IF1ARB) = CAN_IF1ARB_MSGVAL | 0x1FFFFFFF; //Setup No mask and message Valid
HWREG_BP(CANA_BASE + CAN_O_IF1MCTL) = 6 | CAN_IF1MCTL_EOB | CAN_IF1MCTL_RXIE;
//Setup the mask:
//CanaRegs.CAN_IF1MSK.all = 0;
HWREG_BP(CANA_BASE + CAN_O_IF1MSK) = 0;
//Tell the buffer to force a copy to the mailbox:
HWREG_BP(CANA_BASE + CAN_O_IF1CMD) = i | CAN_IF1CMD_ARB | CAN_IF1CMD_CONTROL
| CAN_IF1CMD_MASK | CAN_IF1CMD_DIR | CAN_IF1CMD_CLRINTPND;
}
Tx Message setup:
HWREG_BP(CANA_BASE + CAN_O_IF1ARB) = Msg.ui32MsgARB.all | CAN_IF1ARB_DIR;
HWREG_BP(CANA_BASE + CAN_O_IF1MCTL) = (Uint32)Msg.ui16MsgLen | CAN_IF1MCTL_EOB; //|CAN_IF1MCTL_TXRQST
//Setup the mask:
//CanaRegs.CAN_IF1MSK.all = 0;
HWREG_BP(CANA_BASE + CAN_O_IF1MSK) = 0;
//Load the Low Data Bytes:
//CanaRegs.CAN_IF1DATA.all = Msg.Data[0];
HWREG_BP(CANA_BASE + CAN_O_IF1DATA) = Msg.Data[0];
//Load the High Data Bytes:
//CanaRegs.CAN_IF1DATB.all = Msg.Data[1];
HWREG_BP(CANA_BASE + CAN_O_IF1DATB) = Msg.Data[1];
//Tell the buffer to force a copy to the mailbox so the hardware will transmit:
HWREG_BP(CANA_BASE + CAN_O_IF1CMD) = MailBox_Num | CAN_IF1CMD_ARB | CAN_IF1CMD_CONTROL
| CAN_IF1CMD_MASK | CAN_IF1CMD_DIR
| CAN_IF1CMD_DATA_B | CAN_IF1CMD_DATA_A
| CAN_IF1CMD_TXRQST;