I2C to Accelerometer

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
stejo780
Posts: 4
Joined: Tue May 18, 2021 12:38 pm

I2C to Accelerometer

Post by stejo780 » Tue May 18, 2021 12:50 pm

Hi,

I'm trying to interface to a MEMSic MXC6655XA accelerometer from a Raspberry Pico board - without luck.
http://www.memsic.com/uploadfiles/2020/ ... 019223.pdf

An I2C scan results in three addresses, 0x2b, 0x2c and 0x2d. According to the datasheet the IC should be on 0x15, or 0x2a (?). So the first thing I don't really get is why the accelerometer reports three addresses after a scan and why they don't match.

Anyway, the real issue is that I'm not able to read the sensor. Reading the datasheet the protocol does not really match a normal I2C read or read from mem as they are described here
https://micropython.nxez.com/docs/micro ... e.I2C.html

I have tried them in different combinations and with different addresses but the Pico crashes. Any assistance how to handle this implementation of I2C would be much appreciated. What I was initially hoping for was that it would be as simple as

Code: Select all

value = i2c.readfrom_mem(0x2b, 0x00, 1)
Thanks,
Stefan

User avatar
Roberthh
Posts: 2759
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: I2C to Accelerometer

Post by Roberthh » Wed May 19, 2021 8:48 am

using i2c.scan() is the first simple test for connectivity. If that does not return the expected result, then further attempts will usually fail. So for the connection: are pull-up reistors in place? The datasheet recommends 2.7kOhm, but 4.7kOhm should be fine too. The internal Pull-Up resistors of the Pico are too large. It may work with slow baud rate.

stejo780
Posts: 4
Joined: Tue May 18, 2021 12:38 pm

Re: I2C to Accelerometer

Post by stejo780 » Wed May 19, 2021 9:14 am

Thanks for the feedback.

Yes, 2k7 pull-ups are in place. I2C scan gives the same response also on lower frequencies than 400k, tried all the way down to 4k.

User avatar
Roberthh
Posts: 2759
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: I2C to Accelerometer

Post by Roberthh » Wed May 19, 2021 10:22 am

Do you use a breakout board, and can you show a picture or link to it?

stejo780
Posts: 4
Joined: Tue May 18, 2021 12:38 pm

Re: I2C to Accelerometer

Post by stejo780 » Wed May 19, 2021 11:50 am

Here are a couple of photos
https://photos.app.goo.gl/bErE6vCQTXw5D9Xu5

It is an eval board from MEMSic. The wires are a little long (20-30cm) but I don't think that is the problem given that it did not help to reduce the frequency.

User avatar
Roberthh
Posts: 2759
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: I2C to Accelerometer

Post by Roberthh » Wed May 19, 2021 12:11 pm

Then it should have a Genuine Chip on it. Although it looks weird on the picture. But that may be a photo artifact. Did you solder the wires to the Pico board?

stejo780
Posts: 4
Joined: Tue May 18, 2021 12:38 pm

Re: I2C to Accelerometer

Post by stejo780 » Wed May 19, 2021 12:36 pm

Yes, the photo ended up a bit blurry. The Pico side is soldered, yes.

Post Reply