* RTC with TQM823L
@ 2005-03-17 7:47 Jean Nicollerat MD
2005-03-17 8:23 ` Jaap-Jan Boor
2005-03-17 8:34 ` Wolfgang Denk
0 siblings, 2 replies; 6+ messages in thread
From: Jean Nicollerat MD @ 2005-03-17 7:47 UTC (permalink / raw)
To: linuxppc-embedded
Hello,
I need to have an interrup every 10ms in my application running in linux.
I have a PowerPC 823 on the board TQM823L LCD from denx.
I use the ocan driver.
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) */
retval = ioctl(fd, RTC_UIE_ON, 0);
if (retval == -1) {
perror("ioctl");
//exit(errno);
}
I get an error message :
ioctl : invalide argument # for then line :"retval = ioctl(fd, RTC_UIE_ON,
0);"
Can somebody help ? why it is not working or a better way to get function
called each 10ms
Thanks
Jean
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RTC with TQM823L
2005-03-17 7:47 RTC with TQM823L Jean Nicollerat MD
@ 2005-03-17 8:23 ` Jaap-Jan Boor
2005-03-17 8:34 ` Wolfgang Denk
1 sibling, 0 replies; 6+ messages in thread
From: Jaap-Jan Boor @ 2005-03-17 8:23 UTC (permalink / raw)
To: Jean Nicollerat MD; +Cc: linuxppc-embedded
Can't you use a cpmtimer to fire every 10ms and wakeup a
high priority thread?
Jaap-Jan
On 17-mrt-05, at 8:47, Jean Nicollerat MD wrote:
> Hello,
> I need to have an interrup every 10ms in my application running in
> linux.
> I have a PowerPC 823 on the board TQM823L LCD from denx.
> I use the ocan driver.
> 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) */
>
> retval = ioctl(fd, RTC_UIE_ON, 0);
> if (retval == -1) {
> perror("ioctl");
> //exit(errno);
> }
>
> I get an error message :
> ioctl : invalide argument # for then line :"retval = ioctl(fd,
> RTC_UIE_ON,
> 0);"
>
> Can somebody help ? why it is not working or a better way to get
> function
> called each 10ms
>
> Thanks
>
> Jean
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RTC with TQM823L
2005-03-17 7:47 RTC with TQM823L Jean Nicollerat MD
2005-03-17 8:23 ` Jaap-Jan Boor
@ 2005-03-17 8:34 ` Wolfgang Denk
2005-03-17 9:27 ` Jean Nicollerat MD
1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2005-03-17 8:34 UTC (permalink / raw)
To: Jean Nicollerat MD; +Cc: linuxppc-embedded
In message <HMECJAKDCPLOGPDHNAHECEKFCAAA.jean.nicollerat@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@denx.de
The trouble with our times is that the future is not what it used to
be. - Paul Valery
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: RTC with TQM823L
2005-03-17 8:34 ` Wolfgang Denk
@ 2005-03-17 9:27 ` Jean Nicollerat MD
2005-03-17 10:39 ` Wolfgang Denk
2005-03-17 21:36 ` Murray Jensen
0 siblings, 2 replies; 6+ messages in thread
From: Jean Nicollerat MD @ 2005-03-17 9:27 UTC (permalink / raw)
To: wd; +Cc: Linuxppc-Embedded
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@denx.de [mailto:wd@denx.de]
Sent: Thursday, March 17, 2005 9:34 AM
To: Jean Nicollerat MD
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: RTC with TQM823L
In message <HMECJAKDCPLOGPDHNAHECEKFCAAA.jean.nicollerat@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@denx.de
The trouble with our times is that the future is not what it used to
be. - Paul Valery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RTC with TQM823L
2005-03-17 9:27 ` Jean Nicollerat MD
@ 2005-03-17 10:39 ` Wolfgang Denk
2005-03-17 21:36 ` Murray Jensen
1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2005-03-17 10:39 UTC (permalink / raw)
To: Jean Nicollerat MD; +Cc: Linuxppc-Embedded
In message <HMECJAKDCPLOGPDHNAHEAEKHCAAA.jean.nicollerat@microdev.ch> you wrote:
>
> I'm used to program on processor without OS. I want try linux to use linux
That was what I expected from your posting.
> 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.
Ok.
> I need a timer to the check the reception of the messages.
No. This is fundamentally wrong. You do NOT need a timer to check if
a device driver has data available.
This is exactly what I meant when sayin you will have to get used to
working in a Unix environment., Under Unix, you will not use a time
triggered control loops which polls all your drivers, but you will
use select() or poll() to wait for events from your drivers. It's the
incoming data which triggers your control loop, not a timer.
> I seem it is difficult with linux. I will try with the RTAI.
DO NOT DO IT. This will only make things worse. You are on the wrong
track. Don't try to stick with a software design which does not fit
any more. Change your design to take advantage of the services
provided by a Unix operating system.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Never call a man a fool. Borrow from him.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: RTC with TQM823L
2005-03-17 9:27 ` Jean Nicollerat MD
2005-03-17 10:39 ` Wolfgang Denk
@ 2005-03-17 21:36 ` Murray Jensen
1 sibling, 0 replies; 6+ messages in thread
From: Murray Jensen @ 2005-03-17 21:36 UTC (permalink / raw)
To: Jean Nicollerat MD; +Cc: Linuxppc-Embedded
At 08:27 PM 17/03/2005, Jean Nicollerat MD wrote:
>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.
Sounds like a simple device driver would handle this.
>I need a timer to the check the reception of the messages.
Could this be done by setting a timeout which you keep rescheduling?
Note that the standard clock tick on linux has 10ms resolution - i.e. 100Hz.
You might want to increase this to 1000Hz (i.e. 1ms resolution). I have read
of people doing this in this list.
>I seem it is difficult with linux.
No, its not difficult at all - its very easy. There is a learning curve
though, just
like anything. Cheers!
Murray...
--
Murray Jensen, CSIRO Manufacturing & Infra. Tech. Phone: +61 3 9662 7763
Locked Bag No. 9, Preston, Vic, 3072, Australia. Fax: +61 3 9662 7853
Internet: Murray.Jensen@csiro.au
To the extent permitted by law, CSIRO does not represent, warrant and/or
guarantee that the integrity of this communication has been maintained or
that the communication is free of errors, virus, interception or interference.
The information contained in this e-mail may be confidential or privileged.
Any unauthorised use or disclosure is prohibited. If you have received this
e-mail in error, please delete it immediately and notify Murray Jensen on
+61 3 9662 7763. Thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-03-17 10:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-17 7:47 RTC with TQM823L Jean Nicollerat MD
2005-03-17 8:23 ` Jaap-Jan Boor
2005-03-17 8:34 ` Wolfgang Denk
2005-03-17 9:27 ` Jean Nicollerat MD
2005-03-17 10:39 ` Wolfgang Denk
2005-03-17 21:36 ` Murray Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).