We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hallo
I am working on an home automation project where my task is to communicate between LPC1766(Cortex M3) and LPC11C24(Cortex M0).
Can anyone tell me or put a sample coding on how to communicate between two different microcontrollers using CAN BUS
You are right.
So you say, but you rather obviously don't have the knowledge to make such a statement. Because if you did, you wouldn't ask the following:
But I want to know how do you communicate between those two microcontrollers?
Which part of "it doesn't matter which microcontrollers are involved" did you fail to get?
The important thing here is that the LPC1766 has two CAN interfaces.
So it's possible to write a program that communicates between these two interfaces. It is very common to create initial software by using this kind of loopback trick, because it allows the same debugger to both debug transmit code and the corresponding receive code.
It should then be possible to change the cable to instead interface with some other processor - of any make and model. The LPC1766 does not need to know what it communicates with, as long as the two chips supports the same bus timing, and you don't send messages at a faster burst rate than what the receiving end can support.
So the available sample code for LPC17xx are enough to get that side of the communication working. And while I haven't looked, it's quite likely to exist similar code for the other processor - at least assuming that the processor does support CAN.
Software development is all about breaking things down into small enough puzzle pieces that each piece can be 100% fully understood. Implement enough of these small pieces and then merge them to form more complex solutions. When talking about hardware, it's a bit like thinking about an onion - new layers of code on top of each other to supply more and more complex solutions. The bottom layer just knows how to send and receive. The top layer decides when to send, and what to send. Somewhere in between, there might be layers to figure out if there are needs for acknowledge and resend in case a message gets dropped.
The same code bundles does contain - together with the processor user manuals - enough to get the bottom layer code up and running. How to send a CAN frame. How to receive a CAN frame. The chip manufacturer have invested time and money to supply that information just so the customers will be able to make use of the chips. People who do know how to send/receive with the chip had to get their knowledge from somewhere - why don't you consider using the same sources?
OK
Thanks a lot for your help at the right time