the facts:
If I have a flowchart that sends, lets say, one package of CAN every second with the function DELAY or with TIMER, the measured answer is very accurate (0,002 [ms]).
If I send that communication to other microcontroller, and using the detection of a CAN package as a trigger to send its own CAN package with a delay, THAT DELAY is not allays the same, even if I program it to do so.
this variable delay can be around 0.1-0.3 [ms] with my CAN bus running at 500 Kbits/s
question:
Is the detection of a CAN package somehow variable inside of the microcontroller (even if the data received is the same every time) ?
here is a screenshot showing the measurements
As you can see, the period (show the signal send by Tx, below ) is much accurate than the measure on top that show the answer to that CAN signal.
here are the files just if someone want to play , I just disable the TMR interrupt icon in RX to see the signal as is coming from TX
Question about CAN bus accuracy
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Question about CAN bus accuracy
Hello,
I believe the varying delay you are experiencing is maybe due to the timer count value at the time you receive the CAN message. You could try presetting this in your C icon before enabling the interrupt by using the following C code.
TMR2 = 0x00;
I believe the varying delay you are experiencing is maybe due to the timer count value at the time you receive the CAN message. You could try presetting this in your C icon before enabling the interrupt by using the following C code.
TMR2 = 0x00;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel