Alternative Row are missing in SSD1309

Thread Starter

Dragonoid

Joined Nov 27, 2017
55
I have set up a Library to drive SSD 1309 with TMS320F Series MCU but I am getting a Missing Row.
C:
void SPI_sendCommand(Uint16 command)
  {
    Uint16 volatile dummy = 0;
   LCD_CS_LO;
   LCD_DC_LO;

   while (SpiaRegs.SPISTS.bit.BUFFULL_FLAG != 0){}  // Wait until TX buffer is not full
   SpiaRegs.SPITXBUF = command<<8; // Master transmits data
   while(SpiaRegs.SPISTS.bit.INT_FLAG ==0) {} // Wait until data received
   dummy = SpiaRegs.SPIRXBUF; // dummy read to clear INT flag

   LCD_CS_HI;
   LCD_DC_HI;
  }

//----------------------------------------------------------------------------
void SPI_sendData(Uint16 data)
  {
    Uint16 volatile dummy = 0;

  // Select the LCD controller
  LCD_CS_LO;
  LCD_DC_HI;


  //while (SpiaRegs.SPISTS.bit.BUFFULL_FLAG != 0){}  // Wait until TX buffer is not full
  SpiaRegs.SPITXBUF = data<<8; // Master transmits data
  while(SpiaRegs.SPISTS.bit.INT_FLAG ==0) {} // Wait until data received
  dummy = SpiaRegs.SPIRXBUF; // dummy read to clear INT flag
  dummy = SpiaRegs.SPIRXBUF; // dummy read to clear INT flag
// LCD_CS_HI;
  LCD_DC_LO;
  }
SPI Initialize With * bit Mode
Code:
spi_init()
{
    SpiaRegs.SPIPRI.bit.TRIWIRE =1;//3-wire Mode
    SpiaRegs.SPICCR.bit.SPICHAR = 7; // 16-bit char bits
    SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;
    SpiaRegs.SPICTL.bit.CLK_PHASE = 1;
    SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
    SpiaRegs.SPICTL.bit.TALK = 1; // Enable master mode, normal phase,
    // enable talk, and SPI int disabled.

    SpiaRegs.SPIBRR = 0x0007; // 15 -> 1Mbps
    SpiaRegs.SPICCR.bit.SPISWRESET = 1; // Relinquish SPI from Reset
    SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission
    cmd_AddressingMode(1);
  /*  // Initialize SPI FIFO registers
    SpiaRegs.SPIFFTX.all=0xE040;
    SpiaRegs.SPIFFRX.all=0x2044;
    SpiaRegs.SPIFFCT.all=0x0;*/

}
C:
spi_init()
{
    SpiaRegs.SPIPRI.bit.TRIWIRE =1;//3-wire Mode
    SpiaRegs.SPICCR.bit.SPICHAR = 7; // 16-bit char bits
    SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;
    SpiaRegs.SPICTL.bit.CLK_PHASE = 1;
    SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
    SpiaRegs.SPICTL.bit.TALK = 1; // Enable master mode, normal phase,
    // enable talk, and SPI int disabled.

    SpiaRegs.SPIBRR = 0x0007; // 15 -> 1Mbps
    SpiaRegs.SPICCR.bit.SPISWRESET = 1; // Relinquish SPI from Reset
    SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission
    cmd_AddressingMode(1);
  /*  // Initialize SPI FIFO registers
    SpiaRegs.SPIFFTX.all=0xE040;
    SpiaRegs.SPIFFRX.all=0x2044;
    SpiaRegs.SPIFFCT.all=0x0;*/

}
C:
void showPic(const Uint8 *pic, Uint8 startPage, Uint8 endPage, Uint8 startCol, Uint8 totalCol)
{
    Uint8 i,j;

    for(i=startPage;i<=endPage;i++)
    {
        cmd_PageStartAddress(i);
        cmd_ColumnStartAddress(startCol);

        for(j=0;j<totalCol;j++)
        {
            SPI_sendData(pgm_read_byte(pic+i*totalCol+j));
        }
    }
}
void oledInit()
{
    LCD_RST_HI;
    msdelay( 1000 );
    LCD_RST_LO;
    msdelay( 10000 );
    LCD_RST_HI;

    SPI_sendCommand( OLED_DISPLAYOFF );
    msdelay( 100 );
    SPI_sendCommand( OLED_SETDISPLAYCLOCKDIV );
    SPI_sendCommand( 0x80 );   // the suggested ratio 0x80
    msdelay( 100 );
    SPI_sendCommand( OLED_SETMULTIPLEX );
    SPI_sendCommand( 0x1F );
    msdelay( 100 );
    SPI_sendCommand( OLED_SETDISPLAYOFFSET );
    SPI_sendCommand( 0x0 );   // no offset
    msdelay( 100 );
    SPI_sendCommand(OLED_SETSTARTLINE | 0x0); // line #0
    msdelay( 100 );
    SPI_sendCommand( OLED_CHARGEPUMP );
    SPI_sendCommand( 0xAF );
    msdelay( 100 );
    SPI_sendCommand( OLED_MEMORYMODE );
    SPI_sendCommand( 0x0 );  // 0x0 act like ks0108
    msdelay( 100 );
                 // 0x0 act like ks0108
    SPI_sendCommand(OLED_SEGREMAP | 0x1);
    SPI_sendCommand(OLED_COMSCANDEC);
    SPI_sendCommand(OLED_SETCOMPINS);         // 0xDA
    SPI_sendCommand(0x02);
    SPI_sendCommand(OLED_SETCONTRAST);        // 0x81
    SPI_sendCommand(0x8F);
    SPI_sendCommand(OLED_SETPRECHARGE);       // 0xd9
    SPI_sendCommand(0xF1);
    SPI_sendCommand(OLED_SETVCOMDETECT);      // 0xDB
    SPI_sendCommand(0x40);
    SPI_sendCommand(OLED_DISPLAYALLON_RESUME);// 0xA4
    SPI_sendCommand(OLED_NORMALDISPLAY);      // 0xA6
    SPI_sendCommand(OLED_DISPLAYON);          //--turn on oled panel


}


void GPIO_INITIALIZE()
{
    EALLOW;
    GpioCtrlRegs.GPAPUD.bit.GPIO10 = 0;   // Enable pullup on GPIO8
    GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 0;  // GPIO8 = GPIO8
    GpioCtrlRegs.GPADIR.bit.GPIO10 = 1;

    GpioCtrlRegs.GPAPUD.bit.GPIO11 = 0;   // Enable pullup on GPIO8
    GpioCtrlRegs.GPAMUX1.bit.GPIO11 = 0;  // GPIO8 = GPIO8
    GpioCtrlRegs.GPADIR.bit.GPIO11 = 1;

    GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0;   // Enable pullup on GPIO8
    GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0;  // GPIO8 = GPIO8
    GpioCtrlRegs.GPADIR.bit.GPIO12 = 1;

    EDIS;
}
Code:
void putc(unsigned char aChar, Uint8 page, Uint8 startColumn)
{
    Uint8 i;

    if((aChar >= 0x20) && (aChar <= 0x7E))  // normal ASCII Char
    {
        aChar -= 0x20;                      // subtract to match index
    }
    else if (aChar >= 0xA0)                 // extended UTF8 char
    {
        aChar -= 0x41;                      // subtract to match index
    }
    else                                    // char not available
    {
        aChar = '?' - 0x20;                 // make a ?
    }

    cmd_PageStartAddress(page);
    cmd_ColumnStartAddress(startColumn);

    for(i=0;i<5;i++)
    {
        SPI_sendData(pgm_read_byte(&font[aChar][i]));
    }
    SPI_sendData(0);
}
Chali.jpeg
 
Last edited:
Top