|
|
View previous topic :: View next topic |
Author |
Message |
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Fri Sep 18, 2020 11:27 am |
|
|
hmm, yeah I tried adding "SLOW" to the #use I2C statement yesterday, but that did not affect anything. I will see if setting an explicit baud rate would help. I will also try disabling the slew rate limitation.
EDIT: In the end, setting a baud rate explicitly helped. If I set faster than "FAST=20000" I get the error, but below that I'm ok. I guess I2C devices operate faster than I thought. Disabling the slew rate limiter had no effect. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Sat Sep 19, 2020 12:12 am |
|
|
Ouch. That is slow.
However at least you have a solution.
May well be the compiler is turning the slew rate limit off by default.
What are your pull up resistors?. How long is the bus?. How many devices
are on it?. |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Sat Sep 19, 2020 4:54 am |
|
|
Ttelmah wrote: | Ouch. That is slow.
However at least you have a solution.
May well be the compiler is turning the slew rate limit off by default.
What are your pull up resistors?. How long is the bus?. How many devices
are on it?. |
Haha either that, or I add the 50 us delay between the reads.
My pull ups are: 4k7 on the master and I also have a 10k on the slave. The length of the bus, traces and cables included, couldn't be more than a foot. I've got an IO expander on the bus right on the board as well.
I guess I don't mind the speed. This is a device that I only really talk to about once per half hour, if that. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Sun Sep 20, 2020 1:35 am |
|
|
4K7, is _very_ large.
It is the value recommended for a _5v_ device on a short bus. Typically
works fine for this. However with a 3.3v device, the current drawn drops
to only about 0.6mA.
The formula:
Rp(Max) = Tr/(0.8473*Cbus)
Rearranges to give:
Cbus(max) = Tr/(0.8473*Rp)
For a standard mode bus (Tr == 1000nSec), gives
=1000E-9/(0.8473*3300)
= 3.576E-10
So this resistor value will fail to meet the I2C timing specifications for
a standard mode bus, if the capacitance goes above 357pF.
For a Fast mode bus (Tr==300nSec), we get:
= 300E-9/(0.847*3300)
= 1.07E-10
Just 107pF.
Now each device adds at least 10pF to the capacitance. A foot of cable,
depending massively on the cable chosen could easily be 100pF. Your
bus has inadequate pull-ups for what you describe.
The minimum pull up, for 3.3v on a standard driver, is just on 1KR.
Honestly halve your resistor value.
PIC's are particularly fussy devices about Tr being met. |
|
|
|
|
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
|