View previous topic :: View next topic |
Author |
Message |
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
I2C question |
Posted: Thu Apr 01, 2004 9:50 pm |
|
|
In a project I'm using the Hardware I2C (PIC16F876,pCM3.185) to talk to a Phillips Frontend PAL tuner. A couple of days ago I got a few samples back from the manufacturer. The problem is on some of the boards the hardware I2C doesn't work. If I take the FORCE_HW out of my #use I2C definition aand make it a software I2C then everything works fine, but when I put it back in there it fails again. And as I said this happens only on some of the boards. I'm sure the PICs are not faulty because I tried changing them around but it didn't help. Does anybody know why this is happening? My pull-ups are 3.9k. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Apr 01, 2004 11:11 pm |
|
|
What i2c bus speed are you using ? The default speed ?
or fast mode ? |
|
![](templates/subSilver/images/spacer.gif) |
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Thu Apr 01, 2004 11:41 pm |
|
|
This is my I2C definition:
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)//,FORCE_HW)
I can't recall if I tried it without the FAST or not. Could this be the problem? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 02, 2004 1:23 am |
|
|
Years ago, I noticed that the 16F87x series had a problem with
hardware i2c. It seemed to me that the duty cycle of the
SCL waveform was reversed from the way that Philips wanted
it to be. Philips would prefer that it be low for a longer period
than it is high. But Microchip has it reversed. So it may not
meet spec for the Philips chip that you're using. That's a
possibility, anyway. You can check it with a scope.
Also, what's the crystal frequency that you're using for the PIC ?
I haven't measured it lately, but historically for software i2c,
the CCS library functions produced a SCL clock frequency that was
much slower than the nominal values of 100 KHz and 400 KHz.
(ie., something like 40 KHz in Slow mode, if you used a 4 MHz crystal).
So that could be a clue. When you go to software i2c, you may
simply be running everything more slowly and perhaps the Philips
chip likes that.
I would check your resistors and make sure they're really 3.9K
and not 39K.
What is the actual p/n of the Philips chip that you're using ? |
|
![](templates/subSilver/images/spacer.gif) |
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Fri Apr 02, 2004 1:55 am |
|
|
Thanks PCM, interesting information about the hardware I2C. I was not aware of that.
My crystal is 4MHz and I've already made sure all my pull-ups are 3.9k.
I wonder why this is happening only on some of the boards...?
I'm using the I2C to communicate with the following parts:
Phillips FQ1216ME-MK3 PAL Tuner
or
Temic Telefunken Frontend 4006FH5 PAL Tuner
Their datasheets don't mention what I2C driver chips they use inside. |
|
![](templates/subSilver/images/spacer.gif) |
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Sun Apr 04, 2004 2:11 am |
|
|
Ok, I commented out the #USE I2C statement and coded all the I2C routines in pure assembly using the hardware module (it was actually a lot of fun). I tried it on one of the problematic boards and it worked. When I tried the #USE I2C (with FORCE_HW) again on the same board it failed (a software I2C still worked too).
It seems something is marginal in the hardware implementation of the CCS #USE I2C. The question is, how things can be marginal when it is using a hardware module? |
|
![](templates/subSilver/images/spacer.gif) |
blaker Guest
|
|
Posted: Sun Apr 04, 2004 3:18 pm |
|
|
I'm also working with some phillips rf chips. Mine is the TEA5768HL.
In the datasheet for the chip it says make sure you use an i2c speed < 400kHz. I imagine there are similar constraints for your chip.
Have you tried force hardware and SLOW? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Apr 04, 2004 3:50 pm |
|
|
They must be doing something differently than you are.
You could look at the .LST file for the CCS routines and
compare it to your routines and check for differences.
Before CCS had their own hardware routines, I ported some
code to CCS that was originally done by Julian Winpenny for
the C2C compiler. It's here:
http://www.ccsinfo.com/wwwboard/messages/725.html
The low level i2c routines are near the end of that post.
Maybe that code would work. But since you have working
ASM code, you may not need to experiment further.
I searched for that Philips part number on their website,
http://www.semiconductors.philips.com/cgi-bin/search/search.pl
and couldn't find it. Do you have a link to the data sheet ? |
|
![](templates/subSilver/images/spacer.gif) |
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Sun Apr 04, 2004 7:04 pm |
|
|
I'll probably use slow software I2C just to be safe. I don't want the units fail in the field and I can live with the code/performance overhead.
Here is the address to the tuner page. However it doesn't include any links to the datasheet, I had to email their customer service and request it.
http://www.business-sites.philips.com/Assets/Downloadablefile/FM_FQ_leaflet-735.pdf
The datasheet doesn't say anything about I2C speed.
If you think this part may be useful to you in the future just let me know and I'll send you the datasheet. |
|
![](templates/subSilver/images/spacer.gif) |
|