Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Gpio 'interrupt'
QtWS25 Last Chance

Gpio 'interrupt'

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 5.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    f.vanalmetelevic.com
    wrote on last edited by
    #1

    Hi,

    On our i.MX27 based device, we have another device that is coupled on one of the gpio's of the processor. I manage to read the input via /sys/class/gpio/gpioXXX/value. I'm detect changes on the input by polling the 'value' file. However, the connected device is e.g. sending heartbeat pulses of about 16 usec, every 100msec . To detect them, I have to perform polling very fast, resulting in high (and not acceptable) processor loads. The goal is to have a kind of interrupt : when the input changes, I have to emit a signal to indicate the detection of a rising/falling edge of the signal on the input. Can I do this in another way ? Not using polling, but a kind of blocking read of the gpio file ? Anyone has done this already within qt ?

    (I tried with the readyRead signal of QFile(QIODevice), but the connected slot was never called. Probably because there's no data appended to the gpio file, the content of the file - one byte - gets only modified).

    Thanks for any help !

    Filip

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      Probably "QFileSystemWatcher":http://developer.qt.nokia.com/doc/qt-4.8/qfilesystemwatcher.html is what you are looking for, but I cannot guarantee that it works (reliable) with /sys/class/gpio. If not, the next step downwards would be inotify resp. poll / select.

      However, 16 µsec can be a very short timeframe, especially if there is additional load. So if catching the heartbeat is vital, you might even go one step futher downwards and directly utilize the interrupt controller, which for sure supports at least one GPIO interrupt.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        f.vanalmetelevic.com
        wrote on last edited by
        #3

        Thanks for the information.

        I tried with QFileSystemWatcher, but without success. The slot connected to it never gets called although the heartbeat pulses are present on the input. I guess it does not really check on modification of the content of the file. I think the 'value' file I read is a kind of special file, because even if the content changes, the file date seems never be updated. To the user, it looks like the file never changes. And probably because of this, QFileSystemWatcher, never detects modifications.
        I noticed, in the same directory /sys/class/gpio/gpioxxx/, a file called uevent. I have to investigate what this file can be used for. Have no experience with it. It looks like something to report events on that input, so maybe that's what I'm looking for...
        Of course, I will also investigate the other ideas you mentioned.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          [quote author="filip" date="1326814262"]
          I will also investigate the other ideas you mentioned.[/quote]

          Make sure you've read the "documentation":http://kernel.org/doc/Documentation/gpio.txt first.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved