Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 4 months ago.
Newbie question about nRF51822 and ST LED Driver
I am trying to get my custom board programmed and I am once again over my head - which doesn't take much at all.
I have a Nordic nRF51822 mbed board successfully connected to a custom board with four STP16CPC26 LED drivers mounted. Everything is physically working now because a friend of mine wrote a shift register routine (in hex!) and I see all of the LEDs are working as they should.
I'm trying to change this to use SPI and the mbed book has sample code showing how to code to MOSI, MISO, and SCLK. However the ST datasheet lists out LE and OE (active low). The STP16CPC26 does not have a chip select (CS) pin. The same friend explained the concept of output and latch enable, but I don't know how to convert the code in the book to what I need.
This is surely an embarrassingly bad question to be asking, but is there anyone out there who can help with this?
Thank you.
1 Answer
10 years, 4 months ago.
The STP16CPC26 can be connected using SPI as follows: -MOSI to SDI -SCLK to CLK -CS to LE The OE pin can be connected to ground for starters. Later you may want to connect it to a PWM output when you intend to vary the brightness. The STP16CPC26 devices needs 16 bits of data. You can configure the SPI port for the 8 bits format and send two sequential packets. Some mbed also support the 16 bit format, but not all do. CS needs to be at low level before you start sending data, set it to high level again when you are done sending and want to activate the new data.