Other Parts Discussed in Thread: SN65HVD232
Tool/software: Code Composer Studio
I've been working on getting the example code for simple_tx and simple_rx included in the peripheral library up and running and have hit a roadblock. No doubt I am doing something wrong, but I cannot for the life of me figure out what it is.
Hardware:
- 2x TM4C123GXL launchpads
- 2x SN65HVD232 CAN Transceivers with 120ohm terminating resistors.
Code:
Simple_tx and simple_rx as provided in the peripheral library.
IDE is Code composer studio V7.4, using TI v16.9.8.LTS Compiler
Initially I ran the code bone stock with no modifications save updating tx/rx to PE4 and PE5, and dynamically allocating the interrupt. This resulted in a constant transmission of the same message. The interrupt would continuously trigger and "message data" and "total count" would increment out of sync unlike the indicated behavior at the top of the program.
*Message transmission begins immediately after the first ends.
I have found a workaround for this. By inserting a CANMessageClear(CAN0_BASE,1); command at the end of the interrupt. This prevents re-sending of the message until CANMessageSet is called again in my main while loop. It seems odd that I would have to modify vendor example code to get it working beyond configuring ports for my hardware. Am I missing something here?
Probelm 2, I have not found a workaround for.
Simple_Rx, this code triggers message object interrupts, so it acknowledges a message has been received. However the message ID it prints out are always exactly what was loaded into the message object for the MsgID.
ie: if I set the MsgID to 0 so it receives any message, it will always print out ID 0 when it receives a message. If I load 0x0002 (but leave the mask as 0) then it always prints ID 0x00000002, regardless of the message ID it should be receiving.
No matter how I configure the IDs and message data it always returns 0 for message length and data.