Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9872 Discussions

Using SPI with python to read accelerometer data

isamu2
Novice
1,303 Views

Hi everyone,

I am trying to use python to read data from mma7455

currently this is the code I am using but I am always getting 0s.

import mraa as m

x = m.Spi(0)

x.frequency(4000000)

x.write_word(0xAC05)

x.writeByte(0x08)

but I am getting zeros on all accelerometer data.

Please advice

Thank you

5 Replies
BHess
Novice
123 Views

Does it work with I2C?

Are you using 4-wire SPI? Or 3-wire?

isamu2
Novice
123 Views

Yes it works with i2c. I am using 4 wire SPI

J17-11 - SCL

J17-12 - SDA

J18-11 - SDO

J18-10 - CS

Sergio_A_Intel
Employee
123 Views

Hi,

Are you using an Arduino expansion board or a mini breakout board? Another customer is also trying to use the mma7455 sensor. He has run tests in I2C and SPI. He has also tried several boards and environments. Keep an eye on in case any progress is made on this thread.

What image and mraa versions are you using?

Sergio

isamu2
Novice
123 Views

configure_edison --version

159

opkg info libmraa0

0.7.3

The following code gives me 0L. The same thing when I was working with I2C.

x.write_word(0xAC05)

 

Sergio_A_Intel
Employee
123 Views

Hi,

You'll receive a reply to your question here . Please reply to that thread what is the specific model of the sensor you're using.

Sergio

Reply