How to start UART communication on UART1 port ie pin(8,10) on mangOH red using WP7502?


Im new to these fascinating systmes any help would be appreciated.

Im stuck with the requirement of transfering GPS co ordinates via UART port although I did mange to pull the GPS co ordinates I found no precise guidance for using UART port. A sample code for using the UART and how to enable the port on the system would help me a lot. Thank you.


I have an application(attached) to use UART2 to transfer data to TCP server.
Maybe you can take it as reference.
UART_TCP_Demo.docx (101.7 KB)


Hi @jyijyi,

Thanks for making time to reply I did go through the content of your document and it was helpful can you forward me the source code to tranfer data via UART1?

Thanks in advance.


I don’t have it.
But probably you can do the following modification based on the previous document:

  1. AT!MAPUART=17,1
  2. after reboot, probably there will be new port /dev/HS0
  3. in Component.cdef , change to the following:
    [rw] /dev/ttyHS0 /dev/
  4. in UART_TCP_Demo1Component.c, change the port :




just to be clear does UART1 stands for the pins 10,8 ? If no whats the port name for pin 10,8 UART


I checked Product technical specification, pin 10 is GPIO2 and pin 8 is UART1_DCD.
Are you using the correct pin?



This came in when I searched pin diagram in its associated documents also after enering the command ATMAPUART=10,8 I did find this at /dev >> /dev/ttyHSL1



I don’t think you can enter AT!MAPUART=10,8
there is no such option in the AT command user guide.



Are there any options inorder to utilise pin 8,10 as UART? Since the document shows it as UART port. If not whats the alternative for using UART ?


I believe pin 8 and 10 here are referring to the IOT connector instead of the pin 8 and 10 of WP8 module.


Pin 8,10 are from CN307 of the mangOH red board.


I saw CN307 pin 8 and 10 are connected to U307 FXMA108 and the other side is UART1 RX and UART1 TX.


Hi @jyijyi

I did manage to get /dev/ttyHS0 by using the command “uartMode set 1 app” which pin of CN307 is it connected to?
In addition to this I did manage to run this code >>>

        #include "legato.h"
        #include <termios.h>
        #include <unistd.h>
        int open_uart1 (  char *dev)
         int     fd;
         fd = open (dev, O_RDWR | O_NOCTTY | O_NDELAY);
         struct termios options;
         // The old way. Let's not change baud settings
         fcntl (fd, F_SETFL, 0);
         // get the parameters
          tcgetattr (fd, &options);
         // Set the baud rates to 115200...
         cfsetispeed(&options, B115200);
         cfsetospeed(&options, B115200);
         // Enable the receiver and set local mode...
         options.c_cflag |= (CLOCAL | CREAD);
         // No parity (8N1):
         options.c_cflag &= ~PARENB;
         options.c_cflag &= ~CSTOPB;
         options.c_cflag &= ~CSIZE;
         options.c_cflag |= CS8;
         // enable hardware flow control (CNEW_RTCCTS)
         // options.c_cflag |= CRTSCTS;
         // if(hw_handshake)
         // Disable the hardware flow control for use with mangOH RED
         options.c_cflag &= ~CRTSCTS;

         // set raw input
           options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
           options.c_iflag &= ~(INLCR | ICRNL | IGNCR);

           // set raw output
          options.c_oflag &= ~OPOST;
          options.c_oflag &= ~OLCUC;
          options.c_oflag &= ~ONLRET;
          options.c_oflag &= ~ONOCR;
          options.c_oflag &= ~OCRNL;

         // Set the new options for the port...
          tcsetattr (fd, TCSANOW, &options);

          return fd;

          void write_uart1 (int fd,char *cmd)
             //	fd_set  rfds;
            //	struct timeval timeout;
         int     wrote = 0;
           	wrote = write (fd, cmd, strlen (cmd));
        	  LE_INFO("wrote  %d ",wrote);

        void read_uart1(void)
      //There was no read option though

           LE_INFO("Hello, world.");
          int serial_fd,i=0;
         int     wrote = 0;
           serial_fd= open_uart1("/dev/ttyHS0");
              	write_uart1(serial_fd,"Hello how are you today?\r\n");
            	LE_INFO("Hello how are you today?");

                   //	wrote = write (serial_fd,"Hello how are you today?\r\n", strlen ("Hello how are 
                you today?\r\n"));
		             LE_INFO("wrote  %d ",wrote);





didn’t you attach the picture saying pin 8 and 10 of CN307?



I did but theres no data from that port.


did you disable the hardware flow control inside the application?
You might also try UART2 first to verify your code.



Im sorry for dragging this long and I really appreciate the time and the effort you put in to answer my querries. I have no knowledge about hardware flow control and methods involved in enabling /disabling them. Can you please elobarate or guide me through this one. Thank you.


seems you already disable the hardware flow control for CTS/RTS pin as I can see
options.c_cflag &= ~CRTSCTS; /* HW flow control off */

What is the current value of AT!MAPUART?

Also I suggest you try on UART2 as the mangOH Red board already have the USB to UART chip and you can connect to PC and see the data in UART2.



Thanks again for replying


!MAPUART: 17,16

The current requirement is that I need the usb port for other application hence I should handle UART via this 8,10 pins


I understand you need UART2 for other application. But currently we need to verify your code if it is working. You can disconnect other application first.
But be careful that after settting AT!MAPUART=17,2, there will not more UART2 console. Make sure you can talk to the module via USB ECM port before this.