jbird1

  • Posts

    5
  • Joined

  • Last visited

Reputation Activity

  1. Like
    jbird1 got a reaction from MitchD in How to enable hardware SPI   
    So learned a lot of interesting things.  3.4.113-sun8i
    1.  rebuilt using armbian build system on my linux virtual box latest 
    2. spent several hours digging in to SPI mess.  Turns out armbian-config is broken, none of the overlays work.
    3. I found the /boot/dtb-4.13.5-sunxi/overlay/README.sun8i-h3-overlays file that explains the correct configuration information
    4. Then watching boot on serial console, noticed that /boot/dtb/overlay/sun8i-h3 was not being found.
    5.  Dug through /boot/dtb-4.1.3.5-sunxi/overlay and found /boot/dtb-4.13.5-sunxi/sun8i-h3-orangepi-plus.dtb
    6.  I mkdir -p /boot/dtb/overlay/ and copied /boot/dtb-4.13.5-sunxi/sun8i-h3-orangepi-plus.dtb to /boot/dtb/overlay/sun8i-h3
    7. That failed so went back to arbianEnv.txt and tried alternative kernel.
    8.  Now the hand edited armbianEnv.txt file below works on reboot
    This suggests that last nights build has broken or miss matched overlay names (see above) which results in sun8i-h3 not being found.  And possibly armbian-config has dev vs default kernal backwards as well as the armbian-config tool is crashing when you attempt to use to configure the system.  So we are successful but recommend the nightly build be inspected and an update be made available.  Thanks however to all that helped me learn how to look in the right places. Greatly appreciate your assistance and support.  
     
    /boot/armbianEnv.txt
     
    verbosity=7    # I set to maximum to see individual sets in the boot on the serial console thats how we found the file issue.
    logo=enabled
    console=both
    disp_mode=1920x1080p60
    overlay_prefix=sun8i-h3
    overlays=spi-spidev spi-add-cs1 i2c0 i2c1 i2c2 pps-gpio pwm w1-gpio uart1 uart2 uart3 usbhost0 usbhost1 usbhost2 usbhost3 analog-codec cir
    param_spidev_spi_bus=0
    param_spidev_spi_cs=0
    param_spidev_max_freq=1000000
    rootdev=UUID=36c931bc-bed2-4783-9738-42e41805b426
    rootfstype=ext4
    usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
     
    Here is how we tested spidev0.0 on a Orange PI 2+ with hand wired MCP3008 on port 0.  (confusing about spi-add-cs1 but understand why not to use spi-nor bits as they are in conflict with spidev0.0.
    root@opi:/home/j/mcp3008# ls /dev/s*
    /dev/sda        /dev/stderr  /dev/stdout     /dev/sunxi_soc_info
    /dev/spidev0.0  /dev/stdin   /dev/sunxi-reg
    /dev/shm:
    /dev/snd:
    by-path    controlC1  pcmC0D0p  pcmC1D0p  timer
    controlC0  pcmC0D0c   pcmC1D0c  seq
     
    spidev0.0 is visible and active, and testspi now works
     
    root@opi:/home/j/mcp3008# tree /dev/spidev0.0
    bash: tree: command not found
    root@opi:/home/j/mcp3008# ./testspi
    writing command 1 1 0
    reading data 0 0 119 
    count = 119 voltage 2.0105
    writing command 1 1 0
    reading data 0 0 84 
    count = 84 voltage 1.4192
    writing command 1 1 0
    reading data 0 0 22 
    count = 22 voltage 0.3717
     
    Attached are the mcp3008 files used to build the testspi, comments document all the pins and bits.
     
    Please share and I hope it helps others,  J 
     
     
    buildit.sh
    mcp3008.cpp
    mcp3008Spi.h
    mcp3008test.cpp