Hello folks,
I am using PCAN Explorer 6 to interface with an electric motor system for a new EV that we are building. The motor requires CRC and I followed the topics in this forum to create a .dll and a rolling counter, based on the example that comes with the full install. It seems to "sort-of" work, but I get occasional errors from the motor that report "Bad CRC".
Since I have never developed anything in CAN or in PCAN explorer, I am unclear on what the possible settings should be for the callback functions, and was wondering if there is a tutorial or explanation to guide in selecting "reset counter" versus ID_100 vs Checksum_ID101, etc. Any replies would be appreciated!
-David
Rolling counter and callback functions
Re: Rolling counter and callback functions
Found some comments in the Peak supplied sample file; that shows how to set 3 of the event functions, but there are a total of 7 possible events. I am still not clear on how to set this up and any assistance would be great!
Re: Rolling counter and callback functions
Hi,
to create a rolling counter and calculate the matching CRC for your message the event 'On Before Transmit' is the right one to use. The function 'Rolling_Counter_Checksum_ID201' in the example source code demonstrates how to increase a rolling counter and create the checksum for a specific CAN ID that is sent by PCAN-Explorer.
Note that once you have assigned the function in the Callback Library configuration window to the 'On Before Transmit' event, every message that is sent by PCAN-Explorer goes through the DLL. Therefore, you must make sure that the DLL only modifies the right messages, i.e. which has the correct CAN ID and DLC.
to create a rolling counter and calculate the matching CRC for your message the event 'On Before Transmit' is the right one to use. The function 'Rolling_Counter_Checksum_ID201' in the example source code demonstrates how to increase a rolling counter and create the checksum for a specific CAN ID that is sent by PCAN-Explorer.
Note that once you have assigned the function in the Callback Library configuration window to the 'On Before Transmit' event, every message that is sent by PCAN-Explorer goes through the DLL. Therefore, you must make sure that the DLL only modifies the right messages, i.e. which has the correct CAN ID and DLC.