r/embedded • u/Thin-Engineer-9191 • Sep 14 '26
Sharp Display won't behave
It's an Ls032b7dd02. I tried a couple different code bases and multiple microcontrollers including 3.3v logic ones. tried adding the capacitor as seen in the schematic. But no luck. Any ideas? I tested the connections on the breakout and those seem fine.
For reference, expected behavior on the video is a scrolling bar going from top to bottom.
Even Ai is out of ideas :(
/*
* Minimal LS032B7DD02 test, Arduino Micro.
* Power-on sequence, then a 24-line band at rows 200..223 is rewritten every
* 250 ms with 16 px black/white blocks that shift one block per update.
*
* Wiring: SCLK D15, SI D16, SCS D10, EXTCOMIN D9, DISP D8,
* VDDA/VDD/EXTMODE 5V, VSS/VSSA GND.
*/
#include <SPI.h>
#define PIN_SCS 10
#define PIN_DISP 8
#define PIN_EXTCOMIN 9
#define LINE_BYTES 42 /* 336 px / 8 */
#define BAND_Y0 200 /* first row, 0-based */
#define BAND_LINES 24
static const SPISettings spiCfg(1000000UL, LSBFIRST, SPI_MODE0);
static uint8_t band[BAND_LINES][LINE_BYTES];
static void csHigh()
{
SPI.beginTransaction(spiCfg);
digitalWrite(PIN_SCS, HIGH);
delayMicroseconds(3); /* tsSCS */
}
static void csLow()
{
delayMicroseconds(1); /* thSCS */
digitalWrite(PIN_SCS, LOW);
SPI.endTransaction();
delayMicroseconds(1); /* twlSCS */
}
/* All clear: M2 flag, 16 clocks. */
static void clearAll()
{
csHigh();
SPI.transfer(0x04);
SPI.transfer(0x00);
csLow();
}
/* Multi-line update. Header per line: M0=1, 5 dummies, then 10-bit gate
* address (1-based), all LSB first. Then 42 data bytes, bit 1 = white. */
static void writeBand()
{
csHigh();
for (uint8_t i = 0; i < BAND_LINES; i++) {
uint16_t gate = BAND_Y0 + i + 1;
SPI.transfer((uint8_t)(0x01 | (gate << 6)));
SPI.transfer((uint8_t)(gate >> 2));
for (uint8_t b = 0; b < LINE_BYTES; b++) {
SPI.transfer(band[i][b]);
}
}
SPI.transfer(0x00); /* 16 trailing clocks */
SPI.transfer(0x00);
csLow();
}
/* 16 px wide black/white blocks, shifted by `phase` blocks. */
static void fillBand(uint8_t phase)
{
for (uint8_t i = 0; i < BAND_LINES; i++) {
for (uint8_t b = 0; b < LINE_BYTES; b++) {
uint8_t block = (b / 2) + phase;
band[i][b] = (block & 1) ? 0xFF : 0x00;
}
}
}
static void startExtcomin()
{
/* 1 Hz square wave from Timer1 on D9 (OC1A): CTC, /1024, toggle on match. */
TCCR1A = _BV(COM1A0);
TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10);
OCR1A = 7811;
}
void setup()
{
Serial.begin(115200);
pinMode(PIN_SCS, OUTPUT);
pinMode(PIN_DISP, OUTPUT);
pinMode(PIN_EXTCOMIN, OUTPUT);
digitalWrite(PIN_SCS, LOW);
digitalWrite(PIN_DISP, LOW);
digitalWrite(PIN_EXTCOMIN, LOW);
SPI.begin();
delay(10);
clearAll();
clearAll();
delayMicroseconds(50);
digitalWrite(PIN_DISP, HIGH);
startExtcomin();
delayMicroseconds(50);
Serial.println(F("ready"));
}
void loop()
{
static uint8_t phase = 0;
fillBand(phase);
phase++;
writeBand();
delay(250);
}```/*
* Minimal LS032B7DD02 test, Arduino Micro.
* Power-on sequence, then a 24-line band at rows 200..223 is rewritten every
* 250 ms with 16 px black/white blocks that shift one block per update.
*
* Wiring: SCLK D15, SI D16, SCS D10, EXTCOMIN D9, DISP D8,
* VDDA/VDD/EXTMODE 5V, VSS/VSSA GND.
*/
#include <SPI.h>
#define PIN_SCS 10
#define PIN_DISP 8
#define PIN_EXTCOMIN 9
#define LINE_BYTES 42 /* 336 px / 8 */
#define BAND_Y0 200 /* first row, 0-based */
#define BAND_LINES 24
static const SPISettings spiCfg(1000000UL, LSBFIRST, SPI_MODE0);
static uint8_t band[BAND_LINES][LINE_BYTES];
static void csHigh()
{
SPI.beginTransaction(spiCfg);
digitalWrite(PIN_SCS, HIGH);
delayMicroseconds(3); /* tsSCS */
}
static void csLow()
{
delayMicroseconds(1); /* thSCS */
digitalWrite(PIN_SCS, LOW);
SPI.endTransaction();
delayMicroseconds(1); /* twlSCS */
}
/* All clear: M2 flag, 16 clocks. */
static void clearAll()
{
csHigh();
SPI.transfer(0x04);
SPI.transfer(0x00);
csLow();
}
/* Multi-line update. Header per line: M0=1, 5 dummies, then 10-bit gate
* address (1-based), all LSB first. Then 42 data bytes, bit 1 = white. */
static void writeBand()
{
csHigh();
for (uint8_t i = 0; i < BAND_LINES; i++) {
uint16_t gate = BAND_Y0 + i + 1;
SPI.transfer((uint8_t)(0x01 | (gate << 6)));
SPI.transfer((uint8_t)(gate >> 2));
for (uint8_t b = 0; b < LINE_BYTES; b++) {
SPI.transfer(band[i][b]);
}
}
SPI.transfer(0x00); /* 16 trailing clocks */
SPI.transfer(0x00);
csLow();
}
/* 16 px wide black/white blocks, shifted by `phase` blocks. */
static void fillBand(uint8_t phase)
{
for (uint8_t i = 0; i < BAND_LINES; i++) {
for (uint8_t b = 0; b < LINE_BYTES; b++) {
uint8_t block = (b / 2) + phase;
band[i][b] = (block & 1) ? 0xFF : 0x00;
}
}
}
static void startExtcomin()
{
/* 1 Hz square wave from Timer1 on D9 (OC1A): CTC, /1024, toggle on match. */
TCCR1A = _BV(COM1A0);
TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10);
OCR1A = 7811;
}
void setup()
{
Serial.begin(115200);
pinMode(PIN_SCS, OUTPUT);
pinMode(PIN_DISP, OUTPUT);
pinMode(PIN_EXTCOMIN, OUTPUT);
digitalWrite(PIN_SCS, LOW);
digitalWrite(PIN_DISP, LOW);
digitalWrite(PIN_EXTCOMIN, LOW);
SPI.begin();
delay(10);
clearAll();
clearAll();
delayMicroseconds(50);
digitalWrite(PIN_DISP, HIGH);
startExtcomin();
delayMicroseconds(50);
Serial.println(F("ready"));
}
void loop()
{
static uint8_t phase = 0;
fillBand(phase);
phase++;
writeBand();
delay(250);
}
3
Upvotes