Skip to content

Delay required after enabling PWMs via udev? #250

@amarburg

Description

@amarburg
  • Platform/operating system: Beaglebone Black rev C, BeagleBoard.org Debian Image 2018-01-28, no capes.

  • Python version (run python -version or python3 -version): Python 2.7.13

  • Error message you are receiving, including any Python exception traces:

Our MWE:

 import Adafruit_BBIO.PWM as PWM
 PWM.start("P9_14",0,10000)

on the first run after reboot, would fail with:

 RuntimeError: Problem with a sysfs file

The second (and all subsequent) runs would work.

Here is the relevant sequence in strace:

stat64("/sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip3/pwm0", 0xbe8dcd28) = -1 ENOENT (No such file or directory)
stat64("/sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip3/pwm-3:0", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
open("/sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip3/pwm-3:0/period", O_RDWR) = -1 EACCES (Permission denied)

The code is failing the stat on line 435, going successfully through the stat in line 441 (middle line), then failing at line 515.

I wondered if there was a delay in udev's operation, I added a 100ms delay (pull request pending) which resolved this issue. I don't think this is the best solution, but it hints at a solution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy