Can bus problem with 18F2580

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

Moderators: Benj, Mods

Post Reply
GeorgesVDR
Posts: 2
Joined: Thu Jun 11, 2009 6:41 pm
Contact:

Can bus problem with 18F2580

Post by GeorgesVDR »

Dear flowcoders,

I have developed a circuit that works as a can bus node. Its a copy of a friend of mind and the program I have from works but not
like I want it to. So I bought flowcode and started designing. In the simulation everything works but when I download it to the PIC.
It gets stuck on Can Init. The problem is that flowcode still thinks i'm using the E-board via the MCP2515 and MCP2551. But that isnt
the case i'm only using the MCP2551 because the 18F2580 has a build in can-controller. If i go into the C-file i can also see the program
for the spi connection but as I said, I don't use the MCP2515 so I don't use SPI. Can this be fixed or I there a change that I can get it
right!!

Thanks!!

Georges

(Files in attachement)
Attachments
schema canbus.jpg
Schematics
(108.52 KiB) Downloaded 2792 times
Canbus flow.fcf
Program
(27.73 KiB) Downloaded 397 times
Canbus flow.c
C-File
(59.51 KiB) Downloaded 407 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Can bus problem with 18F2580

Post by Benj »

Hello

Unfortunatley Flowcode does not currently support devices with an internal CAN controller. This may be resolved in the near future.

GeorgesVDR
Posts: 2
Joined: Thu Jun 11, 2009 6:41 pm
Contact:

Re: Can bus problem with 18F2580

Post by GeorgesVDR »

Thanks for the reply!!

But is it possible to make the programm in flowcode and copy paste the main source code to
an other code with the right configuration? So its compatible with my circuit??

Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Can bus problem with 18F2580

Post by Benj »

Hello

It should be possible to modify the functions in the CAN component C file using the Code customization in Flowcode v4 or by editing the component C code file by hand in Flowcode V3. Modifying these functions to use the internal rather then the external CAN controller should be possible. Most of the device registers should match up with the ones currently being accessed via the SPI bus.

MW
Posts: 38
Joined: Mon Feb 26, 2007 2:04 am
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Can bus problem with 18F2580

Post by MW »

Hello,

I have a different problem along these lines.

I have written a small program for the 18F2580 using the Can2 component.

Whenever I try to compile it however I get the following errors:

Illegal redefinition of symbol: RXM0EID8_VAL
Illegal redefinition of symbol: RXM0EID0_VAL
Illegal redefinition of symbol: RXM1EID8_VAL
Illegal redefinition of symbol: RXM1EID0_VAL
Illegal redefinition of symbol: CANSTAT
Illegal redefinition of symbol: TXREQ
Illegal redefinition of symbol: ABAT
Illegal redefinition of symbol: ERRIE
Illegal redefinition of symbol: WAKIE
Illegal redefinition of symbol: ERRIF
Illegal redefinition of symbol: WAKIF
Illegal redefinition of symbol: SAM
Illegal redefinition of symbol: WAKFIL

When I change the config to another chip it compile fines, but I am quite keen to use the 18F2580 as this is what is fitted to my development board.

Any ideas?

Thanks
MW

MW
Posts: 38
Joined: Mon Feb 26, 2007 2:04 am
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Can bus problem with 18F2580

Post by MW »

Apologies. I should of posted this in the Flowcode V4 forum. Also I should explain I am trying to use the 18F2580 with an MCP2510 not with the internal can module.

Thanks
MW

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Can bus problem with 18F2580

Post by Benj »

Hello,

I know the cause of your problem and it is related to the Flowcode CAN defines colliding with the defines for the CAN registers on the 18F2580 device.

What version of Flowcode are you running. Updating to the latest version (4.3) may fix this problem.

MW
Posts: 38
Joined: Mon Feb 26, 2007 2:04 am
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Can bus problem with 18F2580

Post by MW »

Hi,

I am running 4.3.7.63. No joy.

Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Can bus problem with 18F2580

Post by Benj »

Hello,

Right I have done a search and replace on the CAN2 component to rename the defines and this has removed all of the compile errors when using the 18F2580 device.

Simply replace the file in your "Flowcode v4\Components" directory and then start Flowcode and the program should then compile correctly.
Attachments
PIC_CAN2.c
(43.34 KiB) Downloaded 399 times

MW
Posts: 38
Joined: Mon Feb 26, 2007 2:04 am
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Can bus problem with 18F2580

Post by MW »

Ben this worked a treat. I am now up and running.

Thanks very much
MW

Post Reply