Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
982 Views

About Inti joule's spi

Jump to solution

I'd like to use spi with marr,

 

The following error occurs.

------------

 

>>> import mraa

 

>>> mraa.getVersion()

 

'v1.1.2'

 

>>> spi = mraa.Spi(0)

 

Traceback (most recent call last):

 

File "", line 1, in

 

File "/usr/lib/python2.7/site-packages/mraa.py", line 1504, in __init__

 

this = _mraa.new_Spi(*args)

 

ValueError: Error initialising SPI bus

 

------------

Please tell me how to deal with it.

Where can I find out how to use spi?

0 Kudos
1 Solution
idata
Community Manager
78 Views

Hi Osakana,

 

 

I would love to help you with that, I think you should update your MRAA library first (the latest is v1.5.1). To do this you can follow the next link: https://software.intel.com/en-us/updating-libraries-for-joule.

 

 

After I updated the library I ran the example code in the MRAA repository without problems ( https://github.com/intel-iot-devkit/mraa/blob/master/examples/python/spi.py) and I added the line "print (m.getVersion())" to see the version that I'm using.

 

 

I hope you find this information useful.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo

View solution in original post

9 Replies
idata
Community Manager
79 Views

Hi Osakana,

 

 

I would love to help you with that, I think you should update your MRAA library first (the latest is v1.5.1). To do this you can follow the next link: https://software.intel.com/en-us/updating-libraries-for-joule.

 

 

After I updated the library I ran the example code in the MRAA repository without problems ( https://github.com/intel-iot-devkit/mraa/blob/master/examples/python/spi.py) and I added the line "print (m.getVersion())" to see the version that I'm using.

 

 

I hope you find this information useful.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo

View solution in original post

idata
Community Manager
78 Views

Hi Leonardo,

Thank you for your reply.

curl https://raw.githubusercontent.com/intel-iot-devkit/joule-code-samples/master/mraa-install.sh https://raw.githubusercontent.com/intel-iot-devkit/joule-code-samples/master/mraa-install.sh | sh

Installation succeeded!

The error disappeared.

I tried the example code next.

As a result, "We have an error captain!" Is displayed.

Is this correct?

It is an additional question,

 

How to switch SPI0 or SPI1?

 

m.Spi (0)、 m.Spi (1) Is it?

Please tell me.

idata
Community Manager
78 Views

Hi Osakana,

 

 

Yes, the example gave that line to me too, at least it initialized the SPI without problems.

 

 

You can use m.Spi (1) too, there shouldn't be issues with it. If you need more information about Python and MRAA, I suggest you to check the API: http://iotdk.intel.com/docs/master/mraa/python/mraa.html# spi

 

 

I hope you find this useful.

 

 

Have a nice weekend.

 

 

Regards,

 

-Leonardo
idata
Community Manager
78 Views

Hi Leonardo,

Thanks for the reply again.

It is in the same state.

 

So is SPI still in the preparation stage?
idata
Community Manager
78 Views

Hi Osakana,

 

 

What do you mean with "It is in the same state"? And about the last question, can you explain it to me?

 

 

I will be waiting for your reply.

 

 

Regards,

 

-Leonardo
idata
Community Manager
78 Views

Hi Leonardo,

I'm sorry.

The result you tried is the same as the result I tried.

Is SPI usable commonly?

idata
Community Manager
78 Views

Hi Osakana,

 

 

There shouldn't be problems using the SPI, in the example you are getting the message "We have an error captain!", because you have to connect MISO to MOSI on your board, it is commented on the code.

 

 

In case that you are going to use Spi(0), you have to connect J12Pin2 to J12Pin4, if you use Spi(1) you have to connect J13Pin29 to J13Pin27. If you do this in the example you won't get the error message.

 

 

I hope you find this information useful.

 

 

Regards,

 

-Leonardo
idata
Community Manager
78 Views

Hi Leonardo,

Thanks for the reply.

>There shouldn't be problems using the SPI, in the example you are getting the message

>"We have an error >captain!", because you have to connect MISO to MOSI on your board,

>it is commented on the code.

I am convinced

I want to light the LED of dotestar (APA 102).

 

I am referring to Edison's sample, but it does not work properly.

https://github.com/smoyerman/EdisonDotStar https://github.com/smoyerman/EdisonDotStar

Please give me some hints.

idata
Community Manager
78 Views

Hi Osakana,

 

 

I'm not sure why this doesn't work, and I don't have a DotStart to try it.

 

 

At least the example ran without error messages, and I don't think it is a SPI issue. So I recommend you to try to contact the author of the example to help you more.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo
Reply