Hey, I tried to generate a look up table for my Can Controller but I have a lot of troubles. In the user manual on page 374 stands that the SFF_sa is disabled when the Value is <0 . But on page 395 you can see in the example, that they start at 0x00 ... is that right?
I program it this way, but i can not receive a special message:
void CAN_SetACCF_Lookup( void ) { uint32_t address = 0; uint32_t ID_high, ID_low; // Set explicit standard Frame LPC_CANAF->SFF_sa = address; ID_low = (0x001 << 29) | (0x2C1 << 16) | (1<<27); ID_high = (0x001 << 13) | (0x320 << 0) | (1<<11); *((volatile uint32_t *)(LPC_CANAF_RAM_BASE + address)) = ID_low | ID_high; address += 4; // Set group standard Frame LPC_CANAF->SFF_GRP_sa = address; // Set explicit extended Frame LPC_CANAF->EFF_sa = address; // Set group extended Frame LPC_CANAF->EFF_GRP_sa = address; // Set End of Table LPC_CANAF->ENDofTable = address; return; }
Empty tables are disabled, i.e. if start and end address have the same value.
SFF_sa is start address for standard-frame rules. If SFF_sa = 0, means that the table before (FulLCAN) is empty, and hence disabled.
There is no pointer for start of FulLCAN, since that table has the hard-coded start address 0.
ah okay thanks =) i also have another question, when i receive a message i generate an interrupt and store my received data and then release the receive buffer to avoid a data overrun. i did it this way:
[pre] uint32_t * pDest; /* initialize destination pointer */ pDest = (uint32_t *)&MsgBuf_RX1; *pDest = LPC_CAN1->RFS; /* Frame */
pDest++; *pDest = LPC_CAN1->RID; /* ID */
pDest++; *pDest = LPC_CAN1->RDA; /* Data A */
pDest++; *pDest = LPC_CAN1->RDB; /* Data B */
CAN1RxDone = TRUE; LPC_CAN1->CMR = 0x01 << 2; /* release receive buffer */ return; [/pre]
But when I receive a valid message always a data overrun occurs, i dont't know why because i think i store it fast enough ...