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 slave sends 0x5555, master receives 0xab55
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Fri Sep 18, 2020 11:27 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 19, 2020 12:12 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Sat Sep 19, 2020 4:54 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Sep 20, 2020 1:35 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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