For a start you are using the wrong Lib and supporting.h.C files your device has an ECAN module therefore if you want to use the Lib you need to Down load the application note AN878 which contains the .H .C and .Def file you need to include in your application and the AP note give you a detailed explenation about the Functions for the use of the ECAN module
OK, now I´m using ECAN Routines, I thought CAN routines were compatible with ECAN in mode 0. I had to make a few modification on registers definition to compiled it. Using ECAN was easier. thanks!
I'll ask a couple of basic questions first.
1. You want 125kbps but what frequency are you running the processor at? Make sure that the values you've given to the CANInitialize actually work out to the bit rate desired.
My processor is running at 20 MHz. I´m using default values from AP note, now a def file as follow:
// SJW value - Value must be between 1-4 inclusive.
#define ECAN_SJW_VAL 1
// BRP value - Value must be between 1-64 inclusive.
#define ECAN_BRP_VAL 5
// PHSEG1 value - Value must be between 1-8 inclusive.
#define ECAN_PHSEG1_VAL 7
// PHSEG2 value - Value must be between 1-8 inclusive.
#define ECAN_PHSEG2_VAL 6
// PROPSEG value - Value must be between 1-8 inclusive.
#define ECAN_PROPSEG_VAL 2
2. Have you terminated the bus? 120 ohm resistors at either end.
Yes, I'm using standard termination (120) in both sides
3. Does the ARM board work or is it also under development? If it does work, start there. Get it to send a message. Look at the bus with a scope. If the message stays on the bus forever, then youir PIC isn't sending an ACK to tell the sender to not retry.
It is not under development, but I don´t have a lot of tools to test can bus. I can send and receive messages between two arms with no problem
I looked at the bus with my scope, I could see bus activity. I think PIC isn´t sending an ACK. My Next question. When and how is PIC sending back an acknowledge to the bus? I really need to learn more about CAN protocol in data sheet I couldn´t find enough data.
Once the message is gone work on the PIC side to test for the message available and write a small dump routine to display the register values and flags. Very useful for testing.
Can you explain me how to do that or where can find an example?
I appreciate very much your help
Very begginer Mariela.