1 Reply Latest reply on Nov 29, 2015 8:38 AM by gnogna82

    1602A lcd display in i2c displays nothing

    gnogna82

      Hi all, I soldered a PCF8574AT serial converter on a 1602A lcd display and connected it to my Edison module with Arduino Breakout board.

      The backlight turns on as expected. Using i2cdetect I can find the chip address at 0x3f:

      Untitled.bmp

      Now I try to run this simple code in Eclipse:

      #include "lcm1602.h"
      #include <iostream>
      #include "mraa.hpp"
      
      
      int main() {
          upm::Lcm1602* lcd = new upm::Lcm1602(6, 0x3f);
          lcd->setCursor(1,1);
          lcd->write("Hello World");
          sleep(5);
          delete lcd;
          return 0;
      }
      

       

      But nothing is displayed. Both methods setCursor and write get mraa::SUCCESS ar result.

      Using bus 0,1, and 6 or a random address in the Lcm1602 constructor changes nothing.

      Same result if I connect the module to A4 and A5 pins or to SCL and SDA pins on the breakout board.

      Setting the cursor in (0,0), (2,2), etc. doesn't help.

      Any thoughts?

        • 1. Re: 1602A lcd display in i2c displays nothing
          gnogna82

          Today I gave it another try, but the device seemed to be disappeared from the i2c bus:

          Untitled2.bmp

          At that moment I was enabling the i2c bus using these commands:

          echo 27 > /sys/class/gpio/export  
          echo 28 > /sys/class/gpio/export  
          echo mode1 > /sys/kernel/debug/gpio_debug/gpio27/current_pinmux  
          echo mode1 > /sys/kernel/debug/gpio_debug/gpio28/current_pinmux  
          

           

          But while googling for a fix, I found here http://www.emutexlabs.com/project/215-intel-edison-gpio-pin-multiplexing-guide that these commands should be used:

          echo 28 > /sys/class/gpio/export 
          echo 27 > /sys/class/gpio/export 
          echo 204 > /sys/class/gpio/export 
          echo 205 > /sys/class/gpio/export 
          echo 236 > /sys/class/gpio/export 
          echo 237 > /sys/class/gpio/export 
          echo 14 > /sys/class/gpio/export 
          echo 165 > /sys/class/gpio/export 
          echo 212 > /sys/class/gpio/export 
          echo 213 > /sys/class/gpio/export 
          echo 214 > /sys/class/gpio/export 
          echo low > /sys/class/gpio/gpio214/direction 
          echo low > /sys/class/gpio/gpio204/direction 
          echo low > /sys/class/gpio/gpio205/direction 
          echo in > /sys/class/gpio/gpio14/direction 
          echo in > /sys/class/gpio/gpio165/direction 
          echo low > /sys/class/gpio/gpio236/direction 
          echo low > /sys/class/gpio/gpio237/direction 
          echo in > /sys/class/gpio/gpio212/direction 
          echo in > /sys/class/gpio/gpio213/direction 
          echo mode1 > /sys/kernel/debug/gpio_debug/gpio28/current_pinmux 
          echo mode1 > /sys/kernel/debug/gpio_debug/gpio27/current_pinmux 
          echo high > /sys/class/gpio/gpio214/direction
          

           

          ...And voilà the device came back on the i2c bus 6.

          Untitled.bmp

           

          Then I rewrote my project in Java:

          public class JavaTest {
          
          
            static {
            try {
            System.loadLibrary("javaupm_i2clcd");
            } catch (UnsatisfiedLinkError e) {
            System.err.println("error in loading native library");
            System.exit(-1);
            }
            }
          
          
            public static void main(String[] args) throws InterruptedException {
            upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602(0, 0x3f);
            lcd.setCursor(0, 0);
            lcd.write("Hello World!");
            }
          }
          

           

          And... magically it worked!

          Still have to realize what I did to have it working, but I'm leaving it here for someone else like me to find it.