|
|
View previous topic :: View next topic |
Author |
Message |
microJuan
Joined: 08 Mar 2008 Posts: 6
|
CAN BUS RXIF flag |
Posted: Fri Apr 04, 2008 2:47 am |
|
|
Hi All,
I am new to CAN and using CCS, I recently purchased the CAN dev kit. All works well with the provided examples and all.
However, I have a device which outputs a CAN signal at 1MBit. I changed the baud register on the 18F4580.C file as discussed in
http://www.ccsinfo.com/forum/viewtopic.php?t=22138&start=8
I changed my registers to:
// the 3 lines below set registers for 1Mbit comms at 20MHz !!!
BRGCON1 = 0x00;
BRGCON2 = 0xA0;
BRGCON3 = 0x02;
(can someone confirm these for me please)
anyways, I can actually pick up data with these settings. But for some reason or other, my RXIF is raised, I cannot find any documentaion, that can suggest what might cause this problem. Also, whenever I connect the CAN devboard to the CAN Bus, other nodes drop out. Im confused.
Any suggestions or comments is greatly appreciated
Juan |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Fri Apr 04, 2008 11:37 am |
|
|
Howdy,
Using a downloaded bit timing calculator, I came up with the same BRGCONx values. The calculator did throw up a warning about the MCP2510 idle time violation (20 < 26 min). I do not know if this is an issue or not with your setup.
pg 329 (pdf page #)of the datasheet for 18F4580
If the messsage started to transmit but encountered an error condition, the TXERR and the IRXIF bits will be sent and an interrupt will be generated.
pg 342 (pdf page #)
When an error occurs during transmission or reception of a message, the message error flag, IRXIF, will be set...and an interrupt generated
This means the error occured with either the 18F4580 board or something else on the bus. I would systematically check all nodes on the bus.
Does the baud rate of all the devices match? Is your clock frequency stable for the device? Is your bus terminated correctly? Have you tried both standard identifiers and extended identifiers? If you have the 18F4580 in listen-only mode, do you still have the problem? Do you have a PC tool or scope which will detect bus errors (error frame, bus off, dominant / passive incorrect states)? What is the bus loading (% load of full bus traffic)?
Is 1 MBaud needed? How about 250K or 125K? These rates are more typical for implementation of specific protocols like CANopen or J1939.
With such a high baud rate the cable length is reduced (as compared to other baud rates). What happens if you shorted the backbone to a few meters? The J1939 spec for drops off the backbone for 250 KBaud is less than 1 meter. I would take this to mean drops off the backbone at higher rates should be shorter than 1 meter, but I have never used this high of a baud rate.
Cheers,
JMA |
|
|
|
|
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
|