DotStar w/ Shield Shield Not Working


#1

Problem

I have the Shield Shield and I am trying to drive the DotStar LED Strip via hardware SPI. Circuit works great with a normal Arduino but it does not work with the shield. Tried the software SPI too with shield pins 4 and 7 as clk and data with the photons pin 3 and 4 translating to that. Also tried slowing down the hardware spi to the system clock divided by 16. Using the DotStar here:

I saw on the forums about the Shield having an oscillation issue. Any way to get around this?


#2

You might want to consider driving it directly using the Photon and bypass the Shield Shield if that’s used only to drive the LED strip :wink:


#3

Like the library read me says, moving to a simpler and better level shifter like the 74HCT125 (around a $1.50 at Adafruit) will fix the problem.


#4

Thanks for the suggestions.

I tried the skipping the shield and just use 3.3V didn’t work. Will try out the different level shifter even if it means I have to make a separate PCB.


#5

I tried it with this level-shifter: https://www.adafruit.com/product/1787

All I got was weird colors. Had the Clock and Data going from A3 and A5 to 1A and 2A on the level shifter. Then from 1Y and 2Y to the strip. All the OE for 1 and 2 on the level shifter were pulled low. Just trying to use the basic strandtest and I edited the definition of the strip to just show the number of pixels to use hardware SPI.


#6

Two things to double check:

  • The level shift Vcc (pin 14) is connected to +5V
  • The Data on Photon A5 and Clock on Photon A3 are connected to the right pins on the DotStar.

#7

Just checked it with the Spark Core and it worked. Photon not working. I’m assuming it’s in the dotstar.cpp edits I made to get the Pin Map to compile. I have the following lines from the library which don’t compile with the photon:

// fast pin access
#define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
#define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
#define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))

#8

Hi @sdmichelini

Those are “fast” pin setting macros for the processor on the Core. Photon is different.

I don’t think you should need fast pin modes with hardware SPI but just for testing, try this:

#define pinLO(_pin) (digitalWrite(_pin,LOW))
#define pinHI(_pin) (digitalWrite(_pin,HIGH))
#define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))

#9

I agree with @bko (since he answered while I typed this up :wink: ), but another short term solution is to change these macros like this

STM32_Pin_Info* PIN_MAP2 = HAL_Pin_Map();

#define pinLO(_pin) (PIN_MAP2[_pin].gpio_peripheral->BSRRH = PIN_MAP2[_pin].gpio_pin)
#define pinHI(_pin) (PIN_MAP2[_pin].gpio_peripheral->BSRRL = PIN_MAP2[_pin].gpio_pin)
#define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))

But these will be superceded soon by new functions pinResetFast(), pinSetFast() and digitalWriteFast().


Some background read if you’re interested
Photon and the PIN_MAP[] challenge!
Libraries to Update for the Photon


#10

Tried the digitalWrite. Didn’t get it to work. On a side note the Photon started having only the blue light go on.