Breathing white again

Could you help, what is wrong with this code?
It sometimes works fine, sometimes is stucking in breathing white

Why?

#include "application.h"

#define OLED_Address 0x3c
#define OLED_Command_Mode 0x80
#define OLED_Data_Mode 0x40

void setup()
{
  Wire.begin();


}

void sendData(unsigned char data)
{
    Wire.beginTransmission(OLED_Address);      // **** Start I2C
    Wire.write(OLED_Data_Mode);             // **** Set OLED Data mode
    Wire.write(data);
    Wire.endTransmission();                     // **** End I2C
}

void sendCommand(unsigned char command)
{
    Wire.beginTransmission(OLED_Address);      // **** Start I2C
    Wire.write(OLED_Command_Mode);              // **** Set OLED Command mode
    Wire.write(command);
    Wire.endTransmission();                      // **** End I2C
      delay(10);
}

void send_string(const char *String)
{
    unsigned char i=0;
    while(String[i])
    {
        sendData(String[i]);      // *** Show String to OLED
        i++;
    }
}
bool lcdActive = false;

void initLCD() {
 // *** I2C initial *** //
   delay(100);
   sendCommand(0x2A);    // **** Set "RE"=1    00101010B
   sendCommand(0x71);
   sendCommand(0x5C);
   sendCommand(0x28);

   sendCommand(0x08);    // **** Set Sleep Mode On
   sendCommand(0x2A);    // **** Set "RE"=1    00101010B
   sendCommand(0x79);    // **** Set "SD"=1    01111001B

   sendCommand(0xD5);
   sendCommand(0x70);
   sendCommand(0x78);    // **** Set "SD"=0

   sendCommand(0x08);    // **** Set 5-dot, 3 or 4 line(0x09), 1 or 2 line(0x08)

   sendCommand(0x06);    // **** Set Com31-->Com0  Seg0-->Seg99

   // **** Set OLED Characterization *** //
   sendCommand(0x2A);      // **** Set "RE"=1
   sendCommand(0x79);      // **** Set "SD"=1

   // **** CGROM/CGRAM Management *** //
   sendCommand(0x72);      // **** Set ROM
   sendCommand(0x00);      // **** Set ROM A and 8 CGRAM

   sendCommand(0xDA);     // **** Set Seg Pins HW Config
   sendCommand(0x10);

   sendCommand(0x81);      // **** Set Contrast
   sendCommand(0xFF);

   sendCommand(0xDB);      // **** Set VCOM deselect level
   sendCommand(0x30);      // **** VCC x 0.83

   sendCommand(0xDC);      // **** Set gpio - turn EN for 15V generator on.
   sendCommand(0x03);

   sendCommand(0x78);      // **** Exiting Set OLED Characterization
   sendCommand(0x28);
   sendCommand(0x2A);
   //sendCommand(0x05);     // **** Set Entry Mode
   sendCommand(0x06);     // **** Set Entry Mode
   sendCommand(0x08);
   sendCommand(0x28);     // **** Set "IS"=0 , "RE" =0 //28
   sendCommand(0x01);
   sendCommand(0x80);     // **** Set DDRAM Address to 0x80 (line 1 start)

   delay(100);
   sendCommand(0x0C);      // **** Turn on Display

}

void loop()
{

 if(!lcdActive) {
   initLCD();
   lcdActive = true;
 }

 // ********************************************************************//
 // **** Show Data Value *** //
 
 send_string("0123456789ABCDEF");
 sendCommand(0xC0);      // **** New Line
 send_string("Русский?");
 //sendCommand(0x01);    // **** Clear display


 // **** Show Data Value *** //
 // ********************************************************************//

}

@ryotsuke,

I have loaded your code to a core of mine and looking to see if there’s any issues.

Don’t have the device you are interfacing to so the results might differ.

Anyhow, did you try on a separate core? :wink:

@ryotsuke,

I have not seen any breathing white issue yet. Are you able to tell under what condition does it happen?

Also, does it work OK after a reset? :slight_smile:

I’ve tried different core and it works flawlessly
Meaning first one is faulty? It works sometimes

It might be some issue with the core so my advice would be to switch over to another core for your project :wink:

It looks like a voltage regulator heats up much more on faultly board. It gets pretty hot in like ~30 seconds from start

Mine is ok. Just touched it to be sure.

Hmm…There’s a couple of people who had this similar issue. Would be great if you can swap out the regulator and test again!

Yes, other core temperature is OK. I don’t have enough skills to replace regulator and don’t make ugly mess :smiley:
I’ve managed to do a firmware reset and ‘faulty’ works again. Still heavily heats up.

1 Like

I guess you should not continue to use it to prevent further damage… :wink:

Maybe you can email :spark: at hello@spark.io and see if they can do anything for you.

Have fun!

1 Like