Hi Tim,
I suggest you start setting up communication in one direction first and add the reply function in the next step.
Make your receiver blink a LED or put out something on a terminal when it has successfully received data.
I have been debugging my CAN settings with a Microchip MCP2515 eval board that I won on a exhibition years ago.
CAN is not that easy if you start from zero, so it was very helpful to have something at hand that HAD to be working...
My CAN node sends data to a unit and only acknowledges incoming messages.
while (RXB0CON.7 = 1) or (RXB1CON.7 = 1) 'check receive flag and wait for silence on CAN-Bus
RXB0CON.7 = 0
RXB1CON.7 = 0
pause 100
@ clrwdt
wend
After that the PIC shuts down, maybe you can implement a check of the receive flag to blink a LED...
How does your CAN setup look like?
My init sequence:
CANCON = 128 'Config Mode
brgcon1 = $01
brgcon2 = $BF
brgcon3 = $07
ciocon = 32 'CANTX recessive high
TXB0SIDH = $AE 'Identifier für Klemmenstatus =$575
TXB0SIDL = $A0 'Identifier für Klemmenstatus
TXB0DLC = 1 ' Länge 1 Byte
CANCON = 0 ' Normal Mode
I got the BRGCON values from the Microchip calculator for 100 kBaud and 10MHz clock.
I see from your post, that you more or less already tried out the tips I could give you.
I also noticed that the terminator resistor disturbed transmission, so I skipped it.
Which CAN transceiver are you using?
Can you post some snippets of your code?
If your PIC has internal PLL, did you configure it correctly?
Regards,
Ingo
Bookmarks