Tuesday, 12 November 2013

beagle_hd44780.c file to include to interface lcd into beaglebone black

#include "beagle_hd44780.h"

/**
 * @brief Converts a character in two bitstreams the LCD can understand.
 * @param character The character we want to write.
 * @param part This can be either 0 or 1. Part 0 correspond to DB7..DB4,
 * while part 1 corresponds to DB3..DB0 on 8 bit mode. Since we are doing
 * 4 bit mode, we need to split the bitstream in two parts.
 **/
unsigned int write_character (char character, int part)
{
assert(part==0 || part==1);

char acB[2];
sprintf(acB, "%x", character);

unsigned int return_value = 0;

switch (acB[part])
{
case '0': return_value = 16; break;
case '1': return_value = 24; break;
case '2': return_value = 20; break;
case '3': return_value = 28; break;
case '4': return_value = 18; break;
case '5': return_value = 26; break;
case '6': return_value = 22; break;
case '7': return_value = 30; break;
case '8': return_value = 17; break;
case '9': return_value = 25; break;
case 'a': return_value = 21; break;
case 'b': return_value = 29; break;
case 'c': return_value = 19; break;
case 'd': return_value = 27; break;
case 'e': return_value = 23; break;
case 'f': return_value = 31; break;
}

return(return_value);
}

/**
 * @brief Puts a single character onto the screen.
 * @param characterToWrite The character we want to write.
 * @param selected_GPIOs[] initialized array of gpioID.
 **/
void charToScreen(char characterToWrite, struct gpioID enabled_gpio[])
{
unsigned int data_to_write=0;
const char *pinDescription[] = {"","","","","",""};

data_to_write=write_character (characterToWrite,0);
turn_ON_OFF_pins(enabled_gpio,data_to_write,6,0.10,pinDescription);
pulsePin(enabled_gpio,data_to_write,6,0, pinDescription, 5, 0.10);
  sleep(0.10);

data_to_write=write_character (characterToWrite,1);
turn_ON_OFF_pins(enabled_gpio,data_to_write,6,0.10,pinDescription);
pulsePin(enabled_gpio,data_to_write,6,0, pinDescription, 5, 0.10);
  sleep(0.10);

}
/**
 * @brief Initializes the screen so we can use it.
 * @param selected_GPIOs[] An initialized array of gpioID.
 * @param selectedPins[] The user defined pins.
 **/
void initialize_Screen(struct gpioID enabled_gpio[],int selectedPins[])
{
int nbr_selectedPins=6;
const char *pinDescription[] = {"","","","","",""};
unsigned int data_to_write;

initialize_each_enabled_gpio(enabled_gpio,selectedPins,nbr_selectedPins);
if (DISPLAY_DATA_ON_SCREEN) display_each_enabled_gpio(enabled_gpio,nbr_selectedPins,pinDescription);

//E RS DB4 DB5 DB6 DB7
//0 0  1   1   0   0 (base 2) which equals 12 (base 10)
    data_to_write=12;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

//E RS DB4 DB5 DB6 DB7
//0 0  0   1   0   0 (base 2) which equals 4 (base 10) : 4 bit mode
    data_to_write=4;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

//enable display part 1 - Display ON/OFF & Cursor
//E RS DB4 DB5 DB6 DB7 = 000000 (2) == 0 (10)
    data_to_write=0;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

//enable display part 2 - Display ON/OFF & Cursor
//E RS DB4 DB5 DB6 DB7 = 000011 (2) == 3 (10)
    data_to_write=3;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);
 
  //two line mode 5x7 part 1
//E RS DB4 DB5 DB6 DB7 = 000100 (2) == 4  (10)
    data_to_write=4;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

  //two line mode 5x7 part 2 (the 0 next to the 1 specifies the 5x7)
//E RS DB4 DB5 DB6 DB7 = 000001 (2) == 1 (10)
    data_to_write=1;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

}

/**
 * @brief Enables the blinking cursor with an underline.
 * @param selected_GPIOs[] initialized array of gpioID.
 **/
void enableBlinkingCursor(struct gpioID enabled_gpio[])
{
int nbr_selectedPins=6;
const char *pinDescription[] = {"","","","","",""};
unsigned int data_to_write;

//enable cursor part 1
//E RS DB4 DB5 DB6 DB7 = 000000 (2) == 0 (10)
    data_to_write=0;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

//enable cursor part 2
//E RS DB4 DB5 DB6 DB7 = 001111 (2) == 15 (10)
    data_to_write=15;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);
}

/**
 * @brief Disables the blinking cursor with an underline.
 * @param selected_GPIOs[] initialized array of gpioID.
 **/
void disableBlinkingCursor(struct gpioID enabled_gpio[])
{
int nbr_selectedPins=6;
const char *pinDescription[] = {"","","","","",""};
unsigned int data_to_write;

//enable cursor part 1
//E RS DB4 DB5 DB6 DB7 = 000000 (2) == 0 (10)
    data_to_write=0;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

//enable display part 2 - Display ON/OFF & Cursor
//E RS DB4 DB5 DB6 DB7 = 000011 (2) == 3 (10)
    data_to_write=3;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);
}

/**
 * @brief Clears the LCD from anything thats in there.
 * @param selected_GPIOs[] initialized array of gpioID.
 **/
void clear_Screen(struct gpioID enabled_gpio[])
{
int nbr_selectedPins=6;
const char *pinDescription[] = {"","","","","",""};
unsigned int data_to_write;

//E RS DB4 DB5 DB6 DB7 = 000000 (2) == 0 (10)
data_to_write=0;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

//E RS DB4 DB5 DB6 DB7 = 001000 (2) == 8 (10)
data_to_write=8;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);
}


/**
 * @brief After you are done using the LCD you should terminate it properly.
 * Failure to do so will guarantee that next time you use LCD it will be on 8 bit
 * mode... and you will must turn ON/OFF the screen.
 * @param selected_GPIOs[] initialized array of gpioID.
 **/
void terminate_Screen(struct gpioID enabled_gpio[],int selectedPins[])
{
int nbr_selectedPins=6;
const char *pinDescription[] = {"","","","","",""};
unsigned int data_to_write;

//put the display back in 8 bit mode to allow to re-run program
//E RS DB4 DB5 DB6 DB7 = 001100 (2) == 12 (10)
data_to_write=12;
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

  //we should now tell the OS that we are done with the GPIOs
cleanup_GPIO(enabled_gpio,selectedPins,nbr_selectedPins);
}

/**
 * @brief Prints a string to the screen.
 * @param full_string  String that needs to be printed on the LCD
 * @param selected_GPIOs[] Initialized array of gpioID.
 **/
void stringToScreen(const char *full_string, struct gpioID enabled_gpio[])
{
int i;
int length = strlen(full_string);

for (i=0; i<length; i++)
{
charToScreen(full_string[i],enabled_gpio);
//printf("%c\n",full_string[i]);
}
}

/**
 * @brief Sets the cursor to either the first or second line.
 * @param line If line==0, cursor will be placed on top line. If line==1, the
 * the cursor will be placed on the bottom line.
 * @param selected_GPIOs[] initialized array of gpioID.
 **/
void goto_ScreenLine(int line, struct gpioID enabled_gpio[])
{
assert(line==0 || line==1);
goto_ScreenLocation(line,0,enabled_gpio);
}

/**
 * @brief This function is still not working correctly. Technically the
 * function should set the cursor to a well defined position in the LCD, but
 * it is not doing so for the second line. I think my LCD is broken. Until, I
 * fix this function (or at least test it with different LCDs) do not use it.
 * @param line Line number; where 0 is the top line and 1 is the bottom line.
 * @param position Position; where the initial position is 0.
 * @param selected_GPIOs[] Initialized array of gpioID.
 **/
void goto_ScreenLocation(int line, int position,struct gpioID enabled_gpio[])
{
int nbr_selectedPins=6;
const char *pinDescription[] = {"","","","","",""};
unsigned int data_to_write;

//printf("position: %d\n",position);
//printf("line: %d\n\n",line);

if (line==1) position=position+40;
data_to_write=return_address_in_bitform(position,0);
//printf("data_to_write: %d\n",data_to_write);
data_to_write=bitWrite(data_to_write,1,0);
//printf("<%d>\n",data_to_write);
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);

data_to_write=return_address_in_bitform(position,1);
//printf("data_to_write: %d\n",data_to_write);
turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  sleep(MAX_DELAY);
}

/**
 * @brief Returns the address in a split format such that we can send it to
   the screen position functions.
 * @param address This is the position we want to set the cursor to.
 * @param part This can be either 0 or 1. Part 0 correspond to DB7..DB4,
 * @param selected_GPIOs[] Initialized array of gpioID.
 **/

unsigned int return_address_in_bitform (unsigned int address, int part)
{
assert(part==0 || part==1);

unsigned int return_value=0;

if (part==1)
{
return_value=bitWrite(return_value,bitRead(address,3),0);
return_value=bitWrite(return_value,bitRead(address,2),1);
return_value=bitWrite(return_value,bitRead(address,1),2);
return_value=bitWrite(return_value,bitRead(address,0),3);
}

if (part==0)
{
return_value=bitWrite(return_value,bitRead(address,4),3);
return_value=bitWrite(return_value,bitRead(address,5),2);
return_value=bitWrite(return_value,bitRead(address,6),1);
return_value=bitWrite(return_value,bitRead(address,7),0);
}

return(return_value);
}

beagle_hd44780.h header file to include to interface lcd to beaglebone black

#ifndef BEAGLE_HD44780_H_GUARD
#define BEAGLE_HD44780_H_GUARD

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <time.h>

#include "beagle_gpio.h"

#define DISPLAY_DATA_ON_SCREEN 0
#define MAX_DELAY 0.10

void goto_ScreenLine(int line, struct gpioID enabled_gpio[]);
void goto_ScreenLocation(int line, int position,struct gpioID enabled_gpio[]);
unsigned int return_address_in_bitform (unsigned int address, int part);
unsigned int write_character (char character, int part);
void charToScreen(char characterToWrite, struct gpioID enabled_gpio[]);
void initialize_Screen(struct gpioID enabled_gpio[],int selectedPins[]);
void terminate_Screen(struct gpioID enabled_gpio[],int selectedPins[]);
void clear_Screen(struct gpioID enabled_gpio[]);
void enableBlinkingCursor(struct gpioID enabled_gpio[]);
void disableBlinkingCursor(struct gpioID enabled_gpio[]);
void stringToScreen(const char *full_string, struct gpioID enabled_gpio[]);
#endif

build file for lcd program with beaglebone black

#!/bin/bash
echo "export slots"

export SLOTS=/sys/devices/bone_cap` `
emgr.9/slots

echo "export pins"

export PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins

echo "Compiling the overlay from .dts to .dtbo"

dtc -O dtb -o DM-GPIO-Test-00A0.dtbo -b 0 -@ DM-GPIO-Test.dts

echo "copy the file"

cp DM-GPIO-Test-00A0.dtbo /lib/firmware/

echo "echo the file to slots"

echo DM-GPIO-Test > $SLOTS

echo 60 > /sys/class/gpio/export




echo 31 > /sys/class/gpio/export



echo 48 > /sys/class/gpio/export




echo 45 > /sys/class/gpio/export



echo 44 > /sys/class/gpio/export




echo 26 > /sys/class/gpio/export




echo "finished"

devise tree source file for lcd program with beaglebone black

/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Purpose License Version 2 as
* published by the Free Software Foundation
*
* Original from: github.com/jadonk/validation-scripts/blob/master/test-capemgr/
*
* Modified by abhishek for the example on researchdesignlab.com
* that maps GPIO pins for the example
*/

/dts-v1/;
/plugin/;

/{
       compatible = "ti,beaglebone", "ti,beaglebone-black";
       part-number = "DM-GPIO-Test";
       version = "00A0";

       fragment@0 {
             target = <&am33xx_pinmux>;
           
             __overlay__ {
                  pinctrl_test: DM_GPIO_Test_Pins {
pinctrl-single,pins = <

0x078 0x07 /* P9_12 60 OUTPUT MODE7 - The LED Output */
0x074 0x07 /* P9_13 31 INPUT MODE7 none - The Button Input */
0x040 0x07 /* P9_15 48 */
0x034 0x07 /* P8_11 45 INPUT MODE7 (37)pullup - Yellow Wire */
0x030 0x07 /* P8_12 44 INPUT MODE7 (27)pulldown - Green Wire */
0x028 0x07 /* P8_14 26 INPUT MODE7 (2f)none - White Wire */
                     
                               /* OUTPUT GPIO(mode7) 0x07 pulldown, 0x17 pullup, 0x?f no pullup/down */
/* INPUT GPIO(mode7) 0x27 pulldown, 0x37 pullup, 0x?f no pullup/down */

>;
};
             };
       };

       fragment@1 {
target = <&ocp>;
__overlay__ {
test_helper: helper {
compatible = "bone-pinmux-helper";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_test>;
status = "okay";
};
};
};
};

lcd main fuction for beaglebone black

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <time.h>

#include "beagle_gpio.h"
#include "beagle_hd44780.h"

/**
 *  @brief     This program (example_04.c) describes how to interface with a
 *             HD44780 display in a BeagleBone
 *  @details   Compile, and run, this code on the beagleBone terminal with the
 *             commands:
 *   rm -f a.out ; gcc -c beagle_gpio.c ; gcc -c beagle_hd44780.c ; gcc beagle_gpio.o beagle_hd44780.o example_04.c ; ./a.out
modified by abhishek gowda
 * @return Returns a 1 upon succesful program termination
 **/

int main()
{
int i=0;
//specifies the pins that will be used
int selectedPins[]={P8_14,P8_12,P8_11,P9_15,P9_13,P9_12};
   

    system("./build.sh");
printf("done\n");
//adding a simple description for each pin
const char *pinDescription[] = {"DB7","DB6","DB5","DB4","RS","E"};

struct gpioID enabled_gpio[6];  

    initialize_Screen(enabled_gpio,selectedPins);
    //enableBlinkingCursor(enabled_gpio);
//clear screen
clear_Screen(enabled_gpio);
    //printf("hello\n");
for(i=0; i<=4;i++)
{
//types "hi!" to the screen
stringToScreen("hi BBB",enabled_gpio);
sleep(1);
clear_Screen(enabled_gpio);
}
//go to the bottom line and write something else
//note: goto_ScreenLine(0,enabled_gpio) will go to the top line.
//goto_ScreenLine(1,enabled_gpio);
//stringToScreen("there!",enabled_gpio);

//really... don't forget to terminate the screen
clear_Screen(enabled_gpio);
    terminate_Screen(enabled_gpio,selectedPins);

return 1;
}

beagelebone program for receiving the message from gsm module



#include <stdio.h> // standard input / output functions
#include <string.h> // string function definitions
#include <unistd.h> // UNIX standard function definitions
#include <fcntl.h> // File control definitions
#include <errno.h> // Error number definitions
#include <termios.h> // POSIX terminal control definitionss
#include <time.h>   // time calls

int open_port(void)
{
int fd; /* File descriptor for the port */

    // fd = ((open("/dev/ttyO1", O_RDWR | O_NOCTTY )) < 0);
    fd = open("/dev/ttyO1", O_RDWR | O_NOCTTY );
    printf("text openport\n");
if (fd == -1)
{
/* Could not open the port. */
perror("open_port: Unable to open /dev/ttyO1");
}
else
{
  fcntl(fd, F_SETFL, 0);
  printf("Port1 has been succesfully opened.\n");
}
return(fd);

} //open_port

int configure_port(int fd)      // configure the port
{
struct termios port_settings;      // structure to store the port settings in

cfsetispeed(&port_settings, B9600);    // set baud rates
cfsetospeed(&port_settings, B9600);

port_settings.c_cflag &= ~PARENB;    // set no parity, stop bits, data bits
port_settings.c_cflag &= ~CSTOPB;
port_settings.c_cflag &= ~CSIZE;
port_settings.c_cflag |= CS8;
tcsetattr(fd, TCSANOW, &port_settings);    // apply the settings to the port
printf("text configport\n");
return(fd);

}

int query_modem(int fd)   // query modem with an AT command
{
int m,n,d,e,f,x;
char buff[100];
unsigned char rx_buffer[1];
unsigned char test[5];
unsigned char data1[10];
n=read(fd,buff,100);
//printf("Result %i\n",n);
printf("Buf = %s\n\n\n", buff);
sleep(1);
memset(buff, 0, 100);
printf("AT+CMGF=1\r\n");
d = write(fd, "AT+CMGF=1\r\n", 11);
if (d < 0)
fputs("write() of 4 bytes failed!\n", stderr);
else
printf("write succeed n0 %i\n",d);

sleep(2);
d=read(fd, buff, 100);
printf("Buf = %s\n\n\n", buff);
memset(buff, 0, 100);

/*
printf("AT+CMGS=\"9964129460\"\r\n"); // \r and \n CR n LF
e = write(fd, "AT+CMGS=\"9964129460\"\rhello\n\x1A", 30);

if (e < 0)
fputs("write() of 4 bytes failed!\n", stderr);
else
printf("write succeed n0 %i\n",e);
sleep(8);
e=read(fd, buff, 100);
printf("Buf = %s\n\n\n", buff);
*/
/*
printf("AT+CMGD=1\r\n"); // \r and \n CR n LF
e = write(fd, "AT+CMGD=1\r\n", 11);
if (e < 0)
fputs("write() of 4 bytes failed!\n", stderr);
else
printf("write succeed n0 %i\n",e);
sleep(8);
e=read(fd, buff, 100);
printf("Buf = %s\n\n\n", buff);
*/
//sleep(15);
printf("AT+CMGR=1\r\n"); // \r and \n CR n LF
f = write(fd, "AT+CMGR=1\r\n", 11);

while(1)
{


sleep(1);
for(int i=0;i<=3;i++)
{
    read(fd, rx_buffer, (1)); //Filestream, buffer to store in, number of bytes to read (max)
    test[i]=rx_buffer[0];

    printf("%s\n", rx_buffer);
}
printf("end for data\n");
printf("%s\n", test);
}
/*
for ( x=0;x < 30;x++){
    data[x]='\0';
}
x=0;
printf("hello\n");
for(x=0;x<30;x++)
{
    data[x]=read(fd, rx_buffer, (30));
    //x++;
    if(data[x-1]==0x0D&&data[x-2]=='"'){
        x=0;
    }
}while(!(data[x-1]=='K'&&data[x-2]=='O'));

data[x-3]='\0';        //finish the string before the OK
*/


/*
if (f < 0)
fputs("write() of 4 bytes failed!\n", stderr);
else
printf("write succeed n0 %i\n",f);
sleep(8);
f=read(fd, buff, 100);
printf("Buf = %s\n\n\n", buff);
*/
return (fd);
}




int close_port(int fd)
{
close(fd);
printf("text close port\n");
}
int main(void)  //main function
{
int fd = open_port();
sleep(5);
configure_port(fd);
query_modem(fd);
close_port(fd);
return(0);
} //main

device tree source file

/* Copyright (C) 2013 Texas Instruments
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Genral Public License version 2 as
 * published by the Free Software Foundation.
Modified by ABHISHEK GOWDA
 */

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "uart1";
    version = "00A0";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            pinmux_serial1: pinmux_serial1_pins {
                pinctrl-single,pins = <
             0x184 0x20 /*P9_24(ZCZ ball D15) RX-enabled MODE 0*/
             0x180 0x20 /*P9_26(ZCZ ball D16) RX-enabled MODE 0*/
            >;
                };
            };
    };
   
    fragment@1 {
        target = <&ocp>;
        __overlay__ {
    serial1_pinmux_helper {
        compatible = "bone-pinmux-helper";
        status     = "okay";
        pinctrl-names = "default";
            pinctrl-0 = <&pinmux_serial1>;
            };
        };
    };
   
    fragment@2 {
        target = <&uart2>;   /* really uart1 */
        __overlay__ {
            status = "okay";
        };
    };
};