Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 04-11-2018, 03:20 AM   #1
LQ Newbie
Registered: Apr 2018
Posts: 3

Rep: Reputation: Disabled
Question Ti AM335x -- Embedded Linux -- Interrupts

Dear all,

Short intro of my problem. On my embedded system I'm reading receiving and sending can messages. For those can messages there needs to be a timed sequence.

I have more experience with microcontrollers, where you have the abbility to make use of time based interrupts. So my first though is, let's used time based interrupts to time can messages. I don't know if it is even possible to do this in embedded Linux.

So I will briefly explain the can sequence.

1 -> cansend 712#00
2 -> Wait until can message 000#01.12 is received
3 -> Wait until can message 712#1B is received. At the same time, run a timer of 0.06s .

--> if can message 712#1B is received --> send 712#05
--> if timer with 0.06s is finished, interrupt everything and send can message

So how should I program the "time based interrupt" if possible.

Thanks in advance,
Kind regards,

Last edited by TMJJ; 04-11-2018 at 03:37 AM.
Old 04-17-2018, 03:52 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Under embedded Linux you can do it easily. The only difference with RTOS is that you don't fire an interrupt directly. You just says Linux that you want some work to be done at certain time.

An example of what you can do: create a workqueue for all type of delayed work and when you want to run a timer you use:

* queue_delayed_work - queue work on a workqueue after delay
* @wq: workqueue to use
* @dwork: delayable work to queue
* @delay: number of jiffies to wait before queueing
* Equivalent to queue_delayed_work_on() but tries to use the local CPU.
static inline bool queue_delayed_work(struct workqueue_struct *wq,
struct delayed_work *dwork,
unsigned long delay)
return queue_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay);

As a comment, to convert from jiffies to seconds it's enough to know that HZ is one second in jiffies. You can divide it to get the delay you want.
Old 04-26-2018, 03:01 AM   #3
Registered: Jan 2013
Location: Netherlands
Distribution: XUbuntu
Posts: 57

Rep: Reputation: Disabled

If you have tight timing requirements I would advise you to use the realtime kernel instead.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Panel computer runs Linux or Android on AM335x SoC LXer Syndicated Linux News 0 03-23-2015 09:20 PM
LXer: Tiny Linux-based AM335x COMs can freeze or fry LXer Syndicated Linux News 0 11-02-2014 12:44 AM
compiling u-boot for AM335x => /bin/bash: arm-none-linux-gnueabi-gcc: command not fou brentw Linux - Embedded & Single-board computer 3 08-24-2014 12:03 PM
LXer: Very tiny SODIMM-style COM runs Linux on AM335x LXer Syndicated Linux News 0 10-12-2013 08:04 PM
Interrupts and Signals in embedded linux zigma.dsp Linux - Embedded & Single-board computer 0 05-12-2009 01:55 PM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration