NMEA read driver miss interrupt

Hi All,

I am working on legato 16.10 and getting NMEA read driver miss interrupt, abandon current buff, what is the problem here and how to fix it?

Thanks in advance

Can you share more information on which module you are using and which application you are testing?

I am facing a similar issue.
le_result_t result;
int32_t latitude;
int32_t longitude;

le_posCtrl_ActivationRef_t posCtrlRef = le_posCtrl_Request();
if (!posCtrlRef)
{
    LE_ERROR("Can't activate the Positioning service");
    exit(1);
}

LE_INFO("CHECKING 2D POSITION");
while(true){
    result = le_pos_Get2DLocation(&latitude, &longitude, NULL);
    if (result == LE_OK){
        LE_INFO("OK");
        break;
    }
    else{
        LE_INFO("Somthing went wrong... Result = %d", result);
        sleep(3);
    }
}
LE_INFO("Lat = %d \tLong = %d",latitude, longitude);

This is the logread output

Jan  6 00:35:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[4969]/supervisor T=main | proc.c proc_Start() 1354 | Execing 'gpstest'
Jan  6 00:35:18 swi-mdm9x15 authpriv.info dropbear[4941]: Exit (root): Disconnect received
Jan  6 00:35:18 swi-mdm9x15 user.info Legato:  INFO | posDaemon[774]/le_pa_gnss T=main | pa_gnss_qmi.c pa_gnss_Start() 3320 | EngineState ON
Jan  6 00:35:18 swi-mdm9x15 user.info Legato:  INFO | gpstest[4969]/gpstestComp T=main | gpsComp.c _gpstestComp_COMPONENT_INIT() 36 | CHECKING 2D POSITION
Jan  6 00:35:18 swi-mdm9x15 user.info Legato:  INFO | gpstest[4969]/gpstestComp T=main | gpsComp.c _gpstestComp_COMPONENT_INIT() 44 | Somthing went wrong... Result = -3
Jan  6 00:35:19 swi-mdm9x15 user.info Legato:  INFO | avcDaemon[1056]/avcDaemon T=main | assetData.c RegUpdateTimerHandler() 3262 | RegUpdate timer expired; reporting REG_UPDATE
Jan  6 00:35:19 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[1056]/avcDaemon T=main | assetData.c assetData_RegistrationUpdate() 1946 | unsupported function called.
Jan  6 00:35:21 swi-mdm9x15 user.info Legato:  INFO | gpstest[4969]/gpstestComp T=main | gpsComp.c _gpstestComp_COMPONENT_INIT() 40 | OK
Jan  6 00:35:21 swi-mdm9x15 user.info Legato:  INFO | gpstest[4969]/gpstestComp T=main | gpsComp.c _gpstestComp_COMPONENT_INIT() 48 | Lat = 0 	Long = 0
Jan  6 00:35:22 swi-mdm9x15 user.debug kernel: [ 2113.101602] NMEA read driver miss interrupt, abandon current buff
Jan  6 00:36:11 swi-mdm9x15 user.debug kernel: [ 2162.100503] NMEA read driver miss interrupt, abandon current buff
Jan  6 00:37:00 swi-mdm9x15 user.debug kernel: [ 2211.099679] NMEA read driver miss interrupt, abandon current buff
Jan  6 00:37:50 swi-mdm9x15 user.debug kernel: [ 2261.096688] NMEA read driver miss interrupt, abandon current buff
Jan  6 00:38:29 swi-mdm9x15 user.debug kernel: [ 2300.096199] NMEA read driver miss interrupt, abandon current buff
Jan  6 00:39:08 swi-mdm9x15 user.debug kernel: [ 2339.095711] NMEA read driver miss interrupt, abandon current buff
Jan  6 00:39:33 swi-mdm9x15 user.warn Legato: -WRN- | posDaemon[774]/le_pa_gnss T=unknown | pa_gnss_qmi.c PositionHandler() 1359 | Bad position indication
Jan  6 00:39:33 swi-mdm9x15 user.warn Legato: -WRN- | posDaemon[774]/le_pa_gnss T=unknown | pa_gnss_qmi.c PositionHandler() 1359 | Bad position indication

any help would be much appreciated

Hello @asifarshad, Can you share the following information?

  1. The module and legato version being used
  2. Are you able to see the NMEA data on /dev/nmea port ? (Ref: gnss - Legato Docs)
    Check for the NMEA data on the NMEA port without executing the app using the following commands.
    gnss enable
    gnss start
    cat /dev/nmea
  3. Post the portion of code where the GNSS is enabled and started?
  4. Check with the latest version of legato?

I’m getting this also with Legato 18.09.0. I’d like to get ride of this issue any thoughts?

Any update on this? I’m seeing this on both Legato 18.09.0 and 19.02.0 with a WP85 running release 16 firmware.

Hey all,

Has anyone tried looking for this error in the corresponding firmware tarball (e.g WP85 R16 firmware tarball)? I can’t recall if the source for this component is open source so I may try this tomorrow.

Hey everyone,

I downloaded the tarball for R16 of the WP85 Linux distro (here). Looks like the NMEA driver is exposed to a certain extent. I pasted the source here for easy access: SWI NMEA driver located @ kernel/arch/arm/mach-msm/smd_nmea.c in the tarball · GitHub

Looks like this error is caused when a buffer is filled up and then abandon (as the error message suggests). In particular this snippet is of interest:

for (;;) {
		sz = smd_cur_packet_size(nmea_devp->ch);
		if (sz == 0)
			break;
/* SWISTART */
#ifdef CONFIG_SIERRA_USB_COMP
		if(sz<0)
		{
			printk(KERN_ERR"nmea sz<0 error, sz = %d\n",sz);
			break;
		}
#endif
/* SWISTOP */
		if (sz > smd_read_avail(nmea_devp->ch))
			break;
		if (sz > MAX_BUF_SIZE) {
			smd_read(nmea_devp->ch, 0, sz);
			continue;
		}

		mutex_lock(&nmea_rx_buf_lock);
		if (smd_read(nmea_devp->ch, nmea_devp->rx_buf, sz) != sz) {
			mutex_unlock(&nmea_rx_buf_lock);
			printk(KERN_ERR "nmea: not enough data?!\n");
			continue;
		}
/* SWISTART */
#ifdef CONFIG_SIERRA_USB_COMP
        if((smd_use+sz)<READ_BUF_SIZE)
        {

  		  nmea_devp->bytes_read = sz;
           memcpy((char *)(&smd_buf)+smd_use,nmea_devp->rx_buf,sz);
           smd_use+=sz;
           smd_buf[smd_use]=0;
        }
        else
        {
          printk(KERN_DEBUG "NMEA read driver miss interrupt, abandon current buff\n");
          smd_use=0;

        }
		mutex_unlock(&nmea_rx_buf_lock);
    
          if(smd_use>512)
          {
		    wake_up_interruptible(&nmea_wait_queue);
          }
	}

Based on the source I’m not sure this error needs immediate attention. It should retry again at the start of the buffer (by resetting smd_use when printing that error).

How many requests to the GNSS typically fail? Is it a problem to just retry it?

Hope this is helpful,
Nick

Hello @sathisha,

I verified with the R16.1/R17 of WP85, Even i saw the same error message with or without the gnss fix.

But i don’t think you have to give serious attention to this, As @nvd said this error message is because the nmea read buffer is filled and only just the present read nmea data will be ignored. Also the buffer will be reset after this error i.e., after reading 10KB nmea data.

BTW if you want you can reduce the frequency of this error message and avoid abandoning nmea data by increasing the size of the buffer(smd_buf) in the NMEA driver code of yocto distribution, Currently the size(READ_BUF_SIZE) of the buffer is 10240(10KB). You can try with 20 KB or more to reduce the frequency of the error message.

Also, I think you can fix this error message by modifying the nmea driver code pasted by @nvd( https://gist.github.com/nvandoorn/819245d5231f9dcec312259037400afc ) below . I have not tested with the below change, But you can give a try.

Before modification:

if((smd_use+sz)<READ_BUF_SIZE)
{

   nmea_devp->bytes_read = sz;
       memcpy((char *)(&smd_buf)+smd_use,nmea_devp->rx_buf,sz);
       smd_use+=sz;
       smd_buf[smd_use]=0;
    }
    else
    {
      printk(KERN_DEBUG "NMEA read driver miss interrupt, abandon current buff\n");
      smd_use=0;

    }

After modification:

if((smd_use+sz)<READ_BUF_SIZE)
{

       nmea_devp->bytes_read = sz;
       memcpy((char *)(&smd_buf)+smd_use,nmea_devp->rx_buf,sz);
       smd_use+=sz;
       smd_buf[smd_use]=0;
    }
    else
    {
     // printk(KERN_DEBUG "NMEA read driver miss interrupt, abandon current buff\n");
      smd_use=0;
      nmea_devp->bytes_read = sz;
      memcpy((char *)(&smd_buf)+smd_use,nmea_devp->rx_buf,sz);
      smd_use+=sz;
      smd_buf[smd_use]=0;

    }

Regards,
Muralidhara N.