I would like to know whether it is possible to get direct access to a CAN message after retrieval.
I read through the manuals and realized that PSoC stores information on received messages in different registers (CMD, ID, DH, DL, AMR, ACR, AMRD, ACRD). What I am searching for is direct access to every bit of a received CAN message like defined in the CAN 2.0 A standard:
Start | Identifier | RTR | IDE | r0 | DLC | Data | CRC | ACK | EOF+IFS
Thanks in advance!
Ok, that's true. But I got confused when I searched for possible ways to access the seperate parts. For example, how do I access the RTR-bit? Or how could I access the whole range of data-bits and copy it with just one call to memcpy?
For single bits I already found defines or "functions" to access them, e.g. MyCANInstance_GET_DLC. But why is there no equivalent way to access RTR in the RX register? Do I have to access it directly via MyCANInstance_RX[mailboxID].rxcmd.byte[21u]?
well if you're copying the entire structure you can just reference the elements directly... Something like
struct CAN_RX_STRUCT *c; c = &CAN_RX[mbox]; ide = CAN_RX[mbox].rxcmd.byte & (1 << 4); dlc = CAN_RX[mbox].rxcmd.byte & 0x0f; id = *(uint32_t *)&CAN_RX[mbox].rxid.byte; id >>= 3;
You can find the positions of the desired information by looking at the register TRM for the PSoC5LP.