andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
Weird I2C issue |
Posted: Tue May 09, 2006 12:45 am |
|
|
I'm working on a system where an 18F2455 (ultimately for its USB port) is using I2C to communicate with up to 16 18F2480s (for their CAN ports). All using hardware I2C support, running at 8MHz and using the I2C slow mode.
Messages are passed using fixed-length multi-byte transfers of 12 bytes each.
I'd been getting the occasional bad data, so I decided to add a CRC-CCITT to the data. At that point everything stopped working. The weird part is when I switched the 18F2455 master to software I2C everything started working again.
Has anyone experienced anything like that?
My problem is that in order for the I2C comms to be reliable, I now need to disable interrupts around the i2c_start..i2c_stop code, no doubt because the software needs to time things and interrupts throw the timing out. I'm pretty sure that's why the 18F2455 now appears to be dropping RS232 characters every now and again.
I have to say that for this current project, the biggest time sink by far has been the I2C stuff. It seems to be incredibly fragile and unreliable. I've been wondering if switching to a LIN bus might be a better idea? Are there other options? _________________ Andrew |
|