It’s Christmas and so flashing lights are everywhere; including connected to my GHI Spider in the form of a NeoPixel ring. They work pretty well from SPI2, and although I’m not 100% sure the timing is perfect (I see the occasional random LED) it’s not bad for less than an hours work.
However, I want to drive it from a Cerberus (well actually from a home-grown board based on the Cerberus) but I get an AurgumentException if I try and use SPI2 and no output at all (but at least it runs) if I change to SPI1. Neither an actual Cerberus or my clone will drive the NeoPixel ring using the code from here:
https://www.ghielectronics.com/community/codeshare/entry/649
But my Spider does. I’m also pretty sure that I am not using the Ethernet firmware on my Cerberus and there is nothing else declared that is using SPI.
I have read through this post (linked from the CodeShare) but can’t get anything from my Cerberus.
https://www.ghielectronics.com/community/forum/topic?id=10710&page=1
Here’s the code that generates the exception
public WS2811Led(int striplength, SPI.SPI_module SPImodule = SPI.SPI_module.SPI1, WS2811Speed speed = WS2811Speed.S800KHZ, double linearizationfactor=2.25)
{
_StripLength = striplength;
_StripLightNb = striplength * 3; //For later speed optimizations
_StripBufferLen = striplength * 12; //For later speed optimizations
// Initialize SPI
_WS2811SPIConfig = new SPI.Configuration(STM32.Pin.GPIO_NONE, false, 0, 0, false, true, (uint)speed, SPImodule);
try
{
_WS2811SPI = new SPI(_WS2811SPIConfig);
}
catch(System.ArgumentException ex1)
{
Debug.Print(ex1.Message);
throw;
}
catch (Exception ex)
{
Debug.Print(ex.Message);
throw;
}
// SPI Transmit buffer = 4 output byte per color, 3 colors per light
_WS2811Buffer = new byte[4 * 3 * striplength];
// Compute fast byte to SPI lookup table. By default the linearisation of human perceived luminosity is on (Weber-Fechner law)
_WS2811Table = new byte[1024];
BuildTable(linearizationfactor);
//Clear all leds
Clear();
Transmit();
}
when I call this line
// Initialize the strip : here using SPI2 and 800Khz model and using the linear human perceived luminosity PWM conversion factor of 2.25
MyWS2811Strip = new WS2811Led(NumberOfLeds, SPI.SPI_module.SPI2, WS2811Led.WS2811Speed.S800KHZ, 2.25);
from my main subroutine.
Does anyone have any clues or suggestions?