Coder Social home page Coder Social logo

SH1106 SPI support about mpd_oled HOT 18 CLOSED

antiprism avatar antiprism commented on June 22, 2024
SH1106 SPI support

from mpd_oled.

Comments (18)

antiprism avatar antiprism commented on June 22, 2024 1

That is great. Well done for finding the problem!

I'll leave the issue open for reference.

from mpd_oled.

antiprism avatar antiprism commented on June 22, 2024

Hi

Thanks for the feedback. I have just reviewed the OLED library code, and it does not directly support SH1106 with SPI. If I have understood, you are running with "mpd_oled -o 6" and have modified oled_is_spi_proto to call the SPI setup for OLED_SH1106_I2C_128x64. However, it looks like ArduiPi_OLED::display(void) in ArduiPI_OLED.cpp will also need changes as it is calling fastI2Cwrite(buff, 17); for OLED_SH1106_I2C_128x64, which will be wrong for SPI.

Adrian.

from mpd_oled.

antiprism avatar antiprism commented on June 22, 2024

Also, but I think you probably reviewed this, some of the the SPI parameters cannot be set on the command line and have to be set in init_display() in display.cpp if the defaults need changing.

from mpd_oled.

naude-r avatar naude-r commented on June 22, 2024

hi,

thank you for the response. i did review the SPI parameters. there were all fine except for the default chip select value.

will review ArduiPi_OLED::display(void).

from mpd_oled.

naude-r avatar naude-r commented on June 22, 2024

have modified ArduiPi_OLED::display(void) as follows (when isSPI is true):

bcm2835_gpio_write(dc, HIGH);
if (oled_type == OLED_SH1106_SPI_128x64)
{
  fprintf(stdout, "is SSH1106 spi\n");
    for (uint8_t k=0; k<8; k++)
    {
      sendCommand(0xB0+k);//set page addressSSD_Data_Mode;
      sendCommand(0x02) ;//set lower column address
      sendCommand(0x10) ;//set higher column address
    }
}

// Send all data to OLED
for ( i=0; i<oled_buff_size; i++)
{
  fastSPIwrite(*p++);
}

still no joy. have to admit i have no idea what i am doing ;-)

from mpd_oled.

antiprism avatar antiprism commented on June 22, 2024

All I can suggest is that in the original code
sendCommand(0xB0+k);//set page addressSSD_Data_Mode;
was called eight times, with different values of k, each time followed by writing some data. The way you have it all the data is written at the end (outside the k loop).

from mpd_oled.

naude-r avatar naude-r commented on June 22, 2024

hi,

got the display to switch on and display something. unfortunately just random noise / snow.

had to upgrade to the latest bcm2835 (v1.58) to make it work. the current version, as on trunk, caused an endless loop in bcm2835_spi_transfer.

have you seen the random noise issue before? guess that something is still off in ArduiPi_OLED::display(void).

ArduiPi_OLED::display(void) has now been updated to mirror the i2c:

   bcm2835_gpio_write(dc, HIGH);
   if (oled_type == OLED_SH1106_SPI_128x64)
   {
     char buff[17] ;
     uint8_t x ;
     buff[0] = SSD_Data_Mode;
     for (uint8_t k=0; k<8; k++)
     {
       sendCommand(0xB0+k);//set page addressSSD_Data_Mode;
       sendCommand(0x02) ;//set lower column address
       sendCommand(0x10) ;//set higher column address

       for( i=0; i<8; i++)
       {
         for (x=1; x<=16; x++)
           buff[x] = *p++;

         fastSPIwrite(buff, 17);
       }
     }
   }

do you perhaps have any other advice?

from mpd_oled.

antiprism avatar antiprism commented on June 22, 2024

It looks like with the fastI2Cwrite(buff, sz) call the first character is a "command", rather than data, and so 17 bytes are sent for 16 bytes of data. This does not appear to be the case for fastSPIwrite(buf, sz), in which case you could try fastSPIwrite(&buff[1], 16); in your code above.

I updated bcm2835 to v1.25 in a development version which uses autotools for the build (I think because I encountered a compilation issue). If possible, I'll update this to v1.58. I haven't had any feedback of success or failure with the supported SPI OLED (mpd_oled -o 1) and therefore haven't had confirmation that the version of bcm2835 in master works correctly with it.

from mpd_oled.

naude-r avatar naude-r commented on June 22, 2024

thank you for the quick response.
unfortunately the change made no difference:

fastSPIwrite(&buff[1], 16);

suspect something else is wrong. the display is already corrupted after ArduiPi_OLED::begin (with a 10s pause).

from mpd_oled.

antiprism avatar antiprism commented on June 22, 2024

It's a shame it didn't work out. Just a thought, if it is suitable for your project, have you checked whether your display also supports I2C?

from mpd_oled.

naude-r avatar naude-r commented on June 22, 2024

yes, it does, but that is not the default. to change to I2C one would have to resolder resistors or some such....unfortunately out of my league.

from mpd_oled.

naude-r avatar naude-r commented on June 22, 2024

found a bug. have not tested the fix yet.

the issue is with the sequence:

  1. set DC pin high to indicate data
  2. send various commands, e.g. SH1106_Set_Page_Address, which pulls DC low for command node.
  3. by the time we do fastSPIwrite dc is actually low.

have corrected the above by adding a sendData overload that takes a char* and length. will test later today.

from mpd_oled.

naude-r avatar naude-r commented on June 22, 2024

the above mentioned bug addressed the issue. all working now.

thank you for your the help!

from mpd_oled.

Theojong avatar Theojong commented on June 22, 2024

hello i have a question i have an oled display ssd1325 spi but i can't get mpd_oled spi to work can you help me with that already thanks

from mpd_oled.

Theojong avatar Theojong commented on June 22, 2024

I am a layman in this area if I send my SSD1325 to spi then iksudo ./mpd_oled-o 1 -r 24 -b 10 -g 1 -f 20 that does not want you can help me with this my ssd1325 display send to me with raspberry pi 3 hifiberry please help me

bedankt theo

from mpd_oled.

antiprism avatar antiprism commented on June 22, 2024

Hi Theo

mpd_oled only supports displays compatible with SH1106 or SSD1306, and from a quick web search it appears that SSD1325 is not compatible with either of these, and so your display will not work with mpd_oled. I am not able to add support for more displays at this time, but it is something I would like to look at in the future.

Adrian.

from mpd_oled.

Theojong avatar Theojong commented on June 22, 2024

okay thanks well i will now get a new ssd1306 i2c display i hope if it goes better then

greeting Theo.

from mpd_oled.

antiprism avatar antiprism commented on June 22, 2024

Closed by: 410fcba and d964414

from mpd_oled.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.