#317701 - 04/01/2009 04:41
I2C SDA Pullup Resistor Questions
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
This is for Stu, Mark, Hugo, and Patrick... but mostly Hugo and Patrick.
In my testing of someone else's Empeg this weekend that was having problems with the I2C fan controller I sold him.. I realized I also had the same issue lurking in my empeg. (In fact, hooking my scope probes made the problem occur fairly consistently.)
I was testing the I2C bus with my Agilent MSO6000 and realized (I didn't think of it before) that the pullup on SDA is way too big (100K). So, I made both units use a smaller (5.1K) resistor and both units work great now... I didn't drag out the specs for the CPU as I figured a 1mA pull-up current would be "ok".
I didn't change the one on SCL because it's obvious that line is being driven rail-to-rail... so the 100K is fine for any idle states where the SCL driver isn't set for output.
I wanted to get your opinion as to this change and alert other users in case they have issues with the I2C bus in their Empegs.
-Ben
p.s. I have lots of scope pics in case you'd like to see both before and after the change.
Edited by benjammin (04/01/2009 04:42)
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#317706 - 04/01/2009 09:36
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
I would agree that 100k does sound a bit high. I would use 10k as a starting point (befor considering any other reasons to go up or down).
It should only really be a problem if there is a lot of capacitance on the line. Of course, adding a CRO probe will be adding some more capacitance to that but it should be relatively insignificant.
Perhaps something else wasn't playing ball originally? The main reason I can think of is perhaps it something couldn't sink enough current.
Or perhaps something has introduced some capacitance to this particular empeg?
I2C has pretty solid requirements so normally this problem shouldn't ever happen.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#317724 - 04/01/2009 16:49
Re: I2C SDA Pullup Resistor Questions
[Re: Shonky]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
no, current sink looks great. nice and sharp. It's the pullup rise-times that show a lot of slope.
And I agree about the I2C requirements. So that's why I put in the different pullup. I had risetimes (measure 10-90% by my scope of around 25 and 26uS. Way too long.)
With 5.1K they are a lot like they should be. (I didn't measure since I compared against SCL's needed times and they look fine.)
-Ben
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#317726 - 04/01/2009 16:56
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
Mmm.. so perhaps I *should* increase the rise-time allowance when the empeg is driving SDA high?
I think the s/w currently allows 15usecs+ for that; I suppose we could bump it up by another usec or so ?
Ben, let me know what you see on your scope with v505+.
Cheers
|
Top
|
|
|
|
#317742 - 04/01/2009 20:25
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
I will. I should be able to get to it later tonight.
Thanks for all the coding though Mark. I do appreciate it.
-Ben
p.s. And anyone else who still wants to add a fan to their Empeg. I do have more of these little boards.
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#317745 - 04/01/2009 20:44
Re: I2C SDA Pullup Resistor Questions
[Re: Shonky]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
I would agree that 100k does sound a bit high. I would use 10k as a starting point (befor considering any other reasons to go up or down).
It should only really be a problem if there is a lot of capacitance on the line. There seems to be only one 100pf capacitor between SCL and GND on the Mk2a, plus whatever the traces themselves add. -ml
|
Top
|
|
|
|
#317746 - 04/01/2009 20:50
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
How did you measure that?
Don't forget the input capacitance of the pins on the 2 devices. (and the wiring we need to add to get the fan controller hooked in)
It definitely adds up -- and 100K is pretty big. That's 50uA of pullup current.
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#317755 - 05/01/2009 01:11
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
I'm back with tests... the weird "pre-start" condition of SCL is now gone... Thanks for the effort Mark!
For all of you though, here are some stats:
100K Ohm resistor ends up being anywhere from 25-35uS of pullup time on the SDA line. This equates roughly as 27Khz to 40KHz xfer rate. Ouch. I'm not sure how this worked before as Mark's code generates a hi-low time of about 1.3uS and 2.6uS. Basically, the clock "frequency" is about 280Khz right now.
With my 5.1K resistor installed, I have a pull-up time of 1.9uS, so there's plenty of setup time before clocking in the next bit.. I don't have such warm fuzzies about the stock configuration.
So I thought I would mention it to you guys here. I'm kinda surprised the things on the bus are happy at all. No wonder I was seeing the "fan control error" messages I was.
I have lots of screen shots off my scope if anyone is interested in seeing before and after "pics".
Cheers,
-Ben
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#317758 - 05/01/2009 01:47
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
It may be asking a lot, but..
Ben, could you put that 100K resistor back in there and double-check the rise time with 505+ ?
I'm thinking of releasing it as v506, but would like to have an idea of the margin available first. I suppose I could measure it here, but the table is already full of other stuff demanding my attentions.
Cheers
|
Top
|
|
|
|
#317761 - 05/01/2009 02:37
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
I did measure it - but didn't take scope shots with the measurement on. I'll send you some PNG's of those..
Either way, I would be happy to do it again... good thing I didn't put it back together yet!! hahahaha...
I'll have measurements tomorrow night since I'm ready to hit the sack soon.
But I'm happy to do it for ya.
-Ben
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#317765 - 05/01/2009 04:17
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
no, current sink looks great. nice and sharp. It's the pullup rise-times that show a lot of slope. I was saying that perhaps that's why the pullup was weak (i.e. 100k) i.e. something couldn't sink enough. Again though, that would be a pretty poorly designed I2C device if it was.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#317774 - 05/01/2009 13:06
Re: I2C SDA Pullup Resistor Questions
[Re: Shonky]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
To me, it just looks as if PCA plugged in something that worked (100K), and then just left it alone. They didn't have a good scope at the time to double-check things like this. And with lots of other stuff to deal with, it then got lost in the shuffle. No big deal. It works. Cheers
|
Top
|
|
|
|
#317777 - 05/01/2009 13:18
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
Mark, with the ones I just sent, feel free to post a comparison with the 5.1K installed (PNG's with "good" in the name). Shonky, if I may humbly offer the correction; 100K in this case "sources" current. I2C is an open-drain bus where open-drain typically denotes that the device sinks on demand while the pull-up resistor sources the needed current/voltage to bring the bus to V+. (I know you know this. My fingers tend to type things I wasn't thinking too. It's like they are on autopilot. ) Anyway - changing to 5.1K works great. I'm guessing that whatever it mastering the I2C lines (whether it's a transistor for 3.3->5V conversion or the strongArm itself, it has to be able to sink current like any I2C bus device might.The DS1721 is specified by what voltage is measured on SDA at 2 current level. 3mA (0.4V) and 6mA (0.6V). I would guess that 1mA would be fine for all as achieved by 5.1K.) Soooo... Anyway -- let me know if I'm smoking too much of my own product. Talk to yaz, -Ben
Edited by benjammin (05/01/2009 13:29)
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#317792 - 05/01/2009 22:44
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
Shonky, if I may humbly offer the correction;
100K in this case "sources" current. I2C is an open-drain bus where open-drain typically denotes that the device sinks on demand while the pull-up resistor sources the needed current/voltage to bring the bus to V+. (I know you know this. My fingers tend to type things I wasn't thinking too. It's like they are on autopilot. )
Yep and I'm saying a device on the bus possibly couldn't sink enough current to pull the SDA sufficiently low - so the solution was possibly a weaker pull up. It is still strange though. This then results in the slow rise times you have seen when whichever device stops pulling SDA low. We're talking about the same thing but you're talking about the effect I think whilst I'm thinking of the cause.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#317811 - 06/01/2009 04:15
Re: I2C SDA Pullup Resistor Questions
[Re: Shonky]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
Yea, I can't see why - I'd have to read the I2C specs again, but I think any device to meet the 100KHz, 400KHz specs would have to be able to sink some given amount of current for a bus length of X....
So yea, it's weird that it ended up being 100Kohms.
Anyone know how many devices are on the bus? I can only think of 2.
-Ben
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#318048 - 13/01/2009 08:23
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
carpal tunnel
Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
|
Yea, I can't see why - I'd have to read the I2C specs again, but I think any device to meet the 100KHz, 400KHz specs would have to be able to sink some given amount of current for a bus length of X....
So yea, it's weird that it ended up being 100Kohms.
Anyone know how many devices are on the bus? I can only think of 2. Damn, all the skeletons are coming out of the cupboard now Yeah, this should have been 10k (or even less). We didn't own a scope at the time this was designed hence the issue was never actually seen (ie we never looked at it, and the original software had very long bit delays in the i2c driver). To mitigate at least part of the problem, we have a shorter delay if we're sending a zero bit. edit: At least, that's how I remember it. Did you see that in the code, Mark? Really, adjacent 1 bits being sent in a row only need a delay for the first one too. Once some units had shipped with this then it was kinda not worth fixing - that and we didn't really do anything that was very urgent on i2c throughput. The 100pF caps were recommended by Philips to reduce any audio coupling from the falling edges. Hugo
Edited by altman (13/01/2009 08:25)
|
Top
|
|
|
|
#318054 - 13/01/2009 14:11
Re: I2C SDA Pullup Resistor Questions
[Re: altman]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
edit: At least, that's how I remember it. Did you see that in the code, Mark? Really, adjacent 1 bits being sent in a row only need a delay for the first one too. Yup, that's how it (still) works today. Very long delay for 0->1 transitions, very short delay for anything else, which also now includes 0->0 and 1->1 non-transitions. The time-critical part is that much of this runs with interrupts disabled, so we don't like to take any longer than necessary inside there. I've also added a usage semaphore to protect against multiple tasks trying to use it simultaneously, which only really happens when a fan controller is present. Cheers
Edited by mlord (13/01/2009 15:30)
|
Top
|
|
|
|
#318057 - 13/01/2009 15:02
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
carpal tunnel
Registered: 08/07/1999
Posts: 5549
Loc: Ajijic, Mexico
|
I've also added a usage semaphore to protect against multiple tasks trying to use it simultaneously, which only really happens when a fan controller is present. Is this what would prevent my getting a "Fan control error" message about once out of every 20 times I boot up my empeg? (I am running an older version (#487) of HiJack.) Being of the mentality "If it ain't broke don't fix it", I haven't updated it in a long time. tanstaafl.
_________________________
"There Ain't No Such Thing As A Free Lunch"
|
Top
|
|
|
|
#318060 - 13/01/2009 15:23
Re: I2C SDA Pullup Resistor Questions
[Re: tanstaafl.]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
Ahh.. the "fan control error" is the topic of this thread: the pull-up resistor value being a tad high. The latest Hijack tries to improve the timing somewhat in light of that, and would probably help your player. Assuming, that is, that your player actually has had a fan/controller installed into it? Otherwise, you should delete the fan_control=1 line from the player's config.ini file! Cheers
Edited by mlord (13/01/2009 15:25)
|
Top
|
|
|
|
#318062 - 13/01/2009 16:02
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
member
Registered: 11/08/2002
Posts: 188
Loc: Champaign, IL
|
Is this what would prevent my getting a "Fan control error" message about once out of every 20 times I boot up my empeg? (I am running an older version (#487) of HiJack.) Being of the mentality "If it ain't broke don't fix it", I haven't updated it in a long time.
Otherwise, the answer is "yes" -- I was having the same problem... with my empeg on hijack v479 and I was installing a fan controller into another empeg when I really saw the problem during testing. So I dug a little.. and poof! Hugo has answered the question. There's one of 2 ways to fix the problem: 1: Software (which Mark has done) 2: Hardware (which I have done) - even though the firmware doesn't use the I2C bus at full speed. It makes me feel better anyway. -Ben p.s. Hey Hugo, thanks for your input! Feel free to send me your proto's next time and I'll test 'em!
_________________________
Empeg Mk2 in fabulous green! Green Face, Green BackLit Buttons... GREEN...
|
Top
|
|
|
|
#318064 - 13/01/2009 16:17
Re: I2C SDA Pullup Resistor Questions
[Re: benjammin]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
Mmm.. I suppose I ought to have hijack stretch the 0->1 timing even more when a fan controller is actually installed, but leave the current quicker timing otherwise..
-ml
|
Top
|
|
|
|
#318077 - 13/01/2009 18:36
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
carpal tunnel
Registered: 08/07/1999
Posts: 5549
Loc: Ajijic, Mexico
|
Mmm.. I suppose I ought to have hijack stretch the 0->1 timing even more when a fan controller is actually installed, but leave the current quicker timing otherwise..
-ml Well, if you do that, I'll break with tradition and update my hijack kernel (yes, I do have a fan and controller). FWIW, my fan didn't really help my overheating problem. The only time I overheated was when the weather was really cold (Alaska) -- like 10 below zero or colder. This meant I had to run the defrosters at full tilt to keep the windshield clear, and the empeg is mounted in a dead-air space in the dash with the main defroster ducts running close by. When the empeg got hot enough to turn on the fan, it was just blowing air through it that was at least as hot as the empeg, and shortly the overheat alarm would sound. I could cool it down pretty darn quick by pulling it out of the dash and holding it out the window as I drove. About 30 seconds of that (don't try this at home, kids, unless you're wearing gloves) and I could pop it back into the dash for another half hour or so. Gee, I wonder how much I'm going to miss Alaska once I'm living in Mexico? tanstaafl. Edit: If anyone cares (not that there's much reason that anybody should care) I have posted a slide show of my Mexican condominium here on Shutterfly. (Click on the full screen icon near the upper right of the picture frame to get the best effect) Hmmm... bug in Shutterfly's UI. When I go to full screen, the pictures don't advance automatically. Just click anywhere in the picture and it will advance to the next. YMMV. db
Edited by tanstaafl. (13/01/2009 22:42) Edit Reason: post link to pictures
_________________________
"There Ain't No Such Thing As A Free Lunch"
|
Top
|
|
|
|
#318087 - 13/01/2009 20:04
Re: I2C SDA Pullup Resistor Questions
[Re: tanstaafl.]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
About 30 seconds of that (don't try this at home, kids, unless you're wearing gloves) and I could pop it back into the dash for another half hour or so. Three cheers for extreme thermal cycling of winchester drives. How often have you needed to replace your hard disks now?
|
Top
|
|
|
|
#318101 - 13/01/2009 22:32
Re: I2C SDA Pullup Resistor Questions
[Re: tfabris]
|
carpal tunnel
Registered: 08/07/1999
Posts: 5549
Loc: Ajijic, Mexico
|
About 30 seconds of that (don't try this at home, kids, unless you're wearing gloves) and I could pop it back into the dash for another half hour or so. Three cheers for extreme thermal cycling of winchester drives. How often have you needed to replace your hard disks now? To the best of my recollection, all my drive replacements have been to increase capacity. I don't think I've ever had a drive failure. I went from a 10 to a 40, then to dual 40s, then to dual 80s. tanstaafl.
_________________________
"There Ain't No Such Thing As A Free Lunch"
|
Top
|
|
|
|
#318718 - 01/02/2009 18:07
Re: I2C SDA Pullup Resistor Questions
[Re: tanstaafl.]
|
addict
Registered: 22/11/2007
Posts: 475
Loc: Denmark, Odense
|
i was the one who had my fan controller checked by ben...
what resistors was it that mine had changed to? and can i safely upgrade hijack?
_________________________
the "monkey" who learned to check a harddrive
|
Top
|
|
|
|
#318719 - 01/02/2009 19:21
Re: I2C SDA Pullup Resistor Questions
[Re: Boelle]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14493
Loc: Canada
|
Sure, no harm or issues whatsoever.
|
Top
|
|
|
|
#318720 - 01/02/2009 19:35
Re: I2C SDA Pullup Resistor Questions
[Re: mlord]
|
addict
Registered: 22/11/2007
Posts: 475
Loc: Denmark, Odense
|
:-) some should put the beuty back in production
_________________________
the "monkey" who learned to check a harddrive
|
Top
|
|
|
|
|
|