Find the answer to your Linux question:
Results 1 to 6 of 6
I'm trying to do sysfs read using a blocking call on a BBB after setting edge mode, but the value register keeps presenting the current value so the reads never ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2014
    Posts
    3

    angstrom gpio does not block on gpio read


    I'm trying to do sysfs read using a blocking call on a BBB after setting edge mode, but the value register keeps presenting the current value so the reads never block. I thought if you set the edge mode to say 'rising' the file system (user space) would only read when the value changes.

  2. #2
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,201
    If it supports interrupts - which beagle bone does. Perhaps this will help: Using the GPIO ports - BeagleBone

  3. #3
    Just Joined!
    Join Date
    Mar 2014
    Posts
    3
    I read that, thanks. But you can't test interrupts that way. I used a Java file read and it just runs forever, reporting new values as I change the pin voltage, but also re-reporting existing values. It just does not wait for a change in value. That means the existing value is always available for read, which shoud not be the case if edge is set to other than 'none'.

  4. #4
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,201
    No it doesn't but it does tell you how to set the pin to edge. It also says that once it is set if you do a blocking read it will wait for data. It's been years since I programmed in Java but if memory serves stream io is blocking so if you aren't blocking on the read (i.e. returning eof) then it may be that the pin isn't getting set or your not using a blocking read.

  5. #5
    Just Joined!
    Join Date
    Mar 2014
    Posts
    3
    I agree with you, but I have used Java long enough to do a reliable blocking read and this one doesn't work.
    I am curious why nobody using C can do a simple blocking read either; they all use poll(). Poll() doen't ring like
    a speedy construct for interrupts. I'm trying to get a 1 msec interrupt detection speed. If I have to pipe to C I'm going to lose.

  6. #6
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,201
    Actually poll allows you to wait on multiple conditions. It's very efficient.

    If you're sure the issue isn't with Java then I'd suggest it's the configuration of the pin that's at issue. Have you look in your kernels documentation for gpio.txt? For mine it's found linux-source-3.11.0/Documentation/gpio.txt.

    There's some info in there that might help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •