Tried these steps now
@RadxaYuntian
My bad. The logs were from Debian 12. Same error is showing in Debian 11 with python3.9.
I have built mraa from source from these steps
git clone -b master https://github.com/radxa/mraa.git
Changed these lines in CMakeLists.txt
-option (BUILDSWIGNODE "Build swig node modules." ON)
+option (BUILDSWIGNODE "Build swig node modules." OFF)
Changed these lines in include/version.h
-const char* gVERSION;
-const char* gVERSION_SHORT;
+extern const char* gVERSION;
+extern const char* gVERSION_SHORT;
Ran these steps with root user
mkdir build
cd build/
cmake ..
make
make install
ldconfig
mraa-gpio shows correct output
root@rock-pi-s:/home/rock/mraa/build# mraa-gpio version
Version v2.1.0-26-gd59936f on Radxa ROCK Pi S
root@rock-pi-s:/home/rock/mraa/build# mraa-gpio list
01 3V3:
02 5V:
03 I2C_SDA: GPIO I2C
04 5V:
05 I2C_SCL: GPIO I2C
06 GND:
07 I2S0_8CH_MC: GPIO
08 UART0_TX: GPIO UART
09 GND:
10 UART0_RX: GPIO UART
11 PWM2,I2C3_S: GPIO I2C PWM
12 I2S0_8CH_SC: GPIO
13 PWM3,I2C3_S: GPIO I2C PWM
14 GND:
15 SPDIF_TX: GPIO
16 I2S0_8CH_SD: GPIO
17 3V3:
....
...
...
Enabled pwm3 from rsetup

After this tried initialising pwm and gpio with python mraa, and same error is showing
>>> import mraa
>>> pin = mraa.Pwm(13)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/mraa.py", line 511, in __init__
_mraa.Pwm_swiginit(self, _mraa.new_Pwm(pin, owner, chipid))
ValueError: Error initialising PWM on pin
>>> pin = mraa.Gpio(32)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/mraa.py", line 420, in __init__
_mraa.Gpio_swiginit(self, _mraa.new_Gpio(pin, owner, raw))
ValueError: Invalid GPIO pin specified
Sep 04 07:10:34 rock-pi-s libmraa[5717]: libmraa version v2.1.0-26-gd59936f initialised by user 'root' with EUID 0
Sep 04 07:10:34 rock-pi-s libmraa[5717]: gpio: platform doesn't support chardev, falling back to sysfs
Sep 04 07:10:34 rock-pi-s libmraa[5717]: libmraa initialised for platform 'Radxa ROCK Pi S' of type 25
Sep 04 07:10:42 rock-pi-s libmraa[5717]: pwm_init: pwm0. Failed to open export for writing: No such file or directory
Sep 04 07:10:52 rock-pi-s libmraa[5717]: gpio79: init: Failed to open 'export' for writing: No such file or directory
I installed image b38 tag from the rockpi-s build releases - https://github.com/radxa-build/rock-pi-s/releases.
root@rock-pi-s:/home/rock# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
My objective is to access gpio, pwm etc. via mraa python in the most updated debian image for rock pi-s.
We are currently using the oldest official radxa rock pi s image from the wiki downloads but we want an image with the updated kernel.
We are using rock pi-s for our fleet of IoT-controllers and we are stuck in this. Your help will be highly appreciated.
Can you please provide answers to the following questions?
- Since the wiki is not being maintained, Is there an updated documentation on how to use the latest builds with proper steps for mraa installation?
- Is it possible to use mraa with python bindings in the Debian 11?
- If yes, then what am I doing wrong, how to fix the above error and what are the right steps to install mraa?
- What is the fully tested official debian image which is tested with mraa?