3
\$\begingroup\$

I am struggling with reading the datasheet for the STLED316S 7-segment/Discrete LED driver IC.

I'm writing code for an STM32 chip, but also using Arduinos as well. I'm having no problems writing the code, but really struggling with interpreting the datasheet (apparently so are a number of other people according to a google search) to send the correct bits across the SPI interface.

Basically all I want to do is set the display to on, and then write in the value to the segments but I just don't really know where to start - is the data meant to be sent over one byte at a time, or strings of bytes? I'm not using the key interrupt at the moment, so fortunately that doesn't complicate too much.

The datasheet can be found here.

Any insight into this would be much appreciated.


Edit:

I think I may have made a little headway, but still don't think its correct.

Right, I think, although I could be horribly wrong, that I have it. No thanks to the datasheet, but fortunately another similar chip from ST (here) had a slightly better one with an example!

Okay, so:

  • STB LOW
  • Turn on display 00001101
  • STB HIGH
  • STB LOW
  • Configure 7-segment display 00100000
  • Set configuration 011111101 (Brightness 14/16, constant brightness, 6 digits in display)
  • STB HIGH
  • STB LOW
  • Define address 00100000 (LED 2/7)
  • Write bytes to turn on segments 11111110 (writes 8, no DP)
  • Write byte to turn on segments of LED 3/7 11111110
  • STB HIGH

I think it's what the datasheet is trying to say? The last 2 bytes go against what the datasheet says, but I don't really see any other way to write it... I think the rest is correct though.

\$\endgroup\$
  • \$\begingroup\$ It's not a SPI interface, wou will probably need bit-banging \$\endgroup\$ – clabacchio Mar 26 '12 at 20:45
  • \$\begingroup\$ Its a 3-wire SPI with a bidirectional SISO wire instead of MOSI/MISO wires, but its not really the communication protocol thats the problem, its the bits that are transferred across, ie. the addresses etc. \$\endgroup\$ – PatchedUp Mar 26 '12 at 20:55
  • \$\begingroup\$ OMG, this is a confusing and poorly written datasheet. \$\endgroup\$ – Rocketmagnet Mar 26 '12 at 22:36
  • \$\begingroup\$ This is probably not the answer you want, but, if there's any way you can choose a different LED driver at this stage of the project, it might be a good idea. \$\endgroup\$ – Rocketmagnet Mar 26 '12 at 22:41
  • \$\begingroup\$ Also, have you tried communicating with the chip and discovered that it doesn't work? Or are you totally unsure where to start? \$\endgroup\$ – Rocketmagnet Mar 26 '12 at 22:43
2
\$\begingroup\$

My guess would be this:

To switch the display on:

  • STB goes low
  • Clock in the byte 00001101 (0x0D)
  • STB goes high

To write the segments:

  • STB goes low
  • clock in the Write command: 00000000 (8 bits of zeros). This means: it's a write command, with auto-incrementing addresses, writing to address 0x00 on page 0x00.
  • Now you can clock in the data to fill the memory. This consists of six bytes, one for each digit.
  • STB goes high

To clock data (make sure the clock is slower than 1MHz):

  • STB goes low
  • Loop for 8 bits of the byte
    • Set data out bit
    • Clock goes low
    • Clock goes high
  • End of Loop
  • STB goes high
\$\endgroup\$
  • \$\begingroup\$ Thanks, I had a feeling that was the way to start but wasn't 100% sure, now just the clocking the data I don't understand! \$\endgroup\$ – PatchedUp Mar 27 '12 at 1:43
  • \$\begingroup\$ The clocking diagram is on page 26. I'll add something about it to my answer. \$\endgroup\$ – Rocketmagnet Mar 27 '12 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.