Can Bus

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Dante
Posts: 11
Joined: Fri Oct 09, 2009 2:45 pm
Contact:

Can Bus

Post by Dante »

Hi

Some time ago, I post a Question for Can Bus protocol. I have to stop the project but right know I`m starting again, so I'm using PIC16F876A but i don't know how to conect thourgh MCP2515, i Know that is from SPI protocol pins sck, sdi, sdo, cs and int but cs and int i don't know where to conect that pins in my PIC. So if you know how to conect please tell me.


Best regards

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Can Bus

Post by Sean »

Are you using Flowcode and/or e-blocks for this project? If so, the following details might be useful.

The Flowcode CAN component is MCP2515 compatible.

The CS and INT connections can be made to any unused pins on the same port as the main SPI connections.
If you are using the CAN e-block, some default connections can be configured using the jumper links.

If non-default connections are required, the patch system can be used - details are available from the CAN e-block data sheet.

Note: the Flowcode CAN component does not use the INT pin as an interrupt input, but polls it when waiting for data.

If you are using custom hardware and software, the INT input can be connected to an interrupt pin. Data reception can then be handled by an interrupt service routine.

Dante
Posts: 11
Joined: Fri Oct 09, 2009 2:45 pm
Contact:

Re: Can Bus

Post by Dante »

Hi Thanks for answer my Question

Yes I'm using Flowcode but i don't have Can E-blocks so i have to develop my self, so i was searching in the data sheet of your can module but I'm confust in the way to connect the cs and int control to my pic. I think is sck bit 3 of port C, si bit 5 of port C, so bit 4 of port C, cs bit 6 of port C and int bit 0 of port C but i'm not sure? Also the MCP2515 is programed via SPI protocol so flowcode program the MCP2515 in that way? I need something else to make a node of can bus?

Best regards

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Can Bus

Post by Sean »

Your connections are correct. You can also move the INT and CS connections to other unused Port C pins using the settings on the Flowcode CAN component property page.

If you want to create a second CAN node, based on another MCP2515, it will need another microcontroller to configure it and handle the communications.

Dante
Posts: 11
Joined: Fri Oct 09, 2009 2:45 pm
Contact:

Re: Can Bus

Post by Dante »

Hi again

I probe a very easy program with Can bus but it dosen't work, i conect like the datasheet of Can bus E-blocks but I can change the cs and int in the Can bus properties. The pins that i write you in the other cuestion are the default pin? i verify my program and when pass through the init macro of the canbus wait there and dosen't get out of there. could you help me please?


Best Regards

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Can Bus

Post by Sean »

Hello Dante,

The CAN init macro contains program loops that wait for specific responses from the MCP2515. Completion of this macro requires all the hardware to be connected and operating correctly.

If the program is stuck in one of these loops, it will be continuously transmitting messages on the SPI bus, and testing for the expected values to be returned. Do you have test equipment that can indicate activity on the SPI clock, data, and /CS lines?

Post Reply