I've finaly received an answer from Onion about that topic :
"The SPI issue we will be investigating as soon as we can, however due to the overwhelming success of our crowdfunding campaigns, it may not be very fast. We also recommend submitting an issue to our github repo - or even a pull request if you work out a fix!"
The discussion is a bit to advanced for me here, but if I can help, don't hesitate to ask.
Brice
Brice Parent
@Brice Parent
Best posts made by Brice Parent
Latest posts made by Brice Parent
-
RE: SPI Pins for the Omega2
-
RE: SPI Pins for the Omega2
@James-Behrens I've open a ticket 12 days ago about that, without the 150uS delay that I didn't know about (I don't have a scope), but so far no answer from the team. I'll link it to your post for more info.
Also, if you find a workaround to be able to use more than 16 bytes without having to wait for a software update, like a software SPI or another library, please tell me about it.
-
RE: SPI Pins for the Omega2
@Pierre-Rossinès Have you been able to write more than 16 bytes? (if you needed to of course)
-
RE: SPI Pins for the Omega2
@Pierre-Rossinès Also, I don't remember what I've installed, but in my installed packages, I have (I only put the ones that seemed relevant to me) :
fast-gpio - 0.1-1 gpioctl-sysfs - 0.0.6-1 libonionspi - 0.1-1 pyOnionSpi - 0.1-1 python-base - 2.7.13-3 python-light - 2.7.13-3 spi-tool - 0.1-1 spi-tools - 1-cc6a41fdcec60610703ba6db488c621c64952898
I don't remember having manually installed anything other that pyOnionSpi and maybe python-light (and I'm not even sure for those two...), and I particularly don't remember having installed a specific version of spi-tools like I see here... But anyway, that"s what makes it partially work here !
Edit : But it looks like you just reversed the arguments when creating the OnionSpi object (use
1, 32766
instead of32766, 1
). -
RE: SPI Pins for the Omega2
@WereCatf Thanks. But how do I do that? I see no equivalent of what I've found in other implementations (opening the communication, sending multiple writes, closing the com). I tried :
pixels = [] for i in range(16): pixels.append(0xFF) spi.write(pixels) spi.write(pixels)
but it will write those 16 values twice, not add the second call at the end of the first.
Also,
spi.writeBytes
only inserts the value of [address] at the beginning of the list of values, so it does not address the problem. The two follogins statements are equivalent :spi.write([0x66, 0x00, 0xFF]) spi.writeBytes(0x66, [0x00, 0xFF])
@Pierre-Rossinès What works for me, even if it only partially works, is the following :
import onionSpi spi = onionSpi.OnionSpi(1, 32766) spi.speed = 1000000 spi.mode = 0 spi.lsbfirst = False spi.checkDevice() spi.registerDevice() spi.setupDevice() spi.write([0] * 16)
I'm not sure I need every single line though.
-
RE: SPI Pins for the Omega2
said in SPI Pins for the Omega2:
CS1 - GPIO6
SCLK - GPIO7
MOSI - GPIO8
MISO - GPIO9This worked for me.
Well, at least until some point. It allows me to write 16 bytes to the SPI bus, but if I try to send more, it doesn't work anymore. And if I tryspi.writeBytes(position, bytes_list)
(in python), it just inserts the byteposition
at the beginning ofbytes_list
, and has the same 16 bytes limitation.Did any of you experience this also ?
-
RE: Can't get WS2801 (SPI rgb leds strip) to work with Omega2
I took the pins numbers from the documentation for the Omega 2, so the page is probably not up-to-date !
So, thanks for pointing me in the right direction !
I now can drive my led strip ... but only the first 16 values !
If I do :
values = [0] * 16 # 16 or any lower number values[5] = 255 spi.write(values) time.sleep(0.5) values[5] = 0 spi.write(values) time.sleep(0.5)
I can see the led flashing.
But if instead of 16, I use a bigger number, I get :onion-spi:: Trasferring 0x00, 17 bytes ERROR: SPI transfer failed
and the led doesn't blink anymore (I have way more than enough rgb leds, and they all work, so it shouldn't be a problem from this side). Also, I only switch one ON at a time, not to draw too much current.
So I told myself that maybe the Omega wasn't able to send more than 16 bytes, so I tried to directly send values to the pixels using their addresses, but this method doesn't work as expected (as I expected, at least). I get :
spi.writeBytes(5, [255, 0, 0]) # does the same as this : spi.write([5, 255, 0, 0]) # instead of being roughly an equivalent to this : spi.write([0, 0, 0, 0, 0, 255, 0, 0]) # or more exactly that wouldn't set previous values to 0
Am I missing something about SPI in general, or is there something about Omega's implementation? Adafruit's implementation for SPI doesn't contain any writeByte() equivalent, only a write(), so I can't really compare the way the bits are assigned...
-
RE: Can't get WS2801 (SPI rgb leds strip) to work with Omega2
I saw a comment from Onion saying there was no hardware SPI available. But it was about first version of the omega, maybe V2 has one now.
I used Pin6 as clock and pin18 as MOSI as it's what was described in the official help, but there is no specification there about it being hardware or software. Something I don't really understand, is why in the examples and in the questions in the forum, everyone connects to bus #0, device #1 while my strip is mounted as bus #1, device #32766. And I'm not sure this is relevant at all...
Also, the link to documentation provided in a previous question is no longer available (at least to me). I get a "Forbidden. This wiki is set to no-edit mode. " error.
-
RE: Can't get WS2801 (SPI rgb leds strip) to work with Omega2
@Chris-Stratton Thanks for your answer.
I didn't know these pins were for software SPI. The leds strip is the only thing plugged on the system, so I'm willing to use whatever SPI is the simplest.
How should I plug everything to use hardware SPI (which might be easier or require less configuration to use)?
By the way, I don't have a scope around, so I'm not able to answer your questions...
Thanks for your answers !
-
Can't get WS2801 (SPI rgb leds strip) to work with Omega2
Hello!
For a project, I'd like to replace my working Raspberry PI Zero with my brand new Omega 2 (mounted on an Arduino Shield).
The purpose is to drive a short led strip using the Omega's SPI interface, with a level shifter in between to have the 3V3 logic levelled up to 5V.Small schematics :
Omega2 Level shifter Level shifter Led strip high side low side 5V VCC VCC 3V3 VCC GND GND GND GND pin6 io1 io1 SCK pin18 io2 io2 SI
This exact setup works with the raspberry pi (PI -> Level shifter -> Led Strip), so I know for a fact that the level shifter and led strip work fine.
But with the Omega2, I can't get the system to command the lights. I tried modifying Adafruit's WS2801python library to use OnionSpi lib instead of theirs, but with no success.Eventually, I tried a more basic approach using the command line, just to try to switch on/off the first led like this :
spi-tool -b 1 -d 32766 --frequency 1000000 setup > SPI device already available > Initializing SPI parameters... > Set SPI mode: 0x500 > Set bits per word: 0 > Set max speed: 1000000 Hz (1000 KHz) > SPI Write to addr 0x00: 0x66 root@Omega-A24B:/www/ws2801# spi-tool -b 1 -d 32766 --mosi 18 --sck 6 --frequen cy 1000000 write 0x00 0x66 > SPI Write to addr 0x00: 0x66 root@Omega-A24B:/www/ws2801# spi-tool -b 1 -d 32766 --mosi 18 --sck 6 --frequen cy 1000000 write 0x01 0x66 > SPI Write to addr 0x01: 0x66 root@Omega-A24B:/www/ws2801# spi-tool -b 1 -d 32766 --mosi 18 --sck 6 --frequen cy 1000000 write 0x02 0x66 > SPI Write to addr 0x02: 0x66
... but nothing happens! (I got the 1MHz from Adafruit's lib).
Any idea on why that wouldn't work?
Side note :
Both of my Omega2 are making high pitch noises when powered, I don't know if it's normal or if they have a problem (I might be wrong, but I don't think it comes from the Arduino Shield).