View previous topic :: View next topic |
Author |
Message |
capfelix
Joined: 02 Dec 2005 Posts: 9
|
#use i2c fast=400000 doesn't output such bitrate |
Posted: Tue Mar 27, 2007 9:40 am |
|
|
Hi,
I have trouble getting a correct I2C speed by using #use i2c fast=400000. What I measured on the bus is only around 200khz instead of 400khz as what written in the code. I have to increase it to fast=550000 in order to get close to 400khz.
Any insight about this? |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 27, 2007 10:18 am |
|
|
What is your clockrate?.
Are you using software I2C, or hardware I2C?.
What compiler version?.
Best Wishes |
|
|
capfelix
Joined: 02 Dec 2005 Posts: 9
|
|
Posted: Tue Mar 27, 2007 10:22 am |
|
|
Running at 20Mhz and I'm using Force_HW. |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 27, 2007 10:34 am |
|
|
FORCE_HW, means nothing, unless your pin numbers are right...
Post the actual #use I2C line.
Again, what compiler version.
Also, what PIC.
Assuming the #clock defintion is right, you should get 384615Hz (400000 is impossible), but I'd suspect the system is working in software mode.
Best Wishes |
|
|
capfelix
Joined: 02 Dec 2005 Posts: 9
|
|
Posted: Thu Mar 29, 2007 1:30 am |
|
|
Hi,
I'm using PIC18F4455 and the pin is B0 and B1, which are MSSP I2C pin.
I'm using compiler v4.017.
#include <18F4455.h>
#use delay(clock=20000000)
#use i2c(master, sda=PIN_B0, scl=PIN_B1, FORCE_HW, fast=525000)
#use standard_io(A)
#use standard_io(B)
#use standard_io(C)
#use standard_io(D) |
|
|
Ttelmah Guest
|
|
Posted: Thu Mar 29, 2007 9:51 am |
|
|
Try it with 3.249.
Seriously, the V4 compilers, are _still_ not working even close to 'right', and are up in the .030's. I would not trust 4.017, to do much right...
Best Wishes |
|
|
|