• Hardware
  • is anyone successfully using i2c OLED / LCD?

hmm that's interesting, I am wondering if you have a very very old Bela image (circa 2016)?

Otherwise the second of these lines in I2C.c should break

#include<linux/i2c.h>
#include<linux/i2c-dev.h>

?

Can you run grep v0 /etc/motd on the board? What does it return?

    giuliomoro This means that you are supposed to return a value from setup() and you are not. If the initialization goes well, you should return true.

    Great! it also works for me. I can now go on to test out these display functions from within PD; my plan is to use the customRender PD example project as a starting point.

    Thank you!

    giuliomoro Can you run grep v0 /etc/motd on the board? What does it return?

    Bela image, v0.3.6b, 23 October 2018

    giuliomoro and grep linux /root/Bela/projects/OLED_test_github/* ?

    /root/Bela/projects/OLED_test_github/I2C.c:#include<linux/i2c.h>
    /root/Bela/projects/OLED_test_github/I2C.c:#include<linux/i2c-dev.h>
    grep: /root/Bela/projects/OLED_test_github/build: Is a directory
    Binary file /root/Bela/projects/OLED_test_github/oled matches

    and what's the output of

    dpkg -l | grep i2c

    ?

    ii i2c-tools 3.1.2-3 armhf heterogeneous set of I2C tools for Linux

    I did use i2cdetect earlier to check whether the display module was connected... I don't recall exactly if I installed it or if it was already there. Maybe that makes a difference?

    right so the problem is on my board, where I have actually installed an extra package libi2c-dev, which causes the an error when including both files listed above. UOPS!

      🙂 let me know if I can be of any further assistance. I think it might be best for me to first work on the PD integration and after that write up a how-to.

        giuliomoro Giulio, thanks a lot for your assistance and attention! After the post 30 I was able to connect my bela on the OLED screen. crosswick will try to connect it on PD, and I'll try to connect on Sc now. we'll keep you update! I'm also up to write a documentation about it 🙂

        15 days later

        Good news - I've got an application running that can run independently from PD or SC, that translates incoming OSC messages into SSD1306 display commands.

        I've been heavily inspired by this conversation: https://forum.bela.io/d/497-how-do-i-get-two-programs-running-at-the-same-time

        Also I've read elsewhere on the forum that for starting up a second/background application like this, it should be possible to use a self-made run.sh script in the project directory.

        Two questions now that I'm having a challenge figuring out:
        - in run.sh, after starting up the OSC->OLED application, how do I resume the normal Run procedure for a PD or SC project?
        - is there a similar way to end/kill the application that is triggered by the Stop button in the IDE interface?

          Hey @crosswick & @giuliomoro

          Trying to get an OLED display to work based on the repo @giuliomoro posted in reply #30 (https://github.com/giuliomoro/bela-ssd1306) and I'm actually getting the following warnings and a runide error:

          Build finished
          In file SSD1306_OLED.c: [warning] passing 'const unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 33, line: 2419
          In file SSD1306_OLED.c: [warning] passing 'char [3]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 22, line: 2430
          In file SSD1306_OLED.c: [warning] passing 'const unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 30, line: 2442
          In file SSD1306_OLED.c: [warning] passing 'char [3]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 20, line: 2443
          In file SSD1306_OLED.c: [warning] passing 'char *' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 22, line: 2479
          In file SSD1306_OLED.c: [warning] passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 26, line: 2657
          In file SSD1306_OLED.c: [warning] passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 26, line: 2659
          In file SSD1306_OLED.c: [warning] passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 26, line: 2661
          In file SSD1306_OLED.c: [warning] passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 26, line: 2663
          In file SSD1306_OLED.c: [warning] passing 'char [2]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 24, line: 2686
          In file example_app.c: [warning] passing 'char [7]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 15, line: 261
          In file example_app.c: [warning] passing 'char [14]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 15, line: 286
          In file example_app.c: [warning] passing 'char [3]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 15, line: 293
          In file example_app.c: [warning] passing 'char [19]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 17, line: 377
          In file example_app.c: [warning] passing 'char [21]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 17, line: 379
          In file example_app.c: [warning] passing 'char [10]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] column: 17, line: 382
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2419:33: warning: passing 'const unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]    
               return print(strPtr, strlen(strPtr));                                
                            ^~~~~~
          /usr/include/string.h:394:35: note: passing argument to parameter '__s' here
          extern size_t strlen (const char *__s)
                                           ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2430:22: warning: passing 'char [3]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          return print_str("\r\n");                     
                           ^~~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)                                     
                                              ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2442:30: warning: passing 'const unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]    
          n = print(strPtr, strlen(strPtr));                             
                    ^~~~~~
          /usr/include/string.h:394:35: note: passing argument to parameter '__s' here
          extern size_t strlen (const char *__s)                                 
                                           ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2443:20: warning: passing 'char [3]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
           n += print_str("\r\n");
                          ^~~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)
                                              ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2479:22: warning: passing 'char *' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          return print_str(str);
                           ^~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)
                                              ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2657:26: warning: passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          return print_str("nan");
          ^~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)                                     
                                              ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2659:26: warning: passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          return print_str("inf");                         
                           ^~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)
                                              ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2661:26: warning: passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          return print_str("ovf");  // constant determined empirically
                           ^~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)
                                              ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2663:26: warning: passing 'char [4]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          return print_str("ovf");  // constant determined empirically
                           ^~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)
                                              ^
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2686:24: warning: passing 'char [2]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          n += print_str(".");
                         ^~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.c:2417:38: note: passing argument to parameter 'strPtr' here
          short print_str(const unsigned char *strPtr)
                                              ^
          10 warnings generated.
          /root/Bela/projects/bela-ssd1306/example_app.c:261:15: warning: passing 'char [7]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]    
          print_str("scroll");
                    ^~~~~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.h:172:45: note: passing argument to parameter 'strPtr' here
          extern short print_str(const unsigned char *strPtr); 
                                                     ^
          /root/Bela/projects/bela-ssd1306/example_app.c:286:15: warning: passing 'char [14]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]    
          print_str("HELLO FELLAS!");
                    ^~~~~~~~~~~~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.h:172:45: note: passing argument to parameter 'strPtr' here
          extern short print_str(const unsigned char *strPtr);
                                                     ^
          /root/Bela/projects/bela-ssd1306/example_app.c:293:15: warning: passing 'char [3]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          print_str("0x");
                    ^~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.h:172:45: note: passing argument to parameter 'strPtr' here
          extern short print_str(const unsigned char *strPtr);
                                                     ^
          /root/Bela/projects/bela-ssd1306/example_app.c:377:17: warning: passing 'char [19]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]    
          print_strln("deeplyembedded.org"); 
                      ^~~~~~~~~~~~~~~~~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.h:174:47: note: passing argument to parameter 'strPtr' here
          extern short print_strln(const unsigned char *strPtr);
                                                       ^
          /root/Bela/projects/bela-ssd1306/example_app.c:379:17: warning: passing 'char [21]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]    
          print_strln("Author:Vinay Divakar");
                      ^~~~~~~~~~~~~~~~~~~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.h:174:47: note: passing argument to parameter 'strPtr' here
          extern short print_strln(const unsigned char *strPtr);
                                                       ^
          /root/Bela/projects/bela-ssd1306/example_app.c:382:17: warning: passing 'char [10]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]    
          print_strln("THANK YOU");
                      ^~~~~~~~~~~
          /root/Bela/projects/bela-ssd1306/SSD1306_OLED.h:174:47: note: passing argument to parameter 'strPtr' here
          extern short print_strln(const unsigned char *strPtr);                                             
                                                       ^
          6 warnings generated.
          Running project...
          (Main)i2c-2: Bus Connected to SSD1306
          Makefile:524: recipe for target 'runide' failed
          make: *** [runide] Error 1

          I also want to just confirm the correct pin connections and I2C bus to be using when using the files in the repo linked above. It seemed at the beginning of the thread that it made most sense to connect to the I2C1 bus, but I noticed in the terminal that it says "(Main)i2c-2: Bus Connected to SSD1306" - so I'm also wondering whether I'm connecting to the wrong bus.

          My breadboard is currently set up with a Bela Mini like this:

          Ground: P2_21
          VIN: P2_23
          SCL: P2_9
          SDA: P2_11

          Is this correct? Or should I be using I2C2? i.e.:
          Ground: P2_21
          VIN: P2_23
          SCL: P1_26
          SDA: P1_28

          Per @crosswick's note concerning the RST pin - I'm using the circuit noted here:
          http://community.axoloti.com/t/spi-i2c-oled-display/638/187

          Specifically - I've got a 10k resistor connected to the 3.3V rail, a 68nf cap connected to ground - I'm running a wire at the junction point on the terminal strip where the 10k resistor meets the 68nf cap to another terminal strip where a 100k resistor is tied to ground and I have a wire from that strip connected to the RST pin.

          Is this the correct way to deal with the RST pin? I've seen other examples where RST is connected to a GPIO pin - but there doesn't appear to be an RST pin noted in the code anywhere and it isn't mentioned in this thread explicitly either.

          Just trying to get this example code running so I can move on to some more fun visuals!

          Hi @kreiff, I also got those errors. It was explained to me by a buddy that this SSD1306 C library does things with unsigned chars which are not permitted in C++. There's apparently several different ways of solving this, amongst which macros - I solved it by editing the SSD1306_OLED.c and -.h files by simply removing the 'unsigned' bit in the relevant places.

          As far as the pinouts, I'm using the same you mention with P2_9 and P2_11.

          Here's a picture of my RST pin setup: (I'm using a dedicated I2S display now btw)

          alt text

            @crosswick - Thanks for the quick reply!

            crosswick As far as the pinouts, I'm using the same you mention with P2_9 and P2_11.

            Thanks for confirming!

            crosswick Here's a picture of my RST pin setup: (I'm using a dedicated I2S display now btw)

            It's a little hard to see the connections - but this looks to be how the RST pin is set up on my breadboard.

            crosswick I solved it by editing the SSD1306_OLED.c and -.h files by simply removing the 'unsigned' bit in the relevant places.

            I tried using your approach from post 32 and downloaded your github repo. I also went through and removed the unsigned pre-cursors on the variables across the files. If I try running via SSH I do get this line in the terminal:

            (Main)i2c-1: Bus Connected to SSD1306

            But I don't have any output on the OLED...

            Alternatively - if I try running the render.cpp - I still get a ton of errors and the same runide error:

            Makefile:524: recipe for target 'runide' failed
            make: *** [runide] Error 1

            @giuliomoro - What is runide Error 1?

              kreiff looks to me like there's something wrong with the physical connection to the display - that's when I get that runide error. I would suggest that you get a (bunch of, they're really cheap) I2C-only versions of this SSD1306 display to be sure.

              BTW like you've probably already seen, the unsigned-alteration is not yet in my github repo.

                @kreiff can you run i2cdetect -y -r 1 ? Does the display show up at the expected address?

                Thew runide failed message is a general message that the program stopped with an error

                crosswick looks to me like there's something wrong with the physical connection to the display - that's when I get that runide error. I would suggest that you get a (bunch of, they're really cheap) I2C-only versions of this SSD1306 display to be sure.

                I came to this conclusion last night as well. I think my OLED is dead. It was from Adafruit - so I figured I would just test their arduino library code to rule out the screen itself being bad...and that looks like the culprit. It doesn't even flicker following the Adafruit instructions exactly...

                I bought a two pack of I2C-only (4-pin / no reset) OLEDs from Amazon - so I'll give this another go when they arrive.

                @crosswick Sorry to be hanging on your coat tails with this - but any luck resolving the latency issue?

                I'm trying to get an Axoloti style minimal oscilliscope working - and I'm getting a ton of latency even just sending the values straight from PD. It's like the OSC messages start piling up and it ends up getting like 30 seconds behind drawing the waveshape.

                I'm wondering whether I2C is just too slow? Or if it's something to do with the driver. I've noticed that even the "demo" animation draws about twice as fast using the Adafruit library vs. the Deeply Embedded one. (granted - this is an Arduino Due running the adafruit library vs. Bela running the DE one - so not apples-to-apples - but I would expect Bela / PocketBeagle to be faster).