Problems with PWM example from WIKI

Post Reply
Richard Schaefer
Posts: 26
Joined: Wed Oct 11, 2017 9:40 am
languages_spoken: english
ODROIDs: C1, C2, HC1, XU4, N2
Has thanked: 2 times
Been thanked: 1 time
Contact:

Problems with PWM example from WIKI

Post by Richard Schaefer »

I am trying to use:
PWM_E GPIOX.16 Pin:12 pwmchip8 0 Cmd:echo 0 > pwmchip8/export
PWM_F GPIOX.7 Pin:15 pwmchip8 1 Cmd:echo 1 > pwmchip8/export
I get errors:

Code: Select all

root@mfsc-io:~# cd /sys/class/pwm/
root@mfsc-io:/sys/class/pwm# echo 0 > pwmchip8/export
bash: echo: write error: Device or resource busy
root@mfsc-io:/sys/class/pwm# echo 1 > pwmchip8/export 
bash: echo: write error: No such device
root@mfsc-io:/sys/class/pwm# 
This has worked in the past ... Any Ideas ?
I do not see anything useful in the logs.

I do not have any device overlays loaded, and none of the GPIOS are taken:

Code: Select all

root@mfsc-io:/sys/class/pwm# gpio_status
+------+----------+------+---+-------+--- J2 ---+-------+---+------+----------+------+
| GPIO |   Name   | Mode | V | PU/PD | Physical | PU/PD | V | Mode |   Name   | GPIO |
+------+----------+------+---+-------+----++----+-------+---+------+----------+------+
|   -  |     3.3V |   -  | - |    -  |  1 ||  2 |    -  | - |   -  |     5.0V |   -  |
|  493 | I2C2_SDA |   IN | 1 |   P/D |  3 ||  4 |    -  | - |   -  |     5.0V |   -  |
|  494 | I2C2_SCL |   IN | 1 |   P/U |  5 ||  6 |    -  | - |   -  |      GND |   -  |
|  473 | GPIOA.13 |   IN | 0 |   P/D |  7 ||  8 |   P/U | 1 |   IN | UARTB_TX |  488 |
|   -  |      GND |   -  | - |    -  |  9 || 10 |   P/U | 1 |   IN | UARTB_RX |  489 |
|  479 |  GPIOX.3 |   IN | 1 |   P/U | 11 || 12 |   P/U | 1 |   IN | GPIOX_16 |  492 |
|  480 |  GPIOX.4 |   IN | 1 |   P/U | 13 || 14 |    -  | - |   -  |      GND |   -  |
|  483 |  GPIOX.7 |   IN | 1 |   P/U | 15 || 16 |   P/U | 1 |   IN |  GPIOX.0 |  476 |
|   -  |     3.3V |   -  | - |    -  | 17 || 18 |   P/U | 1 |   IN |  GPIOX.1 |  477 |
|  484 |     MOSI |   IN | 1 |   P/U | 19 || 20 |    -  | - |   -  |      GND |   -  |
|  485 |     MISO |   IN | 1 |   P/U | 21 || 22 |   P/U | 1 |   IN |  GPIOX.2 |  478 |
|  487 |     SCLK |   IN | 1 |   P/U | 23 || 24 |   P/U | 1 |   IN |      SS0 |  486 |
|   -  |      GND |   -  | - |    -  | 25 || 26 |   P/D | 0 |   IN |  GPIOA.4 |  464 |
|  474 | I2C3_SDA | ALT2 | 1 |   P/U | 27 || 28 |   P/U | 1 | ALT2 | I2C3_SCL |  475 |
|  490 | GPIOX.14 |   IN | 1 |   P/U | 29 || 30 |    -  | - |   -  |      GND |   -  |
|  491 | GPIOX.15 |   IN | 1 |   P/U | 31 || 32 |   P/D | 0 |   IN | GPIOA.12 |  472 |
|  481 |  GPIOX.5 |   IN | 1 |   P/U | 33 || 34 |    -  | - |   -  |      GND |   -  |
|  482 |  GPIOX.6 |   IN | 0 |   P/D | 35 || 36 |    -  | 0 |   IN | GPIOX.19 |  495 |
|   -  | ADC.AIN0 |   -  | - |    -  | 37 || 38 |    -  | - |   -  | 1.8V REF |   -  |
|   -  |      GND |   -  | - |    -  | 39 || 40 |    -  | - |   -  | ADC.AIN1 |   -  |
+------+----------+------+---+-------+----++----+-------+---+------+----------+------+
+------+-----------+------+---+-------+--- J7 ---+
| GPIO |   Name    | Mode | V | PU/PD | Physical |
+------+-----------+------+---+-------+----------+
|   -  |       GND |   -  | - |    -  |        1 |
|  471 |  GPIOA.11 | ALT1 | 0 |   P/D |        2 |
|   -  |      5.0V |   -  | - |    -  |        3 |
|  460 |   GPIOA.0 |   IN | 0 |   P/D |        4 |
|  462 |   GPIOA.2 |   IN | 0 |   P/D |        5 |
|  461 |   GPIOA.1 |   IN | 0 |   P/D |        6 |
|  463 |   GPIOA.3 |   IN | 0 |   P/D |        7 |
+------+-----------+------+---+-------+----------+
root@mfsc-io:/sys/class/pwm# 

Code: Select all

root@mfsc-io:/sys/class/pwm# gpioinfo
gpiochip0 - 16 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed  "line_mute"  output  active-high [used]
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed      "amlsd"  output  active-high [used]
        line  10:      unnamed        "pwm"  output  active-high [used]
        line  11:      unnamed          "?"  output  active-high [used]
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
gpiochip1 - 86 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed    "usb_hub"  output  active-high [used]
        line  22:      unnamed "usb_hub_en"  output  active-high [used]
        line  23:      unnamed "ffe09080.usb3phy" output active-high [used]
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused  output  active-high
        line  30:      unnamed       unused   input  active-high
          line  31:      unnamed       unused   input  active-high
        line  32:      unnamed       unused   input  active-high
        line  33:      unnamed       unused   input  active-high
        line  34:      unnamed       unused   input  active-high
        line  35:      unnamed       unused   input  active-high
        line  36:      unnamed       unused   input  active-high
        line  37:      unnamed       unused   input  active-high
        line  38:      unnamed      "amlsd"  output  active-high [used]
        line  39:      unnamed       unused   input  active-high
        line  40:      unnamed       unused   input  active-high
        line  41:      unnamed       unused   input  active-high
        line  42:      unnamed       unused   input  active-high
        line  43:      unnamed       unused   input  active-high
        line  44:      unnamed       unused   input  active-high
        line  45:      unnamed       unused   input  active-high
        line  46:      unnamed       unused   input  active-high
        line  47:      unnamed       unused   input  active-high
        line  48:      unnamed      "amlsd"   input  active-high [used]
        line  49:      unnamed       unused   input  active-high
        line  50:      unnamed       unused   input  active-high
        line  51:      unnamed       unused   input  active-high
        line  52:      unnamed       unused   input  active-high
        line  53:      unnamed       unused   input  active-high
        line  54:      unnamed       unused   input  active-high
        line  55:      unnamed       unused   input  active-high
        line  56:      unnamed       unused   input  active-high
        line  57:      unnamed       unused   input  active-high
        line  58:      unnamed       unused   input  active-high
        line  59:      unnamed       unused   input  active-high
        line  60:      unnamed       unused   input  active-high
        line  61:      unnamed       unused   input  active-high
        line  62:      unnamed       unused   input  active-high
        line  63:      unnamed       unused   input  active-high
        line  64:      unnamed       unused   input  active-high
        line  65:      unnamed       unused   input  active-high
        line  66:      unnamed       unused   input  active-high
        line  67:      unnamed       unused   input  active-high
        line  68:      unnamed       unused   input  active-high
        line  69:      unnamed       unused   input  active-high
        line  70:      unnamed       unused   input  active-high
        line  71:      unnamed       unused   input  active-high
        line  72:      unnamed       unused   input  active-high
        line  73:      unnamed       unused   input  active-high
        line  74:      unnamed       unused   input  active-high
        line  75:      unnamed       unused   input  active-high
        line  76:      unnamed       unused   input  active-high
        line  77:      unnamed       unused   input  active-high
        line  78:      unnamed       unused   input  active-high
        line  79:      unnamed       unused   input  active-high
        line  80:      unnamed       unused   input  active-high
        line  81:      unnamed       unused   input  active-high
        line  82:      unnamed       unused   input  active-high
        line  83:      unnamed       unused   input  active-high
        line  84:      unnamed       unused   input  active-high
        line  85:      unnamed       unused   input  active-high
root@mfsc-io:/sys/class/pwm# 

User avatar
odroid
Site Admin
Posts: 36385
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1431 times
Been thanked: 980 times
Contact:

Re: Problems with PWM example from WIKI

Post by odroid »

Can you show us kernel version and lsmod output?

Richard Schaefer
Posts: 26
Joined: Wed Oct 11, 2017 9:40 am
languages_spoken: english
ODROIDs: C1, C2, HC1, XU4, N2
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Problems with PWM example from WIKI

Post by Richard Schaefer »

My previous test was with the same pre-built kernel. The following has a mod to SPI driver to add some debug support.

Code: Select all

root@OdroidDevelop:~# uname -a
Linux OdroidDevelop 4.9.241+ #5 SMP PREEMPT Thu Jan 14 10:19:41 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
root@OdroidDevelop:~# lsmod   
Module                  Size  Used by
cpufreq_ondemand       20480  0
cpufreq_powersave      16384  0
cpufreq_userspace      16384  0
cpufreq_conservative    16384  0
88XXau               2449408  0
i2c_meson_master       20480  0
sch_fq_codel           20480  6
amvdec_vp9            126976  0
amvdec_vc1             65536  0
amvdec_real            45056  0
amvdec_mmpeg4          40960  0
amvdec_mpeg4           65536  0
amvdec_mpeg12         106496  0
amvdec_mmjpeg          32768  0
amvdec_mjpeg           40960  0
amvdec_h265           155648  0
amvdec_h264mvc         61440  0
amvdec_mh264          163840  0
amvdec_h264           147456  0
amvdec_avs             69632  0
stream_input          192512  8 amvdec_h265,amvdec_mh264,amvdec_h264mvc,amvdec_real,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs
decoder_common        200704  14 amvdec_h265,amvdec_mjpeg,amvdec_mh264,amvdec_mmpeg4,amvdec_h264mvc,amvdec_mmjpeg,amvdec_real,stream_input,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs,amvdec_vc1,amvdec_mpeg4
firmware               28672  15 amvdec_h265,amvdec_mjpeg,amvdec_mh264,amvdec_mmpeg4,amvdec_h264mvc,amvdec_mmjpeg,decoder_common,amvdec_real,stream_input,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs,amvdec_vc1,amvdec_mpeg4
media_clock            49152  9 amvdec_h265,amvdec_mh264,decoder_common,firmware,stream_input,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs
ip_tables              28672  0
x_tables               49152  1 ip_tables
ipv6                  516096  24

Code: Select all

root@OdroidDevelop:~# cd /sys/class/pwm/   
root@OdroidDevelop:/sys/class/pwm#             
root@OdroidDevelop:/sys/class/pwm# ls
pwmchip0  pwmchip4  pwmchip8
root@OdroidDevelop:/sys/class/pwm# echo 0 > pwmchip8/export 
-bash: echo: write error: Device or resource busy
root@OdroidDevelop:/sys/class/pwm# echo 1 > pwmchip8/export 
-bash: echo: write error: No such device
root@OdroidDevelop:/sys/class/pwm# 

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 2 guests