CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CAN on 18F2580

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Joules



Joined: 02 Mar 2006
Posts: 9

View user's profile Send private message

CAN on 18F2580
PostPosted: Thu Mar 02, 2006 11:10 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu Mar 02, 2006 11:21 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 02, 2006 11:46 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 02, 2006 12:37 pm     Reply with quote

See threads like this one and the links within it:
http://www.ccsinfo.com/forum/viewtopic.php?t=20387

Also try the code for loopback mode, as described in one
of the links.
Joules



Joined: 02 Mar 2006
Posts: 9

View user's profile Send private message

THANKS!!!!!!!
PostPosted: Thu Mar 02, 2006 12:55 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group