![]() |
MSPM0_ValvanoWare
1.0
ECE445L starter code
|
Controller Area Network. More...
Functions | |
| void | CAN_Init (void) |
| Initialize CAN. More... | |
| void | CAN_EnableInterrupts (uint32_t priority) |
| Enable CAN interrupts. More... | |
| int | CAN_Send (uint32_t id, uint32_t dlc, uint8_t *data) |
| Send CAN message. More... | |
| int | CAN_CheckMail (void) |
| Check for received CAN message. More... | |
| int | CAN_GetMailNonBlock (uint32_t *id, uint32_t *dlc, uint8_t *data) |
| Received a CAN message. More... | |
| void | CAN_GetMail (uint32_t *id, uint32_t *dlc, uint8_t *data) |
| Receive a CAN message. More... | |
Controller Area Network.
| TCAN1057AVDRQ1 | MSPM0G3507 |
|---|---|
| Pin1 TXD | CAN_Tx PA12 FD-CAN module 0 transmit |
| Pin2 Vss | ground |
| Pin3 VCC | +5V with 0.1uF cap to ground |
| Pin4 RXD | CAN_Rx PA13 FD-CAN module 0 receive (0 to 3.3V) |
| Pin5 VIO | +3.3V (digital interface supply) |
| Pin6 CANL | to other CANL on network |
| Pin7 CANH | to other CANH on network |
| Pin8 RS | ground, Slope-Control Input (maximum slew rate) |
| int CAN_CheckMail | ( | void | ) |
Check for received CAN message.
Check to see if a receive message has been received on the Controller Area Network
| none |
| void CAN_EnableInterrupts | ( | uint32_t | priority | ) |
Enable CAN interrupts.
enable interrupts on the Controller Area Network
| priority | 0(highest) to 3(lowest) |
| void CAN_GetMail | ( | uint32_t * | id, |
| uint32_t * | dlc, | ||
| uint8_t * | data | ||
| ) |
Receive a CAN message.
Receive message on the Controller Area Network, blocking. If receive data is ready, gets the data and returns. If no receive data is ready, it will spin waiting for message
| id | pointer to 11-bit id |
| dlc | pointer to data length |
| data | array of data received (0 to 8 bytes) |
| int CAN_GetMailNonBlock | ( | uint32_t * | id, |
| uint32_t * | dlc, | ||
| uint8_t * | data | ||
| ) |
Received a CAN message.
Receive message on the Controller Area Network, nonblocking. If receive data is ready, gets the data and returns true. If no receive data is ready, returns false
| id | pointer to 11-bit id, valid if function returns true |
| dlc | pointer to data length, valid if function returns true |
| data | array of data received (0 to 8 bytes), valid if function returns true |
| void CAN_Init | ( | void | ) |
Initialize CAN.
initialize Controller Area Network
bit rate 1Mbps
| none |
| int CAN_Send | ( | uint32_t | id, |
| uint32_t | dlc, | ||
| uint8_t * | data | ||
| ) |
Send CAN message.
Send a message on the Controller Area Network
| id | 11-bit identifier |
| dlc | 0 to 8, data length |
| data | array of data to send (0 to 8 bytes) |