adafruit / Adafruit_DotStar

GNU General Public License v3.0
97 stars 58 forks source link

DotStar SPI incompatibility with nrf52840 (Nano 33 BLE and BLE Sense) #41

Closed LitterBugs closed 3 years ago

LitterBugs commented 3 years ago

There are SPI compatibility problems with the Adafruit_DotStar library for some of the newer Ardrino boards. Was hoping to take advantage of the much higher clock speed (64Mhz) of the newer board for doing high speed refresh of DotStar strips over SPI for POV applications.

1) Install AdafruitDotStar library. 2) Modified NUMPIXELS from 30 to 60 3) commented out **// Adafruit_DotStar strip(NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTARBRG); 4) uncommented _Adafruit_DotStar strip(NUMPIXELS, DOTSTARBRG);** 5) Tried to compile/upload to a new Nano 33 BLE board. Recieved several errors shown below:

`Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano 33 BLE" C:\Users\karl\Documents\Arduino\libraries\Adafruit_DotStar\Adafruit_DotStar.cpp: In member function 'void Adafruit_DotStar::hw_spi_init()':

C:\Users\karl\Documents\Arduino\libraries\Adafruit_DotStar\Adafruit_DotStar.cpp:189:7: error: 'class arduino::MbedSPI' has no member named 'setClockDivider'

SPI.setClockDivider((F_CPU + 4000000L) / 8000000L); // 8-ish MHz on Due ^~~~~~~

C:\Users\karl\Documents\Arduino\libraries\Adafruit_DotStar\Adafruit_DotStar.cpp:189:24: error: 'F_CPU' was not declared in this scope

SPI.setClockDivider((F_CPU + 4000000L) / 8000000L); // 8-ish MHz on Due ^~~~~

C:\Users\karl\Documents\Arduino\libraries\Adafruit_DotStar\Adafruit_DotStar.cpp:189:24: note: suggested alternative: 'FPU'

SPI.setClockDivider((F_CPU + 4000000L) / 8000000L); // 8-ish MHz on Due ^~~~~ FPU

C:\Users\karl\Documents\Arduino\libraries\Adafruit_DotStar\Adafruit_DotStar.cpp:192:7: error: 'class arduino::MbedSPI' has no member named 'setBitOrder'

SPI.setBitOrder(MSBFIRST); ^~~

C:\Users\karl\Documents\Arduino\libraries\Adafruit_DotStar\Adafruit_DotStar.cpp:193:7: error: 'class arduino::MbedSPI' has no member named 'setDataMode'

SPI.setDataMode(SPI_MODE0); ^~~

exit status 1 Error compiling for board Arduino Nano 33 BLE. `

ladyada commented 3 years ago

yah this library is old enough it uses the original SPI interface. sounds like arduino did not backport that library interface. the right answer to solving the issue is to 'port' this library over to Adafruit_BusIO which has a x-platform SPI interface, we dont have an ETA on when we'll get to that (we have a lot of other work and we dont sell/stock/own the ble sense or nano 33!)

LitterBugs commented 3 years ago

Yeah, I am going to try using the FastLED library. I've also got one of the crazy fast Teensy 4.1 boards that can do 3 SPI busses. Pretty sure this library is beyond the scope of that too. ;)

LitterBugs commented 3 years ago

Looks like FastLED is the way to go. Support for all sorts of LEDs, Platforms, etc... VERY robust. Check out the documenation: https://github.com/FastLED/FastLED/wiki

ladyada commented 3 years ago

great!