EmbDev.net

Forum: µC & Digital Electronics Need help running SSD1322 with ER-OLEDM032-1 OLED


von Alex Lynchosky (Guest)


Rate this post
useful
not useful
Here is the code I am using to initialize the OLED, per the instructions 
in the data sheet. I am using the 3-wire SPI configuration, and I have 
set BS0 and BS1 correctly.

For reference, here is the exact OLED I bought:

http://www.buydisplay.com/default/graphic-oled-display-module-3-2-inch.html

And here is my code:

void Initial(void) {
    PINRESETHIGH;
    timer_delay(5); /* in miliseconds */
    PINRESETLOW;
    timer_delay(20);
    PINRESETHIGH;
    timer_delay(5);

    Write_Command(0xA6); /* All off or normal, Data sheet is inconsitent 
*/


    Write_Command(0xFD); /*SET COMMAND LOCK*/
    Write_Data(0x12); /* UNLOCK */
    Write_Command(0xAE); /*DISPLAY OFF*/
    Write_Command(0xB3); /*DISPLAYDIVIDE CLOCKRADIO/OSCILLATAR 
FREQUANCY*/
    Write_Data(0x91);
    Write_Command(0xCA); /*multiplex ratio*/
    Write_Data(0x3F); /*duty = 1/64*/
    Write_Command(0xA2); /*set offset*/
    Write_Data(0x00);
    Write_Command(0xA1); /*start line*/
    Write_Data(0x00);
    Write_Command(0xA0); /*set remap*/
    Write_Data(0x14);
    Write_Data(0x11);
    Write_Command(0xB5); /* Set GPIO */
    Write_Command(0x00);
    Write_Command(0xAB); /* Funtion selection */
    Write_Data(0x01); /* Selection external vdd */
    Write_Command(0xB4); /* Enable External VSL */
    Write_Data(0xA0);
    Write_Data(0xFD);
    Write_Command(0xC1); /* Set contrast current */
    Write_Data(Contrast_level);
    Write_Command(0xC7); /* Master contrast current control*/
    Write_Data(0x0F);
    Write_Command(0xB9); /* Select default linear grey scale table */
    Write_Command(0xB1); /* SET PHASE LENGTH */
    Write_Data(0xE2);
    Write_Command(0xD1); /*Enhance driving scheme capability*/
    Write_Data(0x82);
    Write_Data(0x20);
    Write_Command(0xBB); /*SET PRE-CHANGE VOLTAGE*/
    Write_Data(0x1F);
    Write_Command(0xB6); /*SET SECOND PRE-CHARGE PERIOD*/
    Write_Data(0x08);
    Write_Command(0xBE); /* SET VCOMH */
    Write_Data(0x07);
    Write_Command(0xA4); /* normal display or all off, not sure which */
    Clear_Ram();
    timer_delay(200);
    Write_Command(0xAF); /*display ON*/
    return;
}

void Write_Command(unsigned char cmd) {
    uint16_t new_cmd = 0x0000; /* 9th bit = 0 for sending command */
    new_cmd |= cmd;
    sendMessageSPI2(new_cmd);
    return;
}


void Write_Data(unsigned char dat) {
    uint16_t new_data = 0x0100; /* 9th bit = 1 for sending data */
    new_data |= dat;
    sendMessageSPI2(new_data);
    return;
}



void main(void) {
    BOARD_Init(); /* Init code for my personal board */
    INITPIN29; /* Initialize the reset pin */
    Gui_Init(); /* Initializes SPI, Timers, and empty arrays */
    Write_Command(0xA6); //--all Display off
    Initial();
    while (1) {
        printf("ON!\n");
        Write_Command(0xA5); //--all display on
        timer_delay(5000);
        printf("OFF!\n");
        Write_Command(0xA6); //--all Display off
        timer_delay(5000);
    }
}


NOTE:

The OLED will not even turn on, not once. No screen flicker, nothing. I 
have triple checked everything on the hardware side over and over again, 
so I am convinced that it is software. Any help would be appreciated.

Thanks!

:
von Frank M. (frank_m35)


Rate this post
useful
not useful
I'm familiar with this display and currently use it in an active 
project, but I use the parallel interface and never tried the serial 
mode.

Thus I can't give you some exact suggestions, however,

have you tried a different simpler SPI device, like an EEPROM to check 
if your SPI Bus works at all?

Have you tried the simpler looking 4-wire SPI mode which sends 8-bits, 
thus 1 byte, instead of the 3-wire SPI mode which sends 9-bits, a mode 
few microcontrollers support natively. Additionaly you do send a full 
WORD, 16-bits instead of just 9 bits (do you have 16-bit mode activated 
in the SPI-hardware at all?), in which you changed the 9th bit. I'm not 
sure if this works. You probably have to implement it more accurately. 
This means either to implement 9-bit SPI in software by bit banging or 
sending an 9th bit manually and then falling back to the integrated 
SPI-hardware. All in all, the 9-bit mode is difficult (just do a google 
search) and I highly suggest to use either the 4-wire SPI mode, or, if 
you also want to read from the display (depending on how much RAM your 
microncontroller has, you probably don't want to waste too much RAM for 
a display buffer) use the parallel mode.

If you're using a PIC24 I can provide a working display driver which 
uses the parallel mode.

von Alex Lynchosky (Guest)


Rate this post
useful
not useful
Thank you very much for the quick reply.

I do not know how to check to see if the SPI bus is working on the OLED. 
I do, however, know that I have a working 16 bit SPI working on my 
pic32. Right now I am just sending over 16 bits at a time, and hoping 
that the OLED shift register will chop off the higher order bits, like 
so:

SPI message = 0x01FF
OLED shift register gets 0x1FF (9 bits)

If this logic if clearly wrong, please let me know.

Also how would I use the parallel mode with the pic32? I have not been 
able to find any helpful code on this. The OLED I bought comes with an 
integrated pcb, so i'm not sure if this makes a difference.

I would really appreciate the code you have working for the pic24.

Thank you again for your help!

von Frank M. (frank_m35)


Rate this post
useful
not useful
A short web search also brought up the idea of hoping that the LCD chops 
of not needed bits. But no one wrote if it really worked.

So I still suggest you just try the 4-wire SPI mode. It shouldn't be 
that much work (just one additional wire) and a minor code change 
(implementing the D/C# pin). The wiring and jumper settings on the PCB 
are nicely illustrated on the accompanying PDF: 
http://www.buydisplay.com/download/interfacing/ER-OLEDM032-1_Interfacing.pdf
The PIC most probably has two or three SPI devices integrated, so you're 
free to use a second one exclusively for the display in 8-bit mode, so 
you can keep the 16-bit mode SPI for other devices in 16-bit mode.

The PIC microcontrollers have a Parallel Master Port (PMP), which you 
can (and should) use for the parallel mode.
Here's the code for the SSD1322:
http://www.microchip.com/forums/fb.ashx?m=752326
a few posts above is the driver for the SSD1325 in case you also use 
different displays.

The PIC32 might have enough RAM to use an extra internal display buffer 
without problems. The mentioned code however does not use a buffer and 
only uses the display RAM, making things a bit slower and drawing 
operations a bit more complicated, because of the odd pixel adressing. 
(one has to update 4 pixels in one rush always)

The PCB just seems to contain all necessary capacitors, diodes and most 
importantly the Step-Up converter to create the necessary 12V, all this 
in an easy to handle package, no need for ZIF-connectors. I only use the 
naked display (without display), but I doubt that there's any other 
difference.

von JIMMY J. (jimmy_sayavong)


Rate this post
useful
not useful
Alex Lynchosky,

Have you been able to solve the issue?
I have the same problem. I just went line-by-line on initialization 
instruction according to the datasheet and I still have nothing
on the display !!  I am very interesting to know if your issue is 
solved.

Thanks,


JIMMY

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.