Why no message is available after transmitting CAN Message
Show older comments
I am using a PEAK CAN-USB device to connect my DSP with Matlab and communicate using CAN-Communication. I was following this example till I stuck on some problems. First of all, using canHWInfo, I can only detect 1 channel in my CAN device and in the example, there are 2 channel for each device, this could be the cause of the problem. I will refer to this later.
>>info = canHWInfo
Vendor | Device | Channel | Serial Number | Constructor
----------- | ----------------------- | ------- | ------------- | ----------------------------------------
MathWorks | Virtual 1 | 1 | 0 | canChannel('MathWorks','Virtual 1',1)
MathWorks | Virtual 1 | 2 | 0 | canChannel('MathWorks','Virtual 1',2)
PEAK-System | PCAN-USB (PCAN_USBBUS1) | 1 | 0 | canChannel('PEAK-System','PCAN_USBBUS1')
So I proceed with defining 2 CAN-channel variable, for sending and receiving the data.
>>canch1 = canChannel('PEAK-System','PCAN_USBBUS1')
>>canch2 = canChannel('PEAK-System','PCAN_USBBUS1')
After transmitting the data, I noticed that the everything is similar to the example except that MessagesAvailable is empty. When no message is available, I cannot proceed to receive any data. So can anyone tell me why is this happening? Could this be because I am using the same channel to send and receive the data? How come a message is already transmitted but no message is available?
>>transmit(canch1,messageout)
>>canch1
Status Information:
Running:1
MessagesAvailable:0
MessagesTransmitted:1
InitializationAccess:1
Answers (0)
Categories
Find more on Vehicle Network Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!