Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

CAN controller area network

Status
Not open for further replies.

haxan

New Member
Hi,

This is my first post regarding CAN. I want to be able to setup a communication protocol among several MCU's. Also i want to stay in C language for this as assembly becomes too messy for this kinda stuff.

Can anyone help me how to start CAN project.

I have read some stuff regarding CAN's data bus, twisted pair and termination points etc.

Also is there a proteus based library on CAN IC's or controllers so its easier to verify results?
 

haxan

New Member
Can you suggest any specific in the PIC18 series that i could use. I am a total newbie in this. I only wanted that the PIC controller choosen was available in Proteus so its easier to test and debug. Thats why i picked 18F442.
 

haxan

New Member
I couldnt find anything worth mentioning when i searched MAPS. however i searched to CAN based controllers and found our there are two types (CAN and ECAN)..

Can anyone please tell the difference.

Also can someone guide me how to implement the CAN protocol
 

haxan

New Member
Okay i have selected PIC18F4480, i can see that it has ECAN.

Can you please explain a little in terms of main block of how the communication be done. I have seen some App notes related to ECAN already however its all jibber jabber for me as i dont understand them yet.

What i did get to know a little is that these steps be followed when initializing:

1> Start ECAN Module Initialization
2> Call ECANInitialize Function
3> End ECAN Module Initialization
 

haxan

New Member
I have found the ECAN documentation from Microchip website. Also have downloaded and installed MAESTRO software for setting up Configuration parameters.

Can you please guide me a little on which parameters i should adjust (There are like a hundred of them).
 

3v0

Coop Build Coordinator
Forum Supporter
Someone experienced with CAN may drop in and give you the magic settings. It is more likely that they will just move on to the next post because you have not put in enough effort. It would be too hard to explain.

Networks in general tend to be on the complex end of things. Now that you have the documentation you need to understand it. Study the docs several times to get a handle on the "jibber jabber".

3v0
 
Last edited:

haxan

New Member
I have noticed that there is no CAN transceiver like MCP2551 in proteus, is there a way to bypass its need and still see results of CAN based Simulation?

Also can some one explain the buffers RXB0, RXB1, B0 - B5. What should i set them to in order to receive three bytes of data?
 

haxan

New Member
Post 9 in this thread would indicate that you have found AN878
https://www.electro-tech-online.com/custompdfs/2009/11/00878a-1.pdf.

Page 11 of the following list about 20 additional documents.
https://www.electro-tech-online.com/custompdfs/2009/11/ECANZigBeeMotor-1.pdf

3v0

Yes that is correct actually. I have downloaded and included the ECAN library into my code but as soon i initialize ECAN, it sends several errors in to my Proteus Simulation. The reason for this that i believe is that my configuration is not correct. That's why i asked in previous posts if someone could guide me with minimum configurations with which i could start up with.

I have attached the errors image.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    404.6 KB · Views: 603

3v0

Coop Build Coordinator
Forum Supporter
They are Proteus warning rather then errors.

Does Proteu have a simulator for the ECAN hardware in the PIC18F4480 ?

Frankly I am not a big simulation fan for something as complex as this. I would be doing this on real hardware using an ICD (or two) rather then simulation. Slap some PICs into bread boards and go for it.


3v0
 

haxan

New Member
Proteus doesn't have the transceivers like MCP2551 :(

However i was thinking of connecting the Tx0 to Rx1 and Rx0 to Tx1 (two PICs connected).

What is an ICD?

The problem is that i dont have any Oscilloscope to watch the signals that might be generated.

The results generated on Proteus usually map without a problem on real hardware (i have tested it).

Also its not easy to change a little bit in code and then reburn all the node processors and try again. Its too much time consuming.

On the other hand i just compile the file on the MPLAB IDE and run the simulation on Proteus and it automatically takes the latest hex file.

Its a nice software and i recommend that you try it. It will be a faster way of development for you. :)

The problem is that i do not know why there are so many buffers in ECAN. I have read/skimmed (functions) in all the documentation available on microchip website.
 

3v0

Coop Build Coordinator
Forum Supporter
Proteus doesn't have the transceivers like MCP2551


ICD is In Circuiit Debuger. Works like a simulator in that you can set breakpoints and do run control. The advantage is that you are using the real hardware.

(guess) It looks like ECAN uses a series of identical buffers. That lets the msgs queue up on RX and TX. You only read or write to one buffer at a time. Think circular queue or round queue.

The MCP2551 has a signal that determines if it is reading or writting to the can bus. Do you have that working in you simulation. If not it is another good reason to do you testing on real harware with and ICD.

A logic analyzer should be enough to debug the hardware. Six lines will let you watch the TTL side of two MCP2551's.

3v0
 

haxan

New Member
Is it possible to first design a CAN interface and then instead of a wired CAN Bus, use a wireless method such as RF or ZigBee? If would be easier to make the system wired and wireless if it is possible.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top