[ntp:questions] NTP NMEA driver

rajputajay84 at gmail.com rajputajay84 at gmail.com
Tue Mar 11 12:35:40 UTC 2014


Dear Sir,

Thanks for all suggestion to all.
I am able to synchronize properly Beaglebone with NMEA serial frame and 1pps from GPS receiver. Below shown in output.

root at am335x-evm:/bin# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oGPS_NMEA(0)     .GPS.            0 l    1   16  377    0.000   -0.013   0.031

Problem was that there was not timepps.h file present in /usr/include due to which it was detecting nmea frame only.

But, now i want to read the system time at every 1pps interrupt. 
I tried with using function 
do_gettimeofday(&m_now);
time_to_tm(m_now.tv_sec,0,&m_systime);

It works but sometime there is repeat in seconds at 1pps. I am not understanding the issue. i am using signal method to transmit signal from kernel module to user space program at every 1pps.

Details are given below:

kernel module:

void pps_rcvd_function(void)
{

	//printk("PPSTIMER: PPS rcvd\n");
	int ret_pps;
	int temp_year=0,temp_mon=0;
	if (interrupt_signal_flag == 1)
	{	
ret_pps = send_sig_info(SIG_TEST, &info, current_task);    //send the signal	
}

static long m_ppstimer_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
switch (cmd)
{
case CLOCK_READ:
	
	do_gettimeofday(&m_now);
	time_to_tm(m_now.tv_sec,0,&m_systime);	
	//time1 = systime;				
	copy_to_user((struct m_system_time *)arg,&m_systime, sizeof(struct m_system_time));
	break;
default:
	printk(KERN_ALERT "ppstimer - wrong command:\n");
	break;
}
return 0;
}

User space:

void receiveData(int n, siginfo_t *info, void *unused) {
	//printf("PPSTIMER=received value %i\n", info->si_int);
	ioctl(fd, CLOCK_READ, &user_time);
	pps_flag_signal = 1;
		printf("User Space Time: %02d:%02d:%02d %02d/%02d/%02d \n", user_time.hour,user_time.min,user_time.sec,user_time.mday,(user_time.mon+1), (1900+user_time.year));
	
}

receiveData function is my signal handler at user space.

I am concern if it is problem that the system time dosen-t get updated sometimes at 1pps signal receive at assert level.
I will appreciate if any suggestion.





Thanks & Regards
Ajay



More information about the questions mailing list