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


#10

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


#11

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


#12

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


#13

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
        }

        COMPONENT_INIT
       {
           LE_INFO("Hello, world.");
          int serial_fd,i=0;
         int     wrote = 0;
           serial_fd= open_uart1("/dev/ttyHS0");
           while(i<60)
              {
              	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);
	                 i++;

                   	sleep(1);

                     }

}


#14

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


#15

@jyijyi

I did but theres no data from that port.


#16

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


#17

@jyijyi

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.


#18

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.


#19

@jyijyi

Thanks again for replying

AT!MAPUART?

!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


#20

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.


#21

@jyijyi

I could see the output via usb port (UART2) now how can i modify this to get the output from CN307?


#22

maybe you can try to put the UART console to UART1 by AT!MAPUART=16,1 and reset.
This can verify if there is hardware issue.
Honestly I have never tried on UART1, so no real experience on this.


#23

@jyijyi

I used AT!MAPUART=16,1 and got this upon using AT!MAPUART?

!MAPUART: 16,0

what should I do next?


#24

this is to route the console to UART1. After reboot, there should be some kernel log coming out from UART1, can you see it?


SerialportCommunication
#25

Okay now I got UART1 in console mode.


#26

I don’ see problem with WP750x with mangoH Red board.
After shorting pin 8 and in 10 of CN307, I run the following application (attached).
I can read back those data.


Jan 6 01:06:27 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 30 | wrote 6
Jan 6 01:06:27 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 57 | read 6 bytes == ATI3^M
Jan 6 01:06:28 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 30 | wrote 11
Jan 6 01:06:29 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 57 | read 11 bytes == AT+CMGF=1^M
Jan 6 01:06:30 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 30 | wrote 20
Jan 6 01:06:30 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 57 | read 20 bytes == AT+CMGS=“97576275”^M
Jan 6 01:06:31 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 30 | wrote 34
Jan 6 01:06:31 | atcmd[15181]/ATcmd_Test2Component T=main | ATcmd_Test2.c at_command() 57 | read 34 bytes == This is test SMS from ATcmd_Test2^Z
*****ATcmd_Test2.rar (96.7 KB)


#27

No I can’t see any kernel log. Where is cn307 please guide me
Thankyou
Subrahmaniam


#28

I can’t understand the problem which port should I connect DM/at/. And guide me to resolve this issue


#29

you can find CN307 easily if you look at the MangOH red board.