Where do I start from to get GPS data transfered via UART on WP7502 using mangOH red?


#21

@Alex

I do get the output at remote MCU when I use the microcom -s /dev/ttyHS0 and type anythong over there.

@asyal

Thanks for replying. My operational requirement doesnt permits me to use USB or UART2 hence I can ounly use P8,10 on CN307.

My current 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, B9600);
   cfsetospeed(&options, B9600);

  // 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)
    {
    //my application doesnt need this part
     }

     COMPONENT_INIT
     {
       LE_INFO("Hello, world.");
        int serial_fd,i=0;
    //t     wrote = 0;
         serial_fd= open_uart1("/dev/ttyHS0");
        while(i<1000)
        {
          	write_uart1(serial_fd,"He");
	        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 ",serial_fd);
           	i++;
	         sleep(1);
           }
           }

#22

Sounds like the RX physical connection is working. So the MCU can receive data. Have you put the lines on a scope yet? That would be the fastest way to debug. See the data you send out from McU , see if you get a response , verify what you send out is what it should be. Then you can narrow it down from there.


#23

@Alex

Thanks for replying ,

Setup

CRO probe across PIN 8 and PIN 6 of CN307

micocom -s 9600 /dev/ttyHS0 inside the terminal typing “h”


#24

Looks like uart data but i don’t know what h is off the top of my head. If you are not getting responses might want to probe the Tx line and work from there.


#25

voltage looks 2.4V and not 3,3V. Any reason for that?


#26

Hi asyal
I got i indication . When i was connected TCP connection i got this error

AT+KTCPCNX=1
Responds is
OK

+KCNX_IND: 1,4,1

+KCNX_IND: 1,2,1,2,30

AT+KTCPSND=1,72 after
error is came.

how can i solve. so please guide to me.


#27

Greetings ,

Sorry for the delay after some prolonged digging in and some hints by this gracious people of this forum I achieved GPS co-ordinate acquasition and transmission via UART for a delay of 1 sec between each transmission. In case of UART although you may find numerous code but theres an import step much of the newbies like me didnt know about. While specifying and using directories such /dev/tty* which is general way to use UART ports its required to go through .adef file.

 executables:
{
uartaccess = ( UARTACCESSComponent )
}

processes:
{
envVars:
{
	LE_LOG_LEVEL = DEBUG
}

run:
{
	( uartaccess )
}

maxCoreDumpFileBytes: 512K
maxFileBytes: 512K
} 
requires:
{

device:
{
	[rw] /dev/ttyHS0 /dev/ttyHS0
	
}
 }

    version: 1.0.0 
 maxFileSystemBytes: 512K

//device section is the added part I dont have clarification as to why though! but it worked just transfer whatever data you want into the variable and it works fine.


#28

Hi @nick
thank you for sharing a sample code for gps monitoring. I am just curious are you facing any memory leakage issue in positioningService app? I am using legato 16.10.3 (wp7502 and wp8548) and in my code i could observe that if i use the positioningService api, it is keep consuming memory over the time, and increasing linearly. I tried your code and facing the same issue.

Thanks


#29

Hey @niladridm,

Would you be able to test it on Legato 18.04.0 instead?


#30

yes there is no problem with latest legato and 18.04 but i am looking for a fix in legato 16.10.03 as all of my remote devices have 16.10.03 and have limited data so over the air system update not possible. Looking for some fix only for positionongService app


#31

You could try factoring out the positioningService from Legato 18.04.0 and building it into Legato 16.x.x but I suspect there will be some breaking changes.

Were you planning on updating one app at a time instead of sending a larger system bundle?