3 Replies Latest reply on Jan 3, 2020 4:25 AM by RakshithM_16

    How to interface an SSD 1306 OLED?

    BoBr_4596421

      Any help or pointers appreciated please.

      I'm having unexpected difficulties in interfacing a relatively common display to my PSoC6 prototype board.

      Anybody know how to do it?

       

      There are several efforts by Alan Hawse online but I have found these to be a) varied across IDE which I don't use and b) otherwise incomplete in terms of code (or with errors arising on my system - which of course may be due to differences in issues and timing of blogs).

       

      I say these difficulties are 'unexpected', since I already have an ADAFRUIT M0 Feather board running with this display and using the u8g2 library (which may be found here) under the Arduino IDE.

       

      PSoC 6 ENVIRONMENT:

      Board: CY8C-PROTO-063-BLE / CYBLE-416054-02

      IDE: PSoC Creator v4.2

      PDL: 3.1.0

      OS: Windows 10 (build 1903)

       

      BUILD:

      Created an I2C Master device and connected to SCL and SDA pins appropriate to my board

      Display device needs only 4 wires to connect - the above two, plus 3V and GND

      Downloaded and added in the U8g2lib to the project folder.

      In Project Build Settings, I added the 'src' library folder as an additional directory to the Compiler.

      Once the application was generated, I added the 'U8g2lib.h' header file into the header folder of the cm4 processor and #included it in 'main_cm4.c'

       

      ISSUES:

      The compiler throws errors such as missing 'arduino.h', 'print.h', U8x8lib.h' and so on. All of which makes me think I may be using a library that's too dedicated towards the Arduino IDE, or it may be a lack of experience in adding a library to a PSoC 6 project.....

       

      All ideas welcomed - thank you.

        • 1. Re: How to interface an SSD 1306 OLED?
          RakshithM_16

          Hello BoBr_4596421,

           

          Arduino.h is specific for the Arduino IDE. The correct way to port the library is -

          1. Check for all the Arduino dependent header files and change it to the corresponding PSoC header file. Including project.h might be right way to start.

          2. Check for each Arduino hardware blocks used and then use the corresponding PSoC components.

          3. Change all the Arduino APIs to the corresponding PSoC Creator APIs.

           

          I have attached a project which displays the Cypress logo followed by "Hello" "World!" in a loop. It might be easier to start off with this project and change the project according to your application. Please let me know if you have any issues using the attached project.

           

          Hope this helps,

           

          Thanks and Regards,

          Rakshith M B

          1 of 1 people found this helpful
          • 2. Re: How to interface an SSD 1306 OLED?
            BoBr_4596421

            Hello Rakshith M B,

            Thank you for an excellent answer, and I can report that your 'Hello World' example project built, compiled and ran without error.

            I wasn't aware of the SSD 1306 library that you have used and from a quick look it seems to have all the functions I might need.

             

            Many many thanks!

            Regards

            Bob

            1 of 1 people found this helpful
            • 3. Re: How to interface an SSD 1306 OLED?
              RakshithM_16

              Hello BoBr_4596421,

               

              Glad you are able to move forward with your project

               

              Regards,

              Rakshith