First time using codesys and CAN here. I can't seem to read anything off our CAN network. I know for certain that the baudrate and CAN-IDs are correct because I used PCAN View to verify they were correct. I'm using the CANAPI 18.104.22.168 library in codesys to read the CAN messages on a display.
Below I have snap shots of the driver configuration, code for receiving CAN messages, the implementation of ProcessMessage() method, and the driver29bit.ReceiveMessage() method. All snap shots were taken while connected to the device from a laptop. The communication port on the CAN hub is what I connected to with both the device and PCAN adapter so I know it isn't a wiring issue.
My code is based off the CANAPI example found at the codesys store. If I understand the process in the example correctly, the driver is configured, msgProcessor is configured with the driver, and then the singleID receiver is configured into the driver. The singleIDreceiver and msgProcessor are both passed to the ReceiveMessage() method in which the internal function processes the single CAN ID and passes the message to msgProcessor. From there, the CAN message should be passed to the internal variable "message" in msgProcessor, where I can then implement the message in the ProcessMessage() method.
What I've noticed is that ProcessMessage() is never called, I set a break point in there during the live test and the break point was never hit. I also have noticed that ReceiveMessage() returns "FALSE" every time. Could someone with more knowledge about CAN networks explain what I am doing wrong or what the problem is?
I'm very green when it comes to CAN stuff.
List of things I have tried or noticed:
I've tried changing the usiNetwork from 0 - > 1 - > 2 and if I change the Network to 2 then the generated receiverIDs return '0' but 0 and 1 usiNetworks work for generating IDs.
I've tried changing the g_tTimeLimit anywhere from 0 to 100 and tried matching them to the cycle times of the CAN messages.
If you look at the ReceiveMessage picture below, you'll notice that the itfMsgProcessor has a value of "16#307FC25C". When checking for that value using PCAN View, that message is no where on the network. What does that mean?
My driver configurations and singleIDReceivers show "NO_ERROR".
I don't recall what else I have tried at the moment but if I remember I will come back and post them here.