View previous topic :: View next topic |
Author |
Message |
Joules
Joined: 02 Mar 2006 Posts: 9
|
CAN on 18F2580 |
Posted: Thu Mar 02, 2006 11:10 am |
|
|
Hi, I'm new to the board.
I'm developing a system using a 18F2580 and am having no luck getting it to recieve CAN messages. I can send them just fine, and when I only have 2 nodes on the bus I don't get any error frames (kvaser leaf is one node, the 2580 is the other), so I don't think it's hardware or the BRGCON registers.
The recieve functions in the EX_CAN program don't even work (only changes I made where specifying the correct device.h and the clock). again, xmit works fine.
any thoughts on this? |
|
|
sjbaxter
Joined: 26 Jan 2006 Posts: 141 Location: Cheshire, UK
|
|
Posted: Thu Mar 02, 2006 11:21 am |
|
|
Have you terminated the bus correctly ? Error frames are usually created from either bus termination being incorrect or a node on the bus is the wrong bit rate.
What kind of interval are you messages being sent at and what is the bus load ?
Give us some more info and a snippet of the program you are using to rx/tx can messages.
What is the other node that you are putting on the bus as that may be causing the error frames ?
What clock freq are you using, what bit rate are you after and what have you set the BRGCON registers to ? _________________ Regards,
Simon. |
|
|
Joules
Joined: 02 Mar 2006 Posts: 9
|
|
Posted: Thu Mar 02, 2006 11:46 am |
|
|
That's just it, I'm not getting any error frames, it's just not receiving data. I've got the 120-ohm resistor on the 2580. When I send data from the 2580 I can receive it on the other node. The CAN transceiver I'm using on this node is a TI SN65HVD251. The reason I thought it wasn't hardware or bus timing is because no errors are being generated.
The other node is a kvaser leaf (connected to a pc), I've tried sending messages one at a time and timed at a few different intervals (100 ms is what I'm using this instant).
Clock is 4mHz, bus speed is 125kbit/sec, and I've tried these 2 settings for the BRGCON registers (shooting for 125k bus speed, 75% sp, sjw = 1):
BRGCON1 = 0x01
BRGCON2 = 0x91
BRGCON3 = 0x01
and
BRGCON1 = 0x00
BRGCON2 = 0xAC
BRGCON3 = 0x03
again, both seem to work for xmit, neither for receive.
thanks for your help! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Joules
Joined: 02 Mar 2006 Posts: 9
|
THANKS!!!!!!! |
Posted: Thu Mar 02, 2006 12:55 pm |
|
|
PCM programmer, thanks so much!
problem was the extended ID, looks like others had the same problem, so I don't feel so stupid.
Thanks again. |
|
|
|