CAN comunication that stops and later starts
CAN comunication that stops and later starts
Hi
I have 2 PIC circuits that is communicating to each other.
(using the same components like: "E-blocks CAN bus board" from MatrixMultimedia - started with this components then I built my own hardware board..)
it does not work to 100%...
PIC1 sends a command to PIC2 and after some time PIC2 stops to reply...
I would simply say that PIC2 stops getting the question from PIC1 and this is why the traffic stops..
And after some time the PIC2 starts to work again...
I recorded the traffic, and This is the "log"
PIC1 always sends out data.
14 min - PIC 2 stops replying. until 56 min - then PIC 2 starts to respond again and works.
160 min - PIC 2 stops replying again. until 174 min - then PIC 2 starts to respond again and works.
311 min - PIC 2 stops replying again. until 313 min - then PIC 2 starts to respond again and works.
420 min - PIC 2 stops replying again. now the PIC2 stops to reply for good, and must be hardware Resetted (power cycle)
I think the problem is something with the CAN traffic gettning "out of sync"... a theory that I have...
Does anyone have experience with this?
Kind Regards Fredrik
I have 2 PIC circuits that is communicating to each other.
(using the same components like: "E-blocks CAN bus board" from MatrixMultimedia - started with this components then I built my own hardware board..)
it does not work to 100%...
PIC1 sends a command to PIC2 and after some time PIC2 stops to reply...
I would simply say that PIC2 stops getting the question from PIC1 and this is why the traffic stops..
And after some time the PIC2 starts to work again...
I recorded the traffic, and This is the "log"
PIC1 always sends out data.
14 min - PIC 2 stops replying. until 56 min - then PIC 2 starts to respond again and works.
160 min - PIC 2 stops replying again. until 174 min - then PIC 2 starts to respond again and works.
311 min - PIC 2 stops replying again. until 313 min - then PIC 2 starts to respond again and works.
420 min - PIC 2 stops replying again. now the PIC2 stops to reply for good, and must be hardware Resetted (power cycle)
I think the problem is something with the CAN traffic gettning "out of sync"... a theory that I have...
Does anyone have experience with this?
Kind Regards Fredrik
- 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: CAN comunication that stops and later starts
Hello Fredrik,
How often is your transmitter sending out CAN data? Could a simple small delay in between transmissions on PIC1 stop PIC2 from freezing?
How often is your transmitter sending out CAN data? Could a simple small delay in between transmissions on PIC1 stop PIC2 from freezing?
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
Re: CAN comunication that stops and later starts
Hi Ben.
Thanks for your reply.
when I did the 12h test period, I was only sending data every 30 seconds to check the communication... and when sending data the load on the bus is very very low..
the message starts like this:
on ID, say X1 then a message is sent out from PIC1 and when PIC2 sees this message it will send a reply.
at the moment the delay in the module is ca 300 ms.. until it sends the reply.
and there is nothing else on the Bus..
I am rather on the idea that the Bus has to less load, and this is why the CAN traffic "gets out of sync" ??? and then later when the drift on the PIC crystal or the CAN modules crystal is back in sync, then it works?
Thanks for your reply.
when I did the 12h test period, I was only sending data every 30 seconds to check the communication... and when sending data the load on the bus is very very low..
the message starts like this:
on ID, say X1 then a message is sent out from PIC1 and when PIC2 sees this message it will send a reply.
at the moment the delay in the module is ca 300 ms.. until it sends the reply.
and there is nothing else on the Bus..
I am rather on the idea that the Bus has to less load, and this is why the CAN traffic "gets out of sync" ??? and then later when the drift on the PIC crystal or the CAN modules crystal is back in sync, then it works?
- 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: CAN comunication that stops and later starts
Hello,
That seems odd CAN communications are normally very reliable. Are you using the external CAN controller or are you using internal CAN hardware? Also are you using crystals or internal oscillators? Maybe you could post up your programs and I will have a look for you and see if I can spot any potential problems.
That seems odd CAN communications are normally very reliable. Are you using the external CAN controller or are you using internal CAN hardware? Also are you using crystals or internal oscillators? Maybe you could post up your programs and I will have a look for you and see if I can spot any potential problems.
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
Re: CAN comunication that stops and later starts
Hi Again Ben.
I am using Crystals.
I am doing some more reaserach in the system, I got a tip that delays in the program that is bigger than 1ms might get the CAN timing to drift, so I am doing some updates to my programs, and will post the codes later after I have done some tests.
Do you have a Email that I can send my current project codes to?
but now I have a question to the CAN component, when receiving data.
in the help this is written:
"
char CheckRx(buffer)
This macro returns a value to indicate whether a message has been received by the specified <Rx_buffer>. A zero value indicates that a message has not been received, while a non-zero value indicates that a message has been received.
"
my question to this is, the value that is returned, what is the value?
I have set up my CAN component with simple settings, and Buffer(0) is scanning address 100 and 110.
So based on what this returns "CheckRx(buffer)" can I say with this if ID 100 or 110 is received?
I am using Crystals.
I am doing some more reaserach in the system, I got a tip that delays in the program that is bigger than 1ms might get the CAN timing to drift, so I am doing some updates to my programs, and will post the codes later after I have done some tests.
Do you have a Email that I can send my current project codes to?
but now I have a question to the CAN component, when receiving data.
in the help this is written:
"
char CheckRx(buffer)
This macro returns a value to indicate whether a message has been received by the specified <Rx_buffer>. A zero value indicates that a message has not been received, while a non-zero value indicates that a message has been received.
"
my question to this is, the value that is returned, what is the value?
I have set up my CAN component with simple settings, and Buffer(0) is scanning address 100 and 110.
So based on what this returns "CheckRx(buffer)" can I say with this if ID 100 or 110 is received?
Re: CAN comunication that stops and later starts
On the General Tab on the CAN component this option exists:
SJW
Stands for "synchronisation jump width", and can usually be set to any value.
This is used to help data transfer between data nodes on unusually long CAN cables and can be left as is for most node networks.
Do you think increasing this one to 4 will help my CAN getting out of sync?
SJW
Stands for "synchronisation jump width", and can usually be set to any value.
This is used to help data transfer between data nodes on unusually long CAN cables and can be left as is for most node networks.
Do you think increasing this one to 4 will help my CAN getting out of sync?
- 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: CAN comunication that stops and later starts
Hello,
The checkRX macro simply returns a 0 for no data and a 1 for data received.my question to this is, the value that is returned, what is the value?
Sounds like this could be a good option to try. Is your CAN network using long cables?SJW
Stands for "synchronisation jump width", and can usually be set to any value.
This is used to help data transfer between data nodes on unusually long CAN cables and can be left as is for most node networks.
Do you think increasing this one to 4 will help my CAN getting out of sync?
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
Re: CAN comunication that stops and later starts
Hi Ben.
Well the cables are not that long, but it is about 12meters of circuit board where the CAN is going over... so some disturbance on the CAN I would expect.
+ 20meters of twisted sheilded cable..
Will try and see, will run a test over the weekend and see if it improves with this setting.
Well the cables are not that long, but it is about 12meters of circuit board where the CAN is going over... so some disturbance on the CAN I would expect.
+ 20meters of twisted sheilded cable..
Will try and see, will run a test over the weekend and see if it improves with this setting.
Re: CAN comunication that stops and later starts
For follow up:
After changing the SJW to 4 I did not have the problem anymore on this chip.
But still I have a few times had the problem on a other chip in the CAN network, so I cant say that this solved the problem to 100%..
But if any of you out there has the same problem, it might be worth trying..
In the moment I have made a "work around" solution for this problem.
(PIC gets resetted by other PIC if it does not reply...)
Thanks Ben for your replys
After changing the SJW to 4 I did not have the problem anymore on this chip.
But still I have a few times had the problem on a other chip in the CAN network, so I cant say that this solved the problem to 100%..
But if any of you out there has the same problem, it might be worth trying..
In the moment I have made a "work around" solution for this problem.
(PIC gets resetted by other PIC if it does not reply...)
Thanks Ben for your replys