orangepi-xunlong / wiringOP

wiringPi for Orange Pi
GNU Lesser General Public License v3.0
394 stars 189 forks source link

The gpio directive sets pwm invalid? #112

Open chcmq opened 2 months ago

chcmq commented 2 months ago
My rk3566 development board has two more pwm, respectively pwm11(PWM11_M0),pwm14(PWM14_M0);

 wiringPi.h seems to define only RK3566_PWM2_BASE, RK3566_PWM3_BASE; How to make it support other pwm?

error log


[root@Nscreen64p:/home]# gpio pwm 2 1   
wiringPi: wiringPiSetup called
piBoardId: Revision string: BOARD=nscreen64p-sbc

piBoardId: Board string: nscreen64p-sbc.
piBoardId: model = 42
read 0xbf from [0xfdc20144]
read 0 from [0]
>>functionsunxi_pwm_set_mode,no:2691,mode? :0x0
write 0 to [0]
read 0 from [0]
read 0 from [0]
SUNXI_PWM_CTRL_REG: [0]
SUNXI_PWM_PERIOD: [0]
read 0 from [0]
gpio: CCR should be less than or equal to ARR (0)

 +------+-----+------------+--------+---+   NSBC   +---+--------+-----------+-----+------+
 | GPIO | wPi |   Name     |  Mode  | V | Physical | V |  Mode  | Name      | wPi | GPIO |
 +------+-----+------------+--------+---+----++----+---+--------+-----------+-----+------+
 |      |     |     3.3V   |        |   |  1 || 2  |   |        | 5V        |     |      |
 |   32 |   0 |    SDA.3   |     IN | 1 |  3 || 4  |   |        | 5V        |     |      |
 |   33 |   1 |    SCL.3   |     IN | 1 |  5 || 6  |   |        | GND       |     |      |
 |  116 |   2 | PWM14      |     IN | 0 |  7 || 8  | 1 | ALT1   | RXD.2     | 3   | 25   |
 |      |     |      GND   |        |   |  9 || 10 | 1 | ALT1   | TXD.2     | 4   | 24   |
 |   97 |   5 | GPIO3_A1   |     IN | 0 | 11 || 12 | 0 | IN     | GPIO3_A3  | 6   | 99   |
 |   98 |   7 | GPIO3_A2   |     IN | 0 | 13 || 14 |   |        | GND       |     |      |
 |      |     |  ADC_IN1   |        |   | 15 || 16 | 1 | ALT4   | RXD.4     | 8   | 105  |
 |      |     |     3.3V   |        |   | 17 || 18 | 1 | ALT4   | TXD.4     | 9   | 106  |
 |  147 |  10 | I2S3_SCLK1 |     IN | 0 | 19 || 20 |   |        | GND       |     |      |
 |  149 |  11 | I2S3_SDO1  |     IN | 0 | 21 || 22 | 0 | IN     | GPIO3_B5  | 12  | 109  |
 |  146 |  13 | I2S3_MCLK1 |     IN | 0 | 23 || 24 | 0 | IN     | I2S3_SDI1 | 14  | 150  |
 |      |     |      GND   |        |   | 25 || 26 |   |        | ADC_IN2   |     |      |
 |  108 |  15 |    SDA.5   |     IN | 1 | 27 || 28 | 1 | IN     | SCL.5     | 16  | 107  |
 |  117 |  17 |  SPDIF_TX1 |     IN | 0 | 29 || 30 |   |        | GND       |     |      |
 |  110 |  18 | PWM11      |     IN | 0 | 31 || 32 | 0 | IN     | GPIO3_B7  | 19  | 111  |
 |  112 |  20 | GPIO3_C0   |     IN | 0 | 33 || 34 |   |        | GND       |     |      |
 |  100 |  21 | GPIO3_A4   |     IN | 0 | 35 || 36 | 0 | IN     | GPIO3_A7  | 22  | 103  |
 |  104 |  23 | GPIO3_B0   |     IN | 0 | 37 || 38 | 0 | IN     | GPIO3_A6  | 24  | 102  |
 |      |     |      GND   |        |   | 39 || 40 | 0 | IN     | GPIO3_A5  | 25  | 101  |
 +------+-----+------------+--------+---+----++----+---+--------+-----------+-----+------+
 | GPIO | wPi |   Name     |  Mode  | V | Physical | V |  Mode  | Name      | wPi | GPIO |
 +------+-----+------------+--------+---+   NSBC   +---+--------+-----------+-----+------+
It is possible that I understand wrong, but now the pwm does not work properly, how should this be solved?

My pwm11 is PWM11_IR_M0 which is gpio nubmer for 110, if I change gpio nubmer to 144 and it is PWM11_IR_M1 then I can control the pwm normally