2025-06-18 10:09 AM
My apologies if this is the wrong ST forum... it seemed like the closest one to the part I'm using.
I have a new STM32F072 board design that has a STP16CPC26 LED driver connected to one of SPI busses. I just could not get the chip to do anything using the SPI bus, so I switched to a dirt-simple bit-banged (temporary, throw-away) driver so that I could easily change any aspect of the timing to make the chip work. Same problem... no matter what I do none of the outputs ever turn on and the SDO output stays low all the time. I've used a DMM to ensure it's properly connected to power and ground and that the supply voltage is okay (it's at 3.3V). I've had 3 other embedded developers look at the scope traces of the SDI, CLK, LE and OE- signals and they all agree that the timing and sequencing matches what the datasheet says you have to do to make the part work, but... it acts like it's dead. I've tried 5 different boards, and none of the outputs on any of them ever change state. I've also verified that the rise time of the SCLK signal is okay. Here's the bit-banged driver code. Can anyone suggest me to anything to do differently to make the part work? Does anyone know if there are any counterfeit STP16CPC26 chips in the supply chain? Any help would be appreciated.
void delay() {
systick timer = TimerGet();
while (TimerElapsed(timer) < 1)
;
}
void LEDs() {
static uint32_t value = 0x55555555;
delay();
OUT_EN = 1;
delay();
LATCH_EN = 0;
delay();
for(int i = 0; i < 16; i++) {
delay();
SPI_LED_MOSI = (value & BIT(i)) ? 1 : 0;
delay();
SPI_LED_SCLK = 1;
delay();
SPI_LED_SCLK = 0;
}
LATCH_EN = 1;
delay();
LATCH_EN = 0;
delay();
OUT_EN = 0;
delay();
value ^= 0xFFFFFFFF;
}
2025-06-18 11:46 AM
Additional info... we have a1K ohm resistor from the R-EXT pin to ground, which should give about 20 mA on each output. Also, I mis-spoke when I said the supply voltage was 3.3V. It's not, it's 5V. We have a little test board with banks of blue LEDs with anodes connected to 5V through 175 ohm resistors, and cathodes connected to the LED driver outputs.
The biggest mystery to me though is why there's no activity on the SDO output no matter what we shift in on the SDI pin. Surely it has to be coder error, but I just can't see anything wrong with the signals applied to the LED driver.
2025-06-18 11:47 AM
#ifndef BIT
#define BIT(n) (1U<<(n))
#endif
2025-06-18 11:58 AM
Also... the LEDs function is only called twice per second, which should be plenty of time to see the LEDs turning on and off. I can change the initial value of the "value" variable to 0 or 0xFFFFFFFF and comment out line 28 so it never changes, but that has no effect on my symptoms.