Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by Jeffer

  1. Hi,

    I need to use callback function in Python3 on my NanoPi M4 but I can't,

    so it is very nice if anyone can help me with this issue.



    So far I've tried the function with wiringpi as shown command bellow


    wiringpi.wiringPiISR(PIN_TO_SENSE, wiringpi.GPIO.INT_EDGE_BOTH, gpio_callback)

    but this doesn't work at all,

    that generates some errors and after that my command in /usr/bin/ doesn't work ....


    I can use other functions in wirignpi so guess something is wrong with only this function...

    Is there any way to use callback function with NanoPi M4, for example using other modules or something


    Thank you,




  2. Thank you for replying to my question.

    After I tried with different .img file, which is nightly I think, everything worked well.

    I successfully installed wiringpi both in Python2 and Python3.


    But a problem now is that I get "Segmentation fault" errors when I try to use call back function with 

    wiringpi.wiringPiISR(PIN_TO_SENSE, wiringpi.GPIO.INT_EDGE_BOTH, gpio_callback)

    in some codes such as shown here https://github.com/WiringPi/WiringPi-Python/blob/master/examples/callback.py.


    as soon as I command 

    wiringpi.wiringPiISR(PIN_TO_SENSE, wiringpi.GPIO.INT_EDGE_BOTH, gpio_callback)

    the gpio_callback function which I defined execute some times (typically ~10 times), 

    that segmentation fault error occurs.


    I have tested it with python2 and python3 as well.

    Do you have any idea why this happens or maybe how to deal with this?


    Thank you,



  3. I'm trying to install wiringpi by following the instruction given here https://github.com/Pavelectric/WiringPi_M4.

    Most of the steps that I followed worked fine but when I do the very last command below,


    $ sudo easy_install wiringpi-2.44.4-py3.6-linux-aarch64.egg

    I get a following error,


    Traceback (most recent call last):

      File "/usr/local/bin/easy_install", line 11, in <module>

        load_entry_point('setuptools==33.1.1', 'console_scripts', 'easy_install')()

      File "/home/pi/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point

        return get_distribution(dist).load_entry_point(group, name)

      File "/home/pi/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point

        return ep.load()

      File "/home/pi/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2434, in load

        return self.resolve()

      File "/home/pi/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2440, in resolve

        module = __import__(self.module_name, fromlist=['__name__'], level=0)

      File "/usr/local/lib/python3.6/dist-packages/setuptools-33.1.1-py3.6.egg/setuptools/command/easy_install.py", line 51, in <module>

      File "/usr/local/lib/python3.6/dist-packages/setuptools-33.1.1-py3.6.egg/setuptools/archive_util.py", line 11, in <module>

    ImportError: cannot import name 'ContextualZipFile'

    I googled how to deal with this kind of error, and some people tell that 'ContextualZipFile'  in archive_util.py doesn't have to be installed so I just need to comment that out.

    Although, I couldn't find  '/usr/local/lib/python3.6/dist-packages/setuptools-33.1.1-py3.6.egg/setuptools/archive_util.py', 

    I did that comment out solution to the all files below, which I got by doing find-command-research






    Now I don't know what to do here... It is very nice if anyone can help me get out of this darkness...


    Thank you, 




  4. Hi,

    I'm currently facing strange problems...


    I'm using NanoPi and operate some USB devices with it.

    Since I wanted to know the total power consumption of the system, I measured current which flows into NanoPi from the outlet.


    The current during while the camera working was very nice (about 1A) so I shut the pi down.

    Then, I found that the total current value gradually rose up from about 1A to 1.5A.

    This seems to be so strange because when it gets shutdown, the power should be off as well,

    and the pi only needs small amount of power just to light the red LED.  

    I tried a few times but the result was always same...


    I can't understand the reason why this happens, 

    does anyone have ideas to explain this phenomena?




  5. I did the same thing with the nightly and got the following 


    $ ls -l /dev/spidev*

    crw------- 1 root root 153, 0 Mar 19 02:38 /dev/spidev0.0

    crw------- 1 root root 153, 1 Mar 19 02:38 /dev/spidev1.0

    $ dmesg | grep spi

    [    2.608230] rockchip-spi ff1c0000.spi: Failed to request TX DMA channel

    [    2.608293] rockchip-spi ff1c0000.spi: Failed to request RX DMA channel

    [    2.611627] rockchip-spi ff1d0000.spi: Failed to request TX DMA channel

    [    2.611676] rockchip-spi ff1d0000.spi: Failed to request RX DMA channel

    [    3.101184] rockchip-pinctrl pinctrl: pin gpio3-7 already requested by ff1c0000.spi; cannot claim for fe300000.ethernet


    so I tested this spidev1.0 with spidev_test.c

    but again, it returned this


    $ sudo ./a.out -D /dev/spidev1.0

    [sudo] password for pi:

    spi mode: 0x0

    bits per word: 8

    max speed: 1000000 Hz (1000 KHz)


  6. I succeeded to boot spi1.0 somehow...

    I edited device tree by following your way and I got the result below 


    $ dmesg | grep spi 

    [    3.032463] rockchip-spi ff1d0000.spi: Failed to request TX DMA channel

    [    3.032502] rockchip-spi ff1d0000.spi: Failed to request RX DMA channel

    [    7.093333] /spi@ff1d0000/spidev: buggy DT: spidev listed directly in DT

    [    7.093360] WARNING: CPU: 5 PID: 450 at drivers/spi/spidev.c:730 spidev_probe+0xfc/0x1d8 [spidev]

    [    7.093361] Modules linked in: spidev(+) rockchip_io_domain pcie_rockchip_host(+) nvmem_rockchip_efuse input_polldev rockchip_saradc zram ip_tables x_tables ipv6 btrfs xor zstd_decompress zstd_compress xxhash zlib_deflate raid6_pq realtek phy_rockchip_typec phy_rockchip_pcie rtc_rk808 dwmac_rk stmmac_platform stmmac

    [    7.093394] pc : spidev_probe+0xfc/0x1d8 [spidev]

    [    7.093398] lr : spidev_probe+0xfc/0x1d8 [spidev]

    [    7.093447]  spidev_probe+0xfc/0x1d8 [spidev]

    [    7.093456]  spi_drv_probe+0x7c/0xd8

    [    7.093479]  __spi_register_driver+0x58/0x60

    [    7.093484]  spidev_init+0x9c/0x1000 [spidev]


    and /dev/spidev1.0 appeared (by default, this was spidev0.0 but after I added spi1 = "/spi@ff1d0000" to aliases in dts, the spidev1.0 appeared)


    I felt so happy this time and tested that spidev1.0 function with spidev_test.c

    and I got following result again...


    spi mode: 0x0

    bits per word: 8

    max speed: 500000 Hz (500 KHz)

     I'm using spidev1.0 this time but this result again... 

    what can I do now...?

  7. 19 hours ago, martinayotte said:

    You must have wired it incorrectly by swapping TX/RX ...

    Even if you have done something wrong in DTB, you should see the u-boot logs followed by kernel logs with "console=serial" in /boot/armbianEnv.txt

    well I checked the connection so many times so it should be correct

    Also, with a default DTB I can log in via UART with the following command 

    % sudo screen -L /dev/tty.usbserial-FTADURC2 1500000


    I attached the pic of my USB-TTL on nano pi so you can check it 

    Screen Shot 2019-02-22 at 19.45.34.png


    19 hours ago, martinayotte said:

    There is Mainline nightly build here : https://dl.armbian.com/nanopim4/Debian_stretch_dev_nightly.7z

    I will try with this kernel 

    EDIT: good news. with the nightly, nano pi booted after editing the DTB

    /dev/spidev0.0 appeared so I tested with it but nothing happened, I remembered that spi0 is for other use

    I'll try with the other spi, not spi@ff1d0000 

    ->well, with spi@ff1e0000 spidev0.0 appeared...and this doesn't work

    I think something was wrong so I'll try again 


    whichever spi@ff1***** I edited, /dev/spidev0.0 always appeared 

    I edited rk3399-nanopi4-rev01.dtb but this isn't the DTB that I should fix?

    by accident I destroyed that file and I rebooted it but it was fine and the results were the same....

  8. 2 hours ago, martinayotte said:

    Well, as said before, use the USB-TTL Serial, when reaching the login prompt, log into it, then do "dmesg" to see complete boot log.

    I mean, when I tried as I usually do with USB-TTL, unfortunately the screen is just black, shows nothing ( implying no data coming via UART-TTL? )

    If this makes no sense, sorry for that but this is what I got so far... 


    2 hours ago, martinayotte said:

    Of course you can try the latest mainline, which is the one I use on my T4, but maybe something else will be missing, depending of your needs...

    Now Im using this legacy kernel just because it is distributed here https://www.armbian.com/nanopi-m4/

    If there are some possibilities that SPI can work by updating the latest mainline, I'm happy to do that but I would like you to tell me how, I couldn't find the method 

  9. 11 hours ago, martinayotte said:

    So, it reach login prompt, you've logged in an still don't see the /dev/spidev0.0 ?

    What shows up doing "grep SPIDEV /boot/config-*" ?

    It should show :

    well, I meant nothing appeared, so the screen is remaining black after the boot

    I can check /var/log/bootstrap.log with other LINUX machine but can this show the latest log?




    for the kernel version, 

    "uname -r" returns "4.4.162-rk3399"

    Should I upgrade this kernel?

  10. 34 minutes ago, martinayotte said:

    I'm talking about the Serial Debug port, a 4 pins header on the board, it is attached to UART2DBG_RX and UART2DBG_TX of the SoC, it should the serial@ff1a0000, put it back to "okay" ...

    Then, attach the USB-TTL on this 4 pins header, and watch the boot log and try to find an error related to the fact that boot is hanging.

    Thank you so much 

    I did all the things mentioned here and checked the boot logs.... then nothing appeared...


    I attached a dts file which I edited again just in case  


  11. 22 minutes ago, martinayotte said:

    I'm not sure to understand your question ...

    Do you have this USB-TTL Serial attached to Serial Debug port of your M4 ?

    Do you run on your PC "putty" or "picocom" ?

    What are you seeing while it is booting ?

    To make sure you see complete logs, make sure to have "verbosity=7" and "console=serial" in /boot/armbianEnv.txt !

    There should be an error somewhere if it doesn't reach login prompt ...

    Sorry that I made you confused

    I have it and I can use it

    but since I don't know which UART in main DT represents the UART4 which share GPIO with SPI1, I disabled all of the UARTs anyway

    So I thought all of the UARTs were OFF and thus never tried to see what was going on while booting...


    just for information, nano pi m4 doesn't shoe its yellow light blinking while booting after I changed main DT to enable SPI1 



    I run UART console with "screen" command on UNIX 

  12. 23 minutes ago, martinayotte said:

    Do you have a USB-TTL Serial dongle to check logs during boot ?

    Where does it failed ?

    I have it.

    Usually I use it for console but how can I check logs with it ?

    In addition, I would like to know which UART is supposed to be "disable"

    UART4 and SPI1 share GPIOs but since I don't know which is the one, I disabled all of the UARTs


    the red light on nano pi m4 is on but the yellow one which is supposed to blink while booting does not appear anyway  


  13. On 2/18/2019 at 1:44 PM, Exie said:

    If you dont mind sharing some of the commands you used to get the debug output and enable the interface, that'd be great.

    sorry I edited a status at a wrong spi (actually it was spi@ff1c0000, which corresponds to the SPI0 which is only for SPIFlash) and after edited the status at spi@ff1d0000, my machine doesn't boot...


    basically I followed an instruction mentioned here, 


  14. 4 minutes ago, martinayotte said:

    Did you tried all other SPIs, spi@ff1e0000, spi@ff1f0000 and spi@ff200000 ?

    Now I'm trying ... so please wait haha



    Is it possible that I download the img file which you made or someone made to enable SPI?

  15. On 2/6/2019 at 3:46 AM, martinayotte said:

    BTW, I didn't pay attention before, but you seems to try using SPI0 and instead of SPI1, which is the one on the header. (SPI0 is only for SPIFlash)

    I followed your suggestion below 


    On 12/30/2018 at 11:19 PM, martinayotte said:

    Then, for the SPI, you need to turn it ON with ' status="okay"; ', but also need to add SPIDEV into this node :

            spi@ff1c0000 {
    			[ ... more stuff here ... ]
                status = "okay";
    			spidev {
                    compatible = "spidev";
                    status = "okay";
                    reg = <0>;
                    spi-max-frequency = <10000000>;

    but a change on spi@ff1c0000 showed the change at SPI0 not SPI1 so I thought I had to change the different one, such as spi@ff1d0000.


    After I edited spi@ff1d0000, I changed dts file to dtb and I rebooted my pi, then it never booted again...

    I did the same thing with my backup file and got the same problem

    Maybe this spi@ff1d0000 should not be abled..?


    So how can I know which spi@***** represents SPI1? 

  16. 1 hour ago, NicoD said:

    Why the nanopi m4? There are a lot more compact boards with mini hdmi that are 1/10th the size and weight of the NanoPi M4. FriendlyElec has got the NEO's are Fire's. All compact and very powerful.
    There's for example the Banana Pi M2 Zero. The same size as a raspberry pi zero, but with 4-cores. Maybe you are not choosing the right tool for the job. Is is for entertainment? Or do you want it to control things or so?
    The RK3399 needs a big heatsink to be able to have a good performance, so that add's a lot of weight. Otherwise you can run it underclocked a lot so it doesn't throttle.

    I need USB3.0 connections to control a USB camera.

    This need decreases the number of choices and I've tried with some boards to check with which one the camera can work the most effectively.


  17. On 2/18/2019 at 8:53 PM, Igor said:

    I am just informing you that there are problems hidden deep inside. We have encounter some and some are ready to be found in a process when kernel gets matured. If I would sit in the plane where captain would say: "Welcome on board. This plane is running RK3399 ... I would immediately leave that plane" :) In a few months from now, situation will be changed ... if there will be enough interest to have this kernel pitch perfect.

    Thank you for informing me that fact.

    you know, the money for me is limited as well so we chose this chip.

    Of course we understand it can fail during the flight.

    It is going to be like "Welcome on board. You can enjoy playing some games running on RK3399 during our flight" haha 

  18. On 2/18/2019 at 8:43 PM, Igor said:

    No, in general: "RK3399 board support is WIP, "for testing only" and problems are expected! If you want to use those boards for some real cases, don't."

    I understand, I think it is fine since the operation duration is expected to be less than a few mins

    And so far no problems have been found so, yeah hopefully it's okay


  19. On 2/18/2019 at 3:40 AM, NicoD said:

    May I know what reason? Seems a bit drastic to do. Are you sure you need to do this>

    Yes, I need to do this. I'm going to install NanoPi M4 on the drone and thus the available space is so limited


    On 2/18/2019 at 3:40 AM, NicoD said:

    You do realize you can use MIPI-DSI for a monitor?

    I didn't consider this MIPI-DSI.

    I googled MIPI-DSI monitor but only found MIPI-DSI monitor for raspberry pi.

    Does this work with Nano Pi? ( I think this is fine)


  20. On 2/16/2019 at 11:37 PM, Dante4 said:

    If screen is fine with 5V as Power source - you will be fine in terms of power. But you will need to look does Ubuntu have drivers to send video signal over USB (short answer - most likely no, since GPU is not connected to USB as far as i remember and you will get heavy lags on screen that will go thought USB since it will render itself via CPU, which is not great for this job at all)

    Though I've not checked if it can work with my Ubuntu machine, I've found a device driver for usb monitor and some articles where people actually use it under Ubuntu environment.

    I don't care about the lags because of the lack of the GPU, this is so important for me since I have to remove a HDMI port for some reasons haha

  21. 12 hours ago, NicoD said:

    I do not think this is possible with the M4. With the T4 this should be possible over the USB-C.
    The M4 it's USB-C is over USB2. It's there mostly to power the board.

    yes, the USB-C port on NanoPi M4 is for the power supply

    But the M4 has 4 other USB3.0 ports which are used for data transfer and I guess USB-C type connection can be made with a USB-C to USB-A adapter.

    How do you think about this?

  • Create New...