Hi Lawrence,
Thanks for the detailed explanation.
I have done few experiments with 16mA drive strength on Grove Gesture, Grove Digital light sensors and LCD RGB backlight. I hit 2 issues.
Issue 1: (With Digital Light sensor (0x29)) 10K on board pull up: -------
With the Rev A sensor board what Am seeing is a cross talk between SDA and SCL. The spikes are too high that the ACK is not detected by the master.
Attached are some waveforms to confirm this In the "Not-Detected-Cross-Talk-(0x29).BMP" waveforms we can see spikes which are at the rising edge of the clocks which is worst in the ack clk cycle.
I repeated same experiment by splitting the SCLK out of the Grove ribbon cable. "Detected-with-Split-Cable(0x29).bmp" has the captured wave form. Now the slave gets less spikes and the master can detect it.
Quick read on the internet suggested that the layout of the tracks or the ribbon cable which exceeds 10cm should be something of below order:
SDA - VDD - VSS - SCL
This arrangement would avoid cross talk between SDA and SCL. Grove connector cables are definitely in the order which are prone to cross talk. Not sure if we can fix though :-)
Are we taking care of this at layout level?
References: http://www.nxp.com/documents/user_manual/UM10204.pdf ( Section: 7.5 Wiring pattern of the bus lines)
Am not sure if Rev B is taking care of this or Is it possible to compensate such thing if external ribbon cables are in wrong order?
Issue 2: (With Gesture sensor) 2.2K on board pull up: -------
I cant detect this sensor, Possibly it might be a faulty one. Waveforms look normal. Will continue to debug with other devices.
Changing the clock speed did not help in both the issues.
Thanks, srini
On 11/11/15 18:44, King, Lawrence wrote:
Hi Srini:
The I2C bus specification has no concept of “Drive Strength”, it just assumes that the open collector can sink at least 4mA at 0.4V. Our ASICs certainly do have a concept of drive strength. All GPIOs have programmable drive strength of 2-16mA (see LM80-P0436-7 Rev B page 23). I2C “open collector” is ‘simulated’ by the QUP by either driving the GPIO pin low (normal GPIO drive) or setting the GPIO to input mode and letting the signal float to wherever it wants to (pull-up). The drive strength is programmed in the register TLMM_GPIO_CFGn (see LM80-P0436-13 Rev B “Hardware Register Description” Table 2-1 page 3013), the GPIO has no idea that the QUP behind it is simulating open collector. The GPIO has no special mode for open collector.
In this specific case you want to change GPIO6 and GPIO7 (the I2C bus). I have the source code for a much older build of Linux on my computer, so I looked in ./410c/kernel/arch/arm64/boot/dts/qcom/msm8916.dtsi and I found this:
i2c4_default: i2c4_default { pinmux { function = "blsp_i2c4"; pins = "gpio14", "gpio15"; }; pinconf { pins = "gpio14", "gpio15"; drive-strength = <2>; bias-disable = <0>; }; };
Of course this is the wrong I2C for what we are doing (my build is old and we didn’t have I2C turned on at that time), but you can clearly see the Drive Strength setting. Please change it to “16”.
Lawrence King lking@qti.qualcomm.com mailto:lking@qti.qualcomm.com
Engineer, Sr. Staff/Manager
Qualcomm Canada Inc.
(905)482-5403 desk (x25403)
(416)627-7302 cell
*From:*glikely@secretlab.ca [mailto:glikely@secretlab.ca] *On Behalf Of *Grant Likely *Sent:* Wednesday, November 11, 2015 11:20 AM *To:* King, Lawrence lking@qti.qualcomm.com *Cc:* Mark Brown mark.brown@linaro.org; Akira Tsukamoto akira.tsukamoto@linaro.org; David Mandala david.mandala@linaro.org; mezzanine@lists.96boards.org; Gandhi, Ketal ketalg@qti.qualcomm.com; George Grey george.grey@linaro.org; Koen Kooi koen.kooi@linaro.org; 96boards-team 96boards-team@linaro.org; Srinivas Kandagatla srinivas.kandagatla@linaro.org *Subject:* Re: Sensors board Rev B - call for review (v2)
On Tue, Nov 10, 2015 at 6:58 PM, King, Lawrence <lking@qti.qualcomm.com mailto:lking@qti.qualcomm.com> wrote:
Hi Grant 22 Ohms series resistor is fine. When you have something actually connected to the port then it may be necessary to change the resistance (although 22 is usually close enough). The 22 can stay as a place holder, and only those customers needing to fine-tune the signals can change to something different. I believe that the GPIO drive strength can be modified (and if I am not mistaken it is currently set to 2mA). Please change the drive strength up to 16mA, this should make the low levels lower. Here is a somewhat simplified diagram of the I2C circuit:
[cc'ing Sri
ni
, he may be able to help me here]
Do you know how to get Linux to change the drive strength on those pins? I assume it is a change to the DT, but I don't know the bindings used for the qualcomm pin controller.
When the SOC pulls it’s output low a number of things start to happen. 1)The SOC is sinking current from it’s internal pull-up resistor (R1) 2)The SOC is sinking current from the level shifter internal pull-up (R2) 3)As the levels drop to about 1V at the left side of the level shifter the pass transistor starts to turn on. 4)As the pass transistor turns on the voltage at the right side of the level shifter also starts to drop and current flows through the pass transistor towards the SOC. 5)As the levels on the right side of the level shifter get even lower, the SOC is sinking current from R3, R4, and R5 (all in parallel). 6)The SOC hits it’s current limit (2mA) and refuses to drive the output voltage lower. There is a small voltage drop across the pass transistor in the level shifter but for this simplified computation we can ignore it. Assuming we are using TXS0108E level shifter, approximate values for the resistors are: R1=40k (assuming you haven’t turned it off) R2=R3=40k Ohms (actually it starts out as 10kOhms and only after you get below 0.8V does it change to 40kOhms so the calculations below are optimistic) R4 = 5k Ohms (I am not sure what value you selected for your board)
There is no R4 at the moment. The current board relies on the internal 10k. If any additional pull-up is added then the Grove RGB LCD isn't able to drive the data line low enough to register at the baseboard.
R5 = 2.2k Ohms (depends on what Seed Studio module you have connected, they seen to vary between 2.2k and 10k for the modules I have looked at). Assuming that the SOC output were able to drive to 0.4V (a nice valid low level, the total current from the 1.8V (Left) side of the level shifters (1.8-0.4=1.4V) would be: I_L = 1.4/R1 + 1.4/R2 = 1.4/40,000 + 1.4/40,000 = 70uA (micro Amps, OK so far) And on the right side (3.3-0.4=2.9V) (things get worse if you are running a 5.0V device). I_R = 2.9/R3 +2.9/R4 +2.9/R5 = 72uA + 508uA + 1.32mA = 1.97mA Total current I_L + I_R = 2.04mA or just above the limit of the SOC. Hence my recommendation to turn the drive strength of the SOC to max (16mA). This should really help your low levels. One other thing I noticed with the TXS0108E, if you get too much capacitance load on the output (example a Seeed Studio hub and 3 devices, all connected by 6 inch Seeed cables) the output will burst into oscillation at ~35MHz. you can’t see this with a voltmeter, but everything stops working.
That is what I've heard from others is a limitation of this part. If I had more time I would have swapped it out for a different shifter IC, but the schedule of the hack-a-thon means I have to stick with what I've got. :-(
g.
Lawrence King lking@qti.qualcomm.com <mailto:lking@qti.qualcomm.com> Engineer, Sr. Staff/Manager Qualcomm Canada Inc. (905)482-5403 desk (x25403) (416)627-7302 cell *From:*Mark Brown [mailto:mark.brown@linaro.org <mailto:mark.brown@linaro.org>] *Sent:* Tuesday, November 10, 2015 9:34 AM *To:* Grant Likely <grant.likely@linaro.org <mailto:grant.likely@linaro.org>> *Cc:* Akira Tsukamoto <akira.tsukamoto@linaro.org <mailto:akira.tsukamoto@linaro.org>>; David Mandala <david.mandala@linaro.org <mailto:david.mandala@linaro.org>>; King, Lawrence <lking@qti.qualcomm.com <mailto:lking@qti.qualcomm.com>>; mezzanine@lists.96boards.org <mailto:mezzanine@lists.96boards.org>; Gandhi, Ketal <ketalg@qti.qualcomm.com <mailto:ketalg@qti.qualcomm.com>>; George Grey <george.grey@linaro.org <mailto:george.grey@linaro.org>>; Koen Kooi <koen.kooi@linaro.org <mailto:koen.kooi@linaro.org>>; 96boards-team <96boards-team@linaro.org <mailto:96boards-team@linaro.org>> *Subject:* Re: Sensors board Rev B - call for review (v2) On 10 November 2015 at 14:31, Grant Likely <grant.likely@linaro.org <mailto:grant.likely@linaro.org>> wrote: After doing a bunch of testing here at home, I've got 22ohm resistors in series on the i2c, but I didn't add them to the SPI lines. The SPI lines are driven through a push-pull driver, will it still be necessary to have in-line resistors for SPI? Not an EE but the SPI designs I've seen with long traces have had them due to reflections.