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 support@ccsinfo.com

I2C FORCE_HW PROBLEM

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



Joined: 12 Dec 2005
Posts: 50
Location: Curitiba - Brazil

View user's profile Send private message Send e-mail

I2C FORCE_HW PROBLEM
PostPosted: Wed Jan 11, 2006 7:32 am     Reply with quote

MPLAB 7.30 + CCS 3.241 + PIC18F8680

When I do "#use i2c(master,sda=PIN_C4,scl=PIN_C3,FORCE_HW)" the I2C does not initialize. When I comment the FORCE_HW --> "#use i2c(master,sda=PIN_C4,scl=PIN_C3)", it works fine. The problem seams to be when there are multiple devices on the I2C lines (each one with different addresses, obviously).
Why is it ?

Thanks in advance.
Pasini
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 12, 2006 2:47 pm     Reply with quote

I looked at the .LST file for an i2c_write(), and also at the init code
for the i2c module, and it looks OK. The code looks the same as
they do for an 18F452 and a 16F877 in FORCE_HW master mode.
pasini



Joined: 12 Dec 2005
Posts: 50
Location: Curitiba - Brazil

View user's profile Send private message Send e-mail

I2C FORCE_HW PROBLEM
PostPosted: Fri Jan 13, 2006 4:31 am     Reply with quote

The problem is probably due to SDA and SCL voltage levels. At the pins, "1" is 5V but "0" is as high as 3.5V. I had 10k pullups but changed to 2k2 resistors; no difference. When I2C_start() is called I can see the voltage change in the pin from 5V to 3.5V. What can make a pin have such voltage levels ?
This is happening even if the is configured as I/O, and a function like output_toggle(PIN_C3) is called.

Thanks
Pasini
Ttelmah
Guest







PostPosted: Fri Jan 13, 2006 5:22 am     Reply with quote

Seriously, the obvious answer is that there is something else on the lines preventing them being pulled down. A gate on a device driving high, or a short somewhere. Impedance of probably about 60R. Test by removing the PIC, and pulling the line to ground with a 1K resistor. Given that you have a 2.2K pull up, the line should go down to about 1.6V. I2C stuff, is not meant to drive the lines high, but to rely on the pull-ups. If it does not drop to this sort of voltage, look elsewhere than the PIC...

Best Wishes
pasini



Joined: 12 Dec 2005
Posts: 50
Location: Curitiba - Brazil

View user's profile Send private message Send e-mail

I2C FORCE_HW PROBLEM
PostPosted: Fri Jan 13, 2006 10:01 am     Reply with quote

Yes, there was another I2C component that wasn´t in use but was soldered upsidedown. Soldering it correctly made I2C signals work properly.
Thanks for the help.
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