TCB13

  • Posts

    65
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Portugal

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TCB13's Achievements

  1. Maybe this is related to this: I'm also experiencing similar issues with a NanoPi M4v2 here: Have you found a solution @IvanD? It seems like there are regular issues around 1 wire in Rockchip boards.
  2. TCB13

    Rock PI 4

    I was trying to accomplish the same... however after enabling the w1-gpio overlay I get this: :~# dmesg | grep wire [ 6.696830] Driver for 1-wire Dallas network protocol. [ 6.702902] gpio-36 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file [ 6.703002] OF: /onewire@0: could not get #gpio-cells for /vop@ff8f0000/port/endpoint@2 [ 6.703013] w1-gpio onewire@0: gpio_request_one (ext_pullup_enable_pin) failed [ 6.703069] w1-gpio: probe of onewire@0 failed with error -22 I also tried to add "param_w1_pin=GPIO1_C7" in order to have it working at physical pin 18 / gpio 55 without luck. Strangely enough I still get the same error about gpio-36 (GPIO1_A4) after adding that line... ~# cat /sys/kernel/debug/gpio gpiochip0: GPIOs 0-31, parent: platform/pinctrl, gpio0: gpio-1 ( |vcc3v0-sd ) out hi gpio-4 ( |host-wakeup ) in lo gpio-5 ( |GPIO Key Power ) in hi ACTIVE LOW gpio-7 ( |cd ) in hi ACTIVE LOW gpio-9 ( |shutdown ) out hi gpio-10 ( |reset ) out hi ACTIVE LOW gpio-13 ( |status_led ) out lo gpiochip1: GPIOs 32-63, parent: platform/pinctrl, gpio1: gpiochip2: GPIOs 64-95, parent: platform/pinctrl, gpio2: gpio-68 ( |ep ) out hi gpio-90 ( |device-wakeup ) out lo gpiochip3: GPIOs 96-127, parent: platform/pinctrl, gpio3: gpio-111 ( |PHY reset ) out hi ACTIVE LOW gpiochip4: GPIOs 128-159, parent: platform/pinctrl, gpio4: I'm currently wiring the sensor to my NanoPi M4v2 with a 4.7k resistor, similar to this: System: 5.10.63-rockchip64 #21.08.2 SMP PREEMPT Wed Sep 8 10:57:23 UTC 2021 aarch64 GNU/Linux Anyone has tips? Thank you.
  3. I finally managed to get this work. Things I was doing wrong: Not using the OPi.GPIO replacement library - others aren't compatible with the NanoPi M4; DIN LCD pin was connected to the SBC RXD instead of TXD; Passed wrong pin numbers to the libraries (should be the real physical pins numers); Mistaking SPI port with device... Here the full guide on how to it properly. Start by installing: apt-get install python3 python3-pip python3-pil libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libopenjp2-7 libtiff5 -y pip3 install luma.oled apt-get remove python3-rpi.gpio rpi.gpio-common pip3 install --upgrade OPi.GPIO Wire up your LCD as: MISO > GPIO1_B0 > SPI1_TXD > 19 > LCD DIN | Blue SCK > GPIO1_B1 > SPI1_CLK > 23 > LCD CLK | Yellow CS > GPIO1_B2 > SPI1_CSn0 > 24 > LCD CS | Orange RST > GPIO1_A1(3V) > M4 Pin 11 > LCD RST Pin | White DC > GPIO1_A3(3V) > M4 Pin 13 > LCD DC Pin | Green Download an run an example: git clone https://github.com/rm-hull/luma.examples.git python3 luma.examples/examplebounce.py --display=ssd1351 \ --interface=spi \ --width=128 --height=128 \ --spi-bus-speed=50000000 \ --spi-device=0 \ --spi-port=1 \ --gpio-reset=11 \ --gpio-data-command=13 \ --gpio OPi.GPIO \ --gpio-mode nanopi.m4.BOARD And you should get something like this: It seems to be able to drive the display up to around 45fps without noises like I've experienced before in an Arduino. Enjoy.
  4. Following my lack of knowledge of the subject I found out another GPIO implementation that seems to have mappings for the NanoPi M4 called OPi.GPIO. Rewired the LCD, I was unsure about the GPIO pin I picked for the DC pin: MOSI > GPIO1_A7 > SPI1_RXD > M4 Pin 21 > LCD DIN Pin (blue) SCK > GPIO1_B1 > SPI1_CLK > M4 Pin 23 > LCD CLK Pin (yellow) CS > GPIO1_B2 > SPI1_CSn0 > M4 Pin 24 > LCD CS Pin (orange) RST > GPIO1_A1(3V) > M4 Pin 11 > LCD RST Pin (white) DC > GPIO1_A3(3V) > M4 Pin 13 > LCD DC Pin (green) Installed and run the thing without much success: pip3 install --upgrade OPi.GPIO ls /dev/spi* /dev/spidev1.0 python3 luma.examples/examples/3d_box.py \ --display=ssd1351 \ --interface=spi \ --width=128 --height=128 \ --spi-bus-speed=16000000 \ --bgr \ --spi-device=1 --spi-port=0 \ --gpio-reset=35 \ --gpio-data-command=33 \ --gpio OPi.GPIO \ --gpio-mode nanopi.m4.BOARD Traceback (most recent call last): File "luma.examples/examples/3d_box.py", line 129, in <module> device = get_device() File "/root/luma.examples/examples/demo_opts.py", line 61, in get_device device = cmdline.create_device(args) File "/usr/local/lib/python3.7/dist-packages/luma/core/cmdline.py", line 246, in create_device device = Device(serial_interface=interface(), **params) File "/usr/local/lib/python3.7/dist-packages/luma/core/cmdline.py", line 161, in spi gpio=self.gpio or GPIO) File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 299, in __init__ bitbang.__init__(self, gpio, transfer_size, reset_hold_time, reset_release_time, DC=gpio_DC, RST=gpio_RST) File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 187, in __init__ self._DC = self._configure(kwargs.get("DC")) File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 200, in _configure self._gpio.setup(pin, self._gpio.OUT) File "/usr/local/lib/python3.7/dist-packages/OPi/GPIO.py", line 470, in setup pin = get_gpio_pin(_mode, channel) File "/usr/local/lib/python3.7/dist-packages/OPi/pin_mappings.py", line 80, in get_gpio_pin return _pin_map[mode][channel] KeyError: 33 From what I understand of https://github.com/rm-hull/OPi.GPIO/blob/master/nanopi/m4.py my physical pin 11 maps to GPIO 33 and physical pin 13 to GPIO 35. Is this even correct? Either way it still fails.
  5. Now unfortunately luma-oled seems to be yet another problem. I wired up my LCD as: MOSI > GPIO1_A7 > SPI1_RXD > M4 Pin 21 > LCD DIN Pin (blue) SCK > GPIO1_B1 > SPI1_CLK > M4 Pin 23 > LCD CLK Pin (yellow) CS > GPIO1_B2 > SPI1_CSn0 > M4 Pin 24 > LCD CS Pin (orange) DC > GPIO1_A0(3V) > M4 Pin 7 > LCD DC Pin (green) RST > GPIO1_A1(3V) > M4 Pin 11 > LCD RST Pin (white) Display: https://www.ebay.com/itm/203101646517 Datasheet: https://www.waveshare.com/w/upload/5/5b/1.5inch_RGB_OLED_Module_User_Manual_EN.pdf From my understanding I had to get GPIO1_A0 and GPIO1_A1 in the system so the lib could use them. According to this https://hev.cc/2927.html GPIO mapping I tried: ls -la /dev/spi* crw------- 1 root root 153, 0 Sep 16 18:51 /dev/spidev1.0 echo 32 > /sys/class/gpio/export echo 33 > /sys/class/gpio/export ls -la /sys/class/gpio/ total 0 drwxr-xr-x 2 root root 0 Jan 18 2013 . drwxr-xr-x 76 root root 0 Jan 18 2013 .. --w--w---- 1 root dialout 4096 Sep 16 20:51 export lrwxrwxrwx 1 root root 0 Sep 16 20:50 gpio32 -> ../../devices/platform/pinctrl/gpiochip1/gpio/gpio32 lrwxrwxrwx 1 root root 0 Sep 16 20:50 gpio33 -> ../../devices/platform/pinctrl/gpiochip1/gpio/gpio33 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip0 -> ../../devices/platform/pinctrl/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip128 -> ../../devices/platform/pinctrl/gpio/gpiochip128 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip32 -> ../../devices/platform/pinctrl/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip64 -> ../../devices/platform/pinctrl/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip96 -> ../../devices/platform/pinctrl/gpio/gpiochip96 --w--w---- 1 root dialout 4096 Sep 16 19:19 unexport Now I tried the luma-oled examples (running as root): python3 3d_box.py --display ssd1351 --interface spi --spi-port 0 --spi-device 1 --gpio-reset 33 --gpio-data-command 32 --width 128 --height 128 usage: 3d_box.py >(....) 3d_box.py: error: GPIO access not available I'm not even sure if this part "--gpio-reset 33 --gpio-data-command 32" is correct. I've tried both the virtual pin number and the hardware number without luck. Also tried to install https://github.com/friendlyarm/RPi.GPIO_NP without much luck: apt-get update apt-get install python-dev git clone https://github.com/friendlyarm/RPi.GPIO_NP cd RPi.GPIO_NP python3 setup.py install python3 setup.py install python3 luma.examples/examples/3d_box.py --display=ssd1351 --interface=spi --width=128 --height=128 --spi-bus-speed=16000000 --bgr --spi-device=1 --spi-port=0 --gpio-reset=33 --gpio-data-command=32 --gpio RPi.GPIO Traceback (most recent call last): (...) RuntimeError: It is not NanoPi based board.
  6. @piter75, Your comment was crucial to fix my "issue". I enabled the overlay and then as described on the file edited `/boot/armbianEnv.txt` in order to include: param_spidev_spi_bus=1 param_spidev_max_freq=100000000 Now the SPI shows up: ~# ls -la /dev/spi* crw------- 1 root root 153, 0 Sep 16 18:51 /dev/spidev1.0 Also passes the spidev_test (https://raw.githubusercontent.com/torvalds/linux/master/tools/spi/spidev_test.c) ~# ./spidev_test spi mode: 0x0 bits per word: 8 max speed: 500000 Hz (500 kHz) (Had to adjust the path) Thank you for the tip!
  7. I've been using the following table with the M4v2: ------+-----+----------+------+ Model NanoPi-M4 +------+----------+-----+------+ | GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO | +------+-----+----------+------+---+----++----+---+------+----------+-----+------+ | | | 3.3V | | | 1 || 2 | | | 5V | | | | | | I2C2_SDA | | | 3 || 4 | | | 5V | | | | | | I2C2_SCL | | | 5 || 6 | | | GND(0V) | | | | 32 | 7 | GPIO1_A0 | OUT | 0 | 7 || 8 | | ALT | GPIO4_C1 | 15 | 145 | | | | GND(0V) | | | 9 || 10 | | ALT | GPIO4_C0 | 16 | 144 | | 33 | 0 | GPIO1_A1 | IN | 0 | 11 || 12 | 1 | IN | GPIO1_C2 | 1 | 50 | | 35 | 2 | GPIO1_A3 | IN | 0 | 13 || 14 | | | GND(0V) | | | | 36 | 3 | GPIO1_A4 | IN | 0 | 15 || 16 | 0 | IN | GPIO1_C6 | 4 | 54 | | | | 3.3V | | | 17 || 18 | 0 | IN | GPIO1_C7 | 5 | 55 | | | | UART4_TX | | | 19 || 20 | | | GND(0V) | | | | | | UART4_RX | | | 21 || 22 | 0 | IN | GPIO1_D0 | 6 | 56 | | | | SPI1_CLK | | | 23 || 24 | | | SPI1_CSn | | | | | | GND(0V) | | | 25 || 26 | | ALT | GPIO4_C5 | 11 | 149 | | | | I2C2_SDA | | | 27 || 28 | | | I2C2_SCL | | | | | | I2S0_LRX | | | 29 || 30 | | | GND(0V) | | | | | | I2S0_LTX | | | 31 || 32 | | | I2S_CLK | | | | | | I2S0_SCL | | | 33 || 34 | | | GND(0V) | | | | | | I2S0SDI0 | | | 35 || 36 | | | I2S0SDO0 | | | | | | I2S0I1O3 | | | 37 || 38 | | | I2S0I2O2 | | | | | | GND(0V) | | | 39 || 40 | | | I2S0I3O1 | | | +------+-----+----------+------+---+----++----+---+------+----------+-----+------+ Let's try GPIO1_A4: echo 36 > /sys/class/gpio/export echo "out" >/sys/class/gpio/gpio36/direction echo "1" > /sys/class/gpio/gpio36/value And then I can measure 3v with a multimeter hooked to the physical pin 15.
  8. Now unfortunately luma-oled seems to be yet another problem. I wired up my LCD as: MOSI > GPIO1_A7 > SPI1_RXD > M4 Pin 21 > LCD DIN Pin (blue) SCK > GPIO1_B1 > SPI1_CLK > M4 Pin 23 > LCD CLK Pin (yellow) CS > GPIO1_B2 > SPI1_CSn0 > M4 Pin 24 > LCD CS Pin (orange) DC > GPIO1_A0(3V) > M4 Pin 7 > LCD DC Pin (green) RST > GPIO1_A1(3V) > M4 Pin 11 > LCD RST Pin (white) From my understanding I had to get GPIO1_A0 and GPIO1_A1 in the system so the lib could use them. According to this https://hev.cc/2927.html GPIO mapping I tried: ls -la /dev/spi* crw------- 1 root root 153, 0 Sep 16 18:51 /dev/spidev1.0 echo 32 > /sys/class/gpio/export echo 33 > /sys/class/gpio/export ls -la /sys/class/gpio/ total 0 drwxr-xr-x 2 root root 0 Jan 18 2013 . drwxr-xr-x 76 root root 0 Jan 18 2013 .. --w--w---- 1 root dialout 4096 Sep 16 20:51 export lrwxrwxrwx 1 root root 0 Sep 16 20:50 gpio32 -> ../../devices/platform/pinctrl/gpiochip1/gpio/gpio32 lrwxrwxrwx 1 root root 0 Sep 16 20:50 gpio33 -> ../../devices/platform/pinctrl/gpiochip1/gpio/gpio33 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip0 -> ../../devices/platform/pinctrl/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip128 -> ../../devices/platform/pinctrl/gpio/gpiochip128 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip32 -> ../../devices/platform/pinctrl/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip64 -> ../../devices/platform/pinctrl/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Jan 18 2013 gpiochip96 -> ../../devices/platform/pinctrl/gpio/gpiochip96 --w--w---- 1 root dialout 4096 Sep 16 19:19 unexport Now I tried the luma-oled examples (running as root): python3 3d_box.py --display ssd1351 --interface spi --spi-port 0 --spi-device 1 --gpio-reset 33 --gpio-data-command 32 --width 128 --height 128 usage: 3d_box.py >(....) 3d_box.py: error: GPIO access not available I'm not even sure if this part "--gpio-reset 33 --gpio-data-command 32" is correct. I've tried both the virtual pin number and the hardware number without luck. Also tried to install https://github.com/friendlyarm/RPi.GPIO_NP without much luck: apt-get update apt-get install python-dev git clone https://github.com/friendlyarm/RPi.GPIO_NP cd RPi.GPIO_NP python3 setup.py install python3 setup.py install python3 luma.examples/examples/3d_box.py --display=ssd1351 --interface=spi --width=128 --height=128 --spi-bus-speed=16000000 --bgr --spi-device=1 --spi-port=0 --gpio-reset=33 --gpio-data-command=32 --gpio RPi.GPIO Traceback (most recent call last): (...) RuntimeError: It is not NanoPi based board.
  9. Your comment was crucial to fix my "issue". I enabled the overlay and then as described on the file edited `/boot/armbianEnv.txt` in order to include: param_spidev_spi_bus=1 param_spidev_max_freq=100000000 Now the SPI shows up: ~# ls -la /dev/spi* crw------- 1 root root 153, 0 Sep 16 18:51 /dev/spidev1.0 Also passes the spidev_test (https://raw.githubusercontent.com/torvalds/linux/master/tools/spi/spidev_test.c) ~# ./spidev_test spi mode: 0x0 bits per word: 8 max speed: 500000 Hz (500 kHz) (Had to adjust the path) Thank you for the tip!
  10. Never late to the party! Thank you for your tips. Btw, for future reference fro anyone going about the same path, page 11 of the NanoPi M4v2 schematic contains a definition of the SPI1 that can be easily between the overlay and physical pins. Schematic: http://wiki.friendlyarm.com/wiki/images/c/cc/NanoPi-M4V2_1908_Schematic.pdf Physical pin assignment: https://wiki.friendlyarm.com/wiki/index.php/NanoPi_M4V2#Diagram.2C_Layout_and_Dimension
  11. I think there is a misunderstanding here, I never requested support in "record time" and I certainly didn't said that it needs to happen fast. I just said I would upload my log file as soon as I can. I'm happy with the "few minutes" whenever you guys have some spare time!
  12. I'll wait patiently for some news. It's not a life or death situation
  13. Okay, you win I'll provide the file ASAP.
  14. I'm sorry but... it is for an unsupported board or image (CSC/EOS/WIP/edge) > It's a supported board it is for software that is not supported (such as userspace modules installed on top of the core operating system) > NO it has been logged in the wrong forum (for example requests for help that are not actual bug reports) > NO, its a bug. it lacks requested data (armbianmonitor output) > Not relevant in this case. it could have been easily solved by a quick search and/or reading documentation > ??
  15. Hello, I'm trying to use the NanoPi M4v2 SPI however it doesn't seem to work. I used armbian-config to enable the gpio overlay: [ ] dwc3-0-host [ ] i2c7 [ ] i2c8 [*] pcie-gen2 [ ] rk3328-opp-1.4ghz [ ] rk3328-opp-1.5ghz [ ] rk3399-opp-2ghz [ ] spi-jedec-nor [*] spi-spidev [ ] uart4 [ ] w1-gpio And the SPI isn't showing up on /dev: ls /dev/spi* ls: cannot access '/dev/spi*': No such file or directory Wasn't this enough to be able to use the SPI1 on this board? SBC: NanoPi M4V2 System: 5.10.35-rockchip64 #21.05.1 SMP PREEMPT Fri May 7 13:53:11 UTC 2021 aarch64 GNU/Linux Thank you.