Trying to initialize the LIS3DH accelerometer with the E0, not the Electron. When I initialize the accelerometer I get a response “device not found”.
I have the SDA connected to C4 on the E0. I believe the code I am using sets up the SDA to D4 assuming I am using a Particle Electron. How can I change this? Please see the screenshot below:
Hi,
I think that there is a glitch in the description as Wire1 object use pin C4 as SDA and C5 as SCL on both electron and e0 boards as you can see here-electron, and here-E0
What about your CS pin ? is disconnected or connected to 3V3 ? as if is grounded it’s switched to SPI.
What about your SD0 pin ? (address selection) NC or GND = 0x18 HIGH = 0x19 (default is pulled LOW by R1):
Did you use any additional pull-ups on SDA/SCL ?
Could you share a picture how did you connected everything ?
Here is some more resources about this accelerometer:
Here is a snapshot of my schematic.
Also, here’s my code to initialize:
I see nice clean pulses on the SCL signal and nice clean data on the SDA signal (with my O’scope), so I am really puzzled.
I believe we are using Rickkas’s Github code.
My programmer, who has now had a career change wrote the code. I started programming in 1968, but I am very limited in CPP.
Thanks for your help.
Are you using the primary Wire
interface on D0/D1? You can’t use both Wire
and Wire1
at the same time on the Electron and E Series because they use the same STM32 I2C peripheral. Only one can be used at a time.
I’d first try running an I2C Scanner on Wire1
to make sure the device can be found and it has the right I2C address.
It looks like SDO=GND for address 0, CS=3V3 for I2C mode so that looks correct.
Tom,
You definitely not using a Rickkas code as I can see from your screenshot of your workbench.
what is weird that you can see the clock signal and data on your oscilloscope could you trace your paths on PCB with multi-meter and check for conductivity ? (from C5/C4 to accelometer SCL/SDA)
Are you using any different sensor/device which which using D1/D0 pins (Wire object) as per doc: the both Wire (D0/D1), Wire1(C5/C4) can’t be used at the same time
EDIT:
ups looks like @rickkas7 just mentioned about that
will be easier if you can share with us your entire code
Hi Rick,
I downloaded the i2c Scanner from the link you provided, and executed the code. However, it runs wire, not wire1, so it did not know which pins to communicate on. Can I just change “Wire” in the code to “Wire1”, compile and run it? Otherwise I don’t think it knows to use C4 & C5 for SDA and SCL. Will I have to include another library?
Hi dreamER, We use D0 and D1 for other things, not i2c. The accelerometer is the only device we communicate with i2c communications. We do communicate with a ds18b20 on signal D6 with a similar communications, I think, but not the same as i2c. I did not see “wire” specifically mentioned in the code for the ds18b20 temperature sensor.
I am happy to share our entire code with you, but it includes many modules. How should I go about sharing it? Can I invite you to see the github repository or is there another way?
Yup, that should work.
@TomEldredge
Yes GitHub will work best.
Just a question did you trace the PCB paths from C5/C4 to accelerometer SCL/SDA ? with ohm-meter on beep mode with power off ? also could you check the voltage level on pin#1(VDD_IO) - 3V3, pin#14(VDD) - 3V3, pin#8(CS) - 3V3, pin#7(SD0) - GND 0V
I'm assuming that you are using your own PCB and maybe there is some bad connection/broken path etc.
Also you can consider to change your pull-ups from 10K to 4K7
Hi, dreamER,
Thank you for your help. I did check with my multimeter, the voltages on pins 1, 14, 8 and 7. They were correct. Actually, the voltage on SD0 was +1.34 because in my circuit I used a 10k ohm resistor to pull it to ground. So, I installed a jumper to pull it directly to ground (0v). I didn’t yet use the ohmmeter to test the SCL/SDA signals. I just used my 0’scope to verify that the signals that I observed on E0 pins C4 and C5 are exactly what I see at the pins going under the accelerometer. The longest trace between the accelerometer and the E0 pins is about 5/8". Of course, we cannot access the pins directly, as they are under the LIS3DH IC. I use a manual pick n place machine to build these prototypes, and I could have a problem under the IC, but I have six boards under test all with the same problem, and the accelerometers all look like they are well placed onto the circuit board, so that is not my first assumption. I will try some more tests like the one Rick suggested and another one before I take the board back to the de-solder station and check under the IC. Thanks again. I’ll check to see whether I have a 4.7k ohm quad resistor. That’s a good idea. I might be able to stack two 10k’s on top of one another if not.
Thank you for your help.
What email should I invite to Github?
Tom
Tom,
One more question
Are your accelerometer LIS3DH looks exactly as the one from adafruit ?
or is BGA type and any legs didn’t stick out ? I’m curious because i using Fluke 8845A-EFPT Fine Point Extended Test Probe
which should work in this case and you do not need to de-solder the LIS from your PCB
Hi dreamER, Rick, ScruffR,
Fixed! Thank you all for your help. Your suggestions all helped me realize that it had to be a hardware issue. The I2c Scanner was also very helpful. It took two more sessions at the solder station to get all 16 pins soldered under that tiny LISDH chip. Probably that is the same issue with the other five boards. Thank you all for your help.
If it weren’t for men like you who reach out to people like me, I wouldn’t be able to do this. You are thoughtful, courteous, and professional. Thank you very much for your patience.
Sincerely,
Tom Eldredge
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.