Page 1 of 1

SPI & CAN interface

Posted: Fri Sep 02, 2011 4:37 pm
by Rob
Hi,
Am having trouble with Flowcode V4, using CAN via SPI to MCP2515/MCP2551. I have confirmed the hardware is connected properly by using a known working PIC. This old chip was programmed with Flowcode v2 and I have not got the exact fcf file for it. I have written a new fcf program in V4 using very similar code structure.
I have looked at past postings and can confirm the PIC is sticking at the CAN INIT routine because the CS pin is not being driven. I tried to drive a different pin on another port low before and after each CAN routine however this has not worked either.
I understand in CAN properties you can change the CS & INT pin however this does not seem to have any effect.
I am using PIC16F88 IC’s, I am programming from HEX to MATLAB v8.50 to a PICSTART PLUS.

So my conclusion is that the CAN macros have changed between and early flowcodeV2 compared to FlowcodeV4.
Any and all help would be much appreciated

Regards
Rob

Re: SPI & CAN interface

Posted: Fri Sep 02, 2011 4:59 pm
by Sean
I can confirm that the CAN component has changed since Flowcode V2, but we are not aware of any problems driving the CS pin.

Which build of Flowcode V4 are you using?

Can you post a copy of the .fcf and .c files generated by a non-working program?

Re: SPI & CAN interface

Posted: Mon Sep 05, 2011 9:06 am
by Rob
Thank you for your prompt reply, I am using

Flowcode
Professional Version
Flowcode v4.5.18.74

I look forward to your reply,
Many thanks

Rob

Re: SPI & CAN interface

Posted: Mon Sep 05, 2011 10:58 am
by Sean
Hello,

We have recreated a slightly modified version of your program in Flowcode V4 and run it successfully. The program is attached.

Removed

The modified FCD file you were using is not available in V4, so a standard 16F88 target was used and configured appropriately.

To match our test hardware:
The data rate and other CAN settings were returned to their default values.
The CS and INT pin selections were set to match the normal EB018 connections.

You should be able to change these settings to match your hardware without causing any problems.

Re: SPI & CAN interface

Posted: Mon Sep 05, 2011 11:46 am
by Rob
Hello,
And many thanks , :D The CAN is now working correctly, while I do not understand the Mod you made to the program, I don't care, It works and it will stay in.
I just want to say thanks again for such a quick reply,
regards

Rob