RTC with TQM823L

Jean Nicollerat MD jean.nicollerat at microdev.ch
Thu Mar 17 20:27:07 EST 2005


Thanks for your answer.
I'm used to program on processor without OS. I want try linux to use linux
to have have LCD, ethernet, USB, ... , dirvers.
I have to read message that comme on the CAN bus every 2ms. Then I have to
show values on the LCD and transfers some message on the RS232.
I need a timer to the check the reception of the messages.
I seem it is difficult with linux. I will try with the RTAI.

regards
Jean Nicollerat

regards
-----Original Message-----
From: wd at denx.de [mailto:wd at denx.de]
Sent: Thursday, March 17, 2005 9:34 AM
To: Jean Nicollerat MD
Cc: linuxppc-embedded at ozlabs.org
Subject: Re: RTC with TQM823L


In message <HMECJAKDCPLOGPDHNAHECEKFCAAA.jean.nicollerat at microdev.ch> you
wrote:
>
> I need to have an interrup every 10ms in my application running in linux.

This is  an  oxymoron.  Interrups  are  processed  in  kernel  space,
applications  are running in userspace. You cannot process interrupts
in aplication code.

> I try to use the RTC modules but with the code :
>
> 	fd = open ("/dev/rtc", O_RDONLY);
>
> 	if (fd ==  -1) {
> 		perror("/dev/rtc");
> 	}
> 	/* Turn on update interrupts (one per second) */

You mentioned you wanted signals (not interrupts) every 10  millisec,
not every second -- what exactly is it that you want?

> 	retval = ioctl(fd, RTC_UIE_ON, 0);
...
>   ioctl : invalide argument # for then line :"retval = ioctl(fd,
RTC_UIE_ON,
> 0);"

Which means that the driver does not support this ioctl.

> Can somebody help ? why it is not working or a better way to get function
> called each 10ms

You can use setitimer. But be  warned.  Your  requirement  of  having
signals  every  10 milliseconds means that there is a serious problem
with your software design. You  are  doing  someting  really,  really
wrong.  To  me  it  sounds  as if you try to implement your own timer
based control loop in user space with an insane  smapp  period.  This
will  never  work  reliably (as there is no guarantee that your tasks
will be scheduled in time), and will waste a lot of CPU power.

Never take existing software  designs  from  other  operating  system
environments  and  put them without thinking into a Unix environment.
Often there are much better and more efficient approaches in Unix.


Just in case you really must stick with that 10  millisecond  raster:
in  this  case  you  will  probably have to use RTAI (especially on a
resource-limted CPU like the 823).

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The trouble with our times is that the future is not what it used  to
be.                                                     - Paul Valery





More information about the Linuxppc-embedded mailing list