Best way to learn CAN Communication protocol

Papabravo

Joined Feb 24, 2006
22,084
55 bits is only the number that you count on paper. Did you account for bit-stuffing? This only matters if you're looking at a scope trace.
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
@JohnInTX Is it time to start the flow chart? I think i should start right now. There are some things left that can be clear when making a flow chart. I would like to make a flow chart in which I am controlling the doors and head light of the car through the CAN bus
 

JohnInTX

Joined Jun 26, 2012
4,787
@JohnInTX Is it time to start the flow chart? I think i should start right now. There are some things left that can be clear when making a flow chart. I would like to make a flow chart in which I am controlling the doors and head light of the car through the CAN bus
I think you should study how the CAN controller in the 18F4685 works, how to configure it, how to determine the filter and mask values to determine which CAN IDs are used, how to load the data and ID registers to send a message and how to process incoming messages before that. Otherwise, how would you know what steps to include in the flow chart?

I suppose you could work at a higher, more abstract level but if the goal is to understand CAN, as opposed to an automobile, you need to know how a CAN controller actually works.
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
I think you should study how the CAN controller in the 18F4685 works, how to configure it, how to determine the filter and mask values to determine which CAN IDs are used, how to load the data and ID registers to send a message and how to process incoming messages before that. Otherwise, how would you know what steps to include in the flow chart?
@JohnInTX You are absolutely right. I think that I can get some idea by looking at open source code but I am looking from long time on google. I have not found any useful code for PIC18f4685 CAN BUS. Do you have some source code for PIC18f4685 ?
 

JohnInTX

Joined Jun 26, 2012
4,787
AN878 from Microchip has the basics.
Be sure to review the documents I posted above in #3 particularly the bit timing information. The source code is somewhat involved and written for C18 so take your time and drill down into each routine to see how the ECAN controller registers are loaded.

Have fun1
 

Attachments

Top