HI, I am working with LPC2129 with full CAN bus. I have written a code for master and slave. i am running a heartbeat LED on both of them at a rate 1Hz, and they work fine. When i connect 2nd slave after having done the appropriate changes, the LEDs on two slaves run on much slower frequency 1/2 Hz. ? why? are there certain registers need to be configured for this issue.? the code i am using should run the same either with one slave or more. I am using 1Mbps baud rate...
one possible explanation is that your software is made in such a way that overloads your bus. if your code is interrupt based, you processor might be spending a long time servicing CAN rather than handling your LED. if your LED is driven by an interrupt, adjusting the priorities can help.
You are not giving us any real information. FulLCAN represents automagic filtering of received messages. But what do your transmit code look like? Are you making sure that you are sending one packet to each slave every second?
Hi, well i am using Shared clock CAN bus. i.e. i am sending a tick from master to slaves each 10ms and i interrupt the slaves. each 50 ticks = 500ms the LED should toggle. but in slaves what happen is that each 100 ticks= 1sec LED toggle
Hi RA,
CAN is a multi-master bus, there is no slave or master. If you use the term slave or master, then it is related to your implementation of the different service layers. CANOpen for example defines services like NMT, DBT PDO, SDO and each service can be implemented as master or slave. But the CAN communication is always multi-master. For your example, you should define a Process Data Object (PDO) that is send by the producer of the heartbeat. All consumers of the heartbeat message should setup a message filter that accepts exactly this message. Implementing your solution this way should work without any problems. One message is send for every occurring heartbeat, independent of the number of consumers of this message.
Frank
When i connect 2nd slave after having done the appropriate changes, the LEDs on two slaves run on much slower frequency 1/2 Hz. ? why?
Most probably because those "appropriate changes" were, in fact, inappropriate. Given the rather extreme lack of detail of what you're actually doing, it's hard to give a better answer.
I.e. i am sending a tick from master to slaves each 10ms
That's still way too little information. When you say you "send the tick to slaves", what does that actually mean? You aren't by any chance sending separate tick messages to each of them, on a bus that had nearly 100% busload with a single slave, are you?