• AVR Freaks

AnsweredHot!Suggestion for a Can Bus newbie

Author
seyyah
Super Member
  • Total Posts : 633
  • Reward points : 0
  • Joined: 2004/05/14 12:49:28
  • Status: offline
2020/04/06 03:46:10 (permalink)
0

Suggestion for a Can Bus newbie

I've never used can bus before and I don't know the concepts deeply. I'm learning nowadays.
I plan to realize something like this:
I have a main control board and distributed peripherals upto 30 nodes. They will all be on the can bus network. All the peripherals will transmit at most 2-bytes of data and most of them will transmit only 1-byte. These peripherals will also receive from only the main board again mostly 1-byte of data.  If I would use RS-485, I would scan the whole network sequentially. But since Can-Bus have different options like all nodes can act on their own, which choice is most logical according to you, especially if you would think some nodes may be added or substracted from the network in different situations:
- Using a master slave logic to scan all the nodes
- Each node transmits on their own periodically
- or anything else
Since I have no experience, I may be confused, any help will be appriceated, thanks
 
#1
pcbbc
Super Member
  • Total Posts : 1687
  • Reward points : 0
  • Joined: 2014/03/27 07:04:41
  • Location: 0
  • Status: offline
Re: Suggestion for a Can Bus newbie 2020/04/06 04:45:22 (permalink)
+1 (1)
seyyah- Using a master slave logic to scan all the nodes
- Each node transmits on their own periodically
- or anything else

CAN says nothing about which you should use.  It all depends on your application.
#2
BMD
Super Member
  • Total Posts : 445
  • Reward points : 0
  • Joined: 2003/12/02 21:42:52
  • Location: UK
  • Status: offline
Re: Suggestion for a Can Bus newbie 2020/04/06 07:08:43 (permalink) ☼ Best Answerby seyyah 2020/04/08 10:41:17
0
As pcbbc suggests, this all depends on your application.
But I think this is the help that you are asking for, so;
 
You should think about how the system will finally operate, what are you measuring,
what is the reason for the messages being sent/received. Urgency? Alarm?
 
If things need an immediate response, (alarm) this suggests that polling is not a good way, a peripheral needs to
attract attention immediately.
 
If the system is simply a weather station, where messages can be seconds(minutes?) waiting to be sent, then polling is fine.
 
As for identifying connected/disconnected peripherals, do a roll call on power up, if things can be connected/disconnected while powered, either periodically do a roll call (send address, wait for 'Present sir'), or first job of a peripheral is to get an acknowledge from the master (or other nodes).
 
Spend some time thinking about the end user and how they will expect to be able to use the system. Then design 'that'.
 

Regards

Brandon
#3
seyyah
Super Member
  • Total Posts : 633
  • Reward points : 0
  • Joined: 2004/05/14 12:49:28
  • Status: offline
Re: Suggestion for a Can Bus newbie 2020/04/08 10:57:44 (permalink)
0
Thanks for the response, I know it depends on the application but If I wondered if I can pick some tips from your experiences that will help me to decide  and understand better. I think polling does not seem logical but since I am trying to comprehend the issue can you comment for this: For example main board should get info from all nodes within 300ms or so I estimate, how will they synchronize? Say all nodes transmits from time=0 and higher id won, after a time-out period, all nodes will try again and again and 1st cycle will complete. 2nd cycle won't be a problem I think if all nodes tries again after a fixed preiod of time after their first transmit since they are all in order. Am I right or wrong?
#4
BMD
Super Member
  • Total Posts : 445
  • Reward points : 0
  • Joined: 2003/12/02 21:42:52
  • Location: UK
  • Status: offline
Re: Suggestion for a Can Bus newbie 2020/04/08 11:13:47 (permalink) ☄ Helpfulby seyyah 2020/04/11 11:40:40
+1 (1)
Hi,
If youre sure polling will not work then youll have to employ some sort of arbitration.
 
If a node discovers its been beaten to the comms channel, it should wait a random time before retrying.
Other nodes will also wait a random time, so hopefully they should eventually get through. Successful nodes should wait a longer random time before accessing the comms buss again.
The clever part is accommodating the message length, with the number of nodes trying to communicate to balance the random waits, so that any node gets through in a reasonable number of tries and time.
 
In a similar system I used a single open collector 'Bell' line. Which nodes held low when they need attention. The master would scan down the roll call table shouting addresses until the node was accessed. It would continue to loop the table communicating with nodes, until the Bell line was allowed to go high. Indicating that no node needed attention.
 
It was half way between polling and immediate...
 
 

Regards

Brandon
#5
Jump to:
© 2020 APG vNext Commercial Version 4.5