VIM3 GPIO "WiringPI" SPI

Dear Frank
I have try to rebuild by your commant that is editing the vim3_linux.dts.
and I have sucesse rebuilding in the vim3_linux.dts file by edit spicc1 changed.
But I don’t find spi device at the /dev directory.
Please What I need to do additionally to add SPICC1 device to the / dev directory

@OSHMUHA You can try this steps:

$ make kernel

Then , Copy fenix/linux/arch/arm64/boot/Image to you board and replace /boot/zImage,
copy fenix/linux/arch/arm64/boot/dts/amlogic/kvim3_linux.dtb to you board /boot/dtb.

Final,run $sync && sudo reboot in you board .

You should check the file generate time if update before you copy it .

Or you can rebuild the full image.

$ make kernel && make debs && make 

Then ,reburn it to you board.

5 Likes

It was confirmed that the kvim3_linux.dtb file and Image are newly created.
I copied it to the / boot directory and & sync && sudo reboot also executed normally.
I still can’t find spicc1 in / dev.
Let me know what I don’t know

@OSHMUHA I am soory , I forget that the pwm_f had been open in dts. you need to disabled it .

&pwm_ef {
     status = "disabled";
     pinctrl-names = "default";
     pinctrl-0 = <&pwm_f_pins2>;
 };

pwm_f and spi all used pin35

2 Likes

PWM_EF is disabled.
Nevertheless, the SPI is still not found in / DEV.
Please tell me how to use SPI device driver.

1 Like

Hei,
It’s very interesting to follow this discussion about SPI here.
Until now we solved this problem for our self, our Project.
We changed for now from Ubuntu to Android 9, because
the problems with HDMI and TS050 Display is until now
in Khadas Queue! we’re waiting for good messages.

But Now, we have the problems with Android…!!
We’re still waiting for a message from Khadas specialist @Terry
it’s not so easy to communicate with him, him’s response time is
average 8 days!

Sorry that I’m not so helpful for you @OSHMUHA

1 Like

Hello @OSHMUHA

Please revert all the changes before and try this patch.

nick@Nick:~/code/fenix/linux$ git diff arch/arm64/boot/dts/amlogic/kvim3_linux.dts
diff --git a/arch/arm64/boot/dts/amlogic/kvim3_linux.dts b/arch/arm64/boot/dts/amlogic/kvim3_linux.dts
index 920480b..ae40b6a 100644
--- a/arch/arm64/boot/dts/amlogic/kvim3_linux.dts
+++ b/arch/arm64/boot/dts/amlogic/kvim3_linux.dts
@@ -854,7 +854,7 @@
 &pwm_ef {
        status = "okay";
        pinctrl-names = "default";
-       pinctrl-0 = <&pwm_f_pins2>;
+       pinctrl-0 = <&pwm_f_pins1>;
 };
 
 &pwm_AO_cd {
@@ -1390,7 +1390,7 @@
 };
 
 &spicc1 {
-       status = "disabled";
+       status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&spicc1_pins>;
        cs-gpios = <&gpio GPIOH_6 0>;

You will see the spi node.

root@Khadas:~# ls /dev/spidev1.0 
/dev/spidev1.0
5 Likes

@OSHMUHA You can use the patch which come from @numbqq . I have test it . It work fine .

2 Likes

@numbqq 's patch is result
It’s so sorry, it is not work fine
but still i can’t spidev1.0 device
First step
$ git clone --depth 1 https://github.com/khadas/fenix
next setp
$ source env/setenv.sh
next step
$make
after building and then i have edit pwm_ef & spicc1 part in the file “linux/arch/arm64/boot/dts/amlogic/kvim3_linux.dts”
next setp
i have run :~/code/fenix/linux$ git diff arch/arm64/boot/dts/amlogic/kvim3_linux.dts


and then i have run
$make
it’s result “VIM3_Ubuntu-xfce-bionic_Linux-4.9_arm64_SD-USB_V0.8.3-20200318.img”
Plaese how can i doing for spidev1.0 device

1 Like

@OSHMUHA use this command

$ make kernel && make debs && make 

or

$ make kernel 

copy dtb and Image file to you board.

Just use make can’t update the kernel

3 Likes

Dear Frank , @numbqq
I have successfully registered spidev1.0.
Thank you.

2 Likes

May I know what are your configurations for source env/setenv.sh .
Thanks you very much :slight_smile:

Now I got stuck at that NO any dtb files generated in linux/arch/arm64/boot/dts after I succeeded to run make ARCH=arm64 kvims_defconfig .

I just want to follow this Building Kernels Manually to manually build kernel. Then I could use those updated dtb files to make bootimage

I am using khadas-vims-4.9.y branch and git log shown as below:

This is my configuration and I am not sure if I do make sense:

	amo@ubuntu:~/workspace/vim3/fenix$ source env/setenv.sh 

	Choose Khadas board:
	1. Edge
	2. VIM1
	3. VIM2
	4. VIM3
	5. VIM3L

	Which board would you like? [2] 4

	Choose uboot version:
	1. uboot-2015.01
	2. uboot-mainline

	Which uboot version would you like? [1] 1

	Choose linux version:
	1. linux-4.9

	Which linux version would you like? [1] 1

	Choose distribution:
	1. Ubuntu
	2. Debian

	Which distribution would you like? [1] 1

	Choose Ubuntu release:
	1. bionic
	2. focal

	Which Ubuntu release would you like? [1] 1

	Choose Ubuntu type:
	1. server
	2. minimal
	3. xfce
	4. lxde
	5. gnome

	Which Ubuntu type would you like? [1] 2

	Set architecture to 'arm64' by default.

	Choose install type:
	1. EMMC
	2. SD-USB

	Which install type would you like? [1] 1
	===========================================
	#VERSION: 1.0.1

	#KHADAS_BOARD=VIM3
	#VENDOR=Amlogic
	#CHIP=A311D
	#LINUX=4.9
	#UBOOT=2015.01
	#DISTRIBUTION=Ubuntu
	#DISTRIB_RELEASE=bionic
	#DISTRIB_TYPE=minimal
	#DISTRIB_ARCH=arm64
	#INSTALL_TYPE=EMMC

	===========================================

	Environment setup done.
	Type 'make' to build.

Then I got error when I run make kernel && make debs && make and log shown below:

    amo@ubuntu:~/workspace/vim3/fenix$ make kernel && make debs && make 
	Info: Build host: bionic
	Info: Installing build dependencies
	Info: Requires root privileges, please enter your passowrd!
	[sudo] password for amo: 
	Hit:1 http://ppa.launchpad.net/webupd8team/atom/ubuntu bionic InRelease
	Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease         
	Reading package lists... Done           
	Building dependency tree       
	Reading state information... Done
	All packages are up to date.
	Reading package lists... Done
	Building dependency tree       
	Reading state information... Done
	Some packages could not be installed. This may mean that you have
	requested an impossible situation or if you are using the unstable
	distribution that some required packages have not yet been created
	or been moved out of Incoming.
	The following information may help to resolve the situation:

	The following packages have unmet dependencies:
	 gcc-arm-linux-gnueabihf : Depends: gcc-7-arm-linux-gnueabihf (>= 7.3.0-12~)
	 libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.15~rc1-1) but 2.7.17-1~18.04ubuntu1.2 is to be installed
						Depends: libpython2.7 (= 2.7.15~rc1-1) but 2.7.17-1~18.04ubuntu1.2 is to be installed
						Depends: libexpat1-dev but it is not going to be installed
	 systemd-container : Depends: systemd (= 237-3ubuntu10)
	 uuid-dev : Depends: libuuid1 (= 2.31.1-0.4ubuntu3) but 2.31.1-0.4ubuntu3.7 is to be installed
	E: Unable to correct problems, you have held broken packages.
	Makefile:25: recipe for target 'kernel' failed
	make: *** [kernel] Error 100

	#### failed to build some targets (7 seconds) ####

Thanks all.

@ChiaHungMou you have dependencies that are not met, try using Ubuntu Focal fossa (20.04 LTS)

1 Like

@ChiaHungMou You host ubuntu is 18.04 , So you can’t build a 20.04 image . You can try to build in docker . About how to build in docker , you can follow README in fenix

1 Like

Hi @Frank ,

Thank you for your dedicated support.
Yes I spent whole night and build up a whole new ubuntu 20.04 environment VM.
And Fenix works well on my new ubuntu 20.04 environment VM indeed.

However I just met some make error which did show on my past ubuntu 18.04 VM.
I am making sure if it’s caused by repo sync uncompleted so I just rm -rf whole repo and running repo sync now.

@ChiaHungMou About android source and compile , you can ask @Terry and @jasonl

1 Like

Thank you @Frank .

Hi @jasonl and @Terry ,

I got building Android source code error on Ubuntu 20.04 VM.
However same steps I did on Ubuntu 18.04 worked well on my another Ubuntu 18.04 VM.

I have remove all of folder and run repo sync but get the same error message while running make -j2 otapackage on Ubuntu 20.04 VM.

I run repo init -u https://github.com/khadas/android_manifest.git -b khadas-vims-pie to have android source code.
Thanks and my console screen shot shown as below:

============================================
amo@ubuntu:~/workspace/vim3/bsp$ make -j2 otapackage
hardware/amlogic/wifi/configs/wifi.mk:43: warning: WIFI_MOUDLE is multiwifi
hardware/amlogic/wifi/configs/wifi.mk:47: warning: WIFI_BUILD_IN is false
hardware/amlogic/bluetooth/configs/bluetooth.mk:20: warning: BLUETOOTH_MODULE is BCMBT
hardware/amlogic/bluetooth/configs/bluetooth.mk:24: warning: BLUETOOTH_INF is not set
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=9
TARGET_PRODUCT=kvim3
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.8.0-41-generic-x86_64-Ubuntu-20.04.1-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=PPR1.180610.011
OUT_DIR=out
============================================
[1/1] out/soong/.minibootstrap/minibp out/soong/.bootstrap/build.ninja
[55/56] glob prebuilts/ndk/stl.bp
[77/77] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
out/build-kvim3-cleanspec.ninja is missing, regenerating...
hardware/amlogic/wifi/configs/wifi.mk:43: warning: WIFI_MOUDLE is multiwifi
hardware/amlogic/wifi/configs/wifi.mk:47: warning: WIFI_BUILD_IN is false
hardware/amlogic/bluetooth/configs/bluetooth.mk:20: warning: BLUETOOTH_MODULE is BCMBT
hardware/amlogic/bluetooth/configs/bluetooth.mk:24: warning: BLUETOOTH_INF is not set
out/build-kvim3.ninja is missing, regenerating...
hardware/amlogic/wifi/configs/wifi.mk:43: warning: WIFI_MOUDLE is multiwifi
hardware/amlogic/wifi/configs/wifi.mk:47: warning: WIFI_BUILD_IN is false
hardware/amlogic/bluetooth/configs/bluetooth.mk:20: warning: BLUETOOTH_MODULE is BCMBT
hardware/amlogic/bluetooth/configs/bluetooth.mk:24: warning: BLUETOOTH_INF is not set
[5/954] including build/make/Android.mk ...
device/khadas/common/factory.mk:184: warning: echo "radio add dt and bootloader"
device/khadas/common/factory.mk:322: warning: will keep out/target/product/kvim3/update.img
device/khadas/common/factory.mk:465: warning: will keep out/target/product/kvim3/kvim3-fastboot-flashall-20210201.zip
[314/954] including hardware/amlogic/audio/Android.mk ...
"---------ott audio mode, compiler configure 2 channels output by default--------"
[317/954] including hardware/amlogic/camera/Android.mk ...
/bin/bash: ifconfig: command not found
************************************************************
pdk or not:    
target board:  g12b
git version:   "620d8d5f125aad285e53c797f48ee0e32fd774fb"
uncomment:     0 files
last changed:  "Date:   Sat Nov 7 17:50:25 2020 +0800"
build time:    " Mon Feb  1 00:10:37 PST 2021"
builder name:  " amo"
branch name:   "* (no branch)"
build mode:    userdebug
host name:     "ubuntu"
/bin/bash: ifconfig: command not found
host IP:       ""
path:          "/home/amo/workspace/vim3/bsp/hardware/amlogic/camera/v3/fake-pipeline2/tests"
************************************************************
[321/954] including hardware/amlogic/gralloc/Android.mk ...
hardware/amlogic/gralloc/Android.mk:79: warning: "the value of GPU_ARCH is bifrost"
hardware/amlogic/gralloc/Android.mk:135: warning: "the value of BOARD_RESOLUTION_RATIO is 1080"
hardware/amlogic/gralloc/Android.mk:141: warning: "the value of HWC_PRIMARY_DISP_SUPPORT_AFBC is false"
hardware/amlogic/gralloc/Android.mk:142: warning: "the value of HWC_EXTEND_DISP_SUPPORT_AFBC is true"
hardware/amlogic/gralloc/Android.mk:154: warning: "the value of GPU_TYPE is gondul"
[323/954] including hardware/amlogic/hwcomposer/Android.mk ...
"Build HWC 2.0"
[537/954] including system/sepolicy/Android.mk ...
system/sepolicy/Android.mk:79: warning: BOARD_SEPOLICY_VERS not specified, assuming current platform version
[908/954] including vendor/amlogic/common/LibTsPlayer/Android.mk ...
vendor/amlogic/common/LibTsPlayer/jni/compat/media_control/Android.mk:27: warning: 9
vendor/amlogic/common/LibTsPlayer/jni/compat/media_control/Android.mk:98: warning: 9
vendor/amlogic/common/LibTsPlayer/jni/test/Android.mk:5: warning: Kitkat
vendor/amlogic/common/LibTsPlayer/jni/test/Android.mk:6: warning: vendor/amlogic/common/LibTsPlayer/jni/test
[919/954] including vendor/amlogic/common/apps/NativeImagePlaye/Android.mk ...
vendor/amlogic/common/apps/NativeImagePlaye/jni/Android.mk:10: warning: libnativehelper/include_jni
[928/954] including vendor/amlogic/common/external/DTVKit/android-inputsource/Android.mk ...
vendor/amlogic/common/external/DTVKit/android-inputsource/logicdtvkit/src/jni/Android.mk:10: warning: libnativehelper/include_jni
build/make/core/java_common.mk:183: warning: vendor/amlogic/common/external/DTVKit/android-inputsource/app/src/main/Android.mk: inputsource: Unused source files: vendor/amlogic/common/external/DTVKit/android-inputsource/app/src/main/droidlogic/java
inputsource: platform 'amlogic'
[940/954] including vendor/amlogic/common/frameworks/Android.mk ...
vendor/amlogic/common/frameworks/core/jni/screencontrol/Android.mk:7: warning: libnativehelper/include_jni
vendor/amlogic/common/frameworks/core/jni/systemcontrol/Android.mk:10: warning: libnativehelper/include_jni
[941/954] including vendor/amlogic/common/gpu-lib/Android.mk ...
"the value of BOARD_INSTALL_VULKAN is "
TARGET_PRODUCT is kvim3
[946/954] including vendor/amlogic/common/prebuilt/Android.mk ...
"no bootaccelerate source code, add prebuilts"
"no exoplayer source code, add prebuilts"
[952/954] including vendor/amlogic/common/tv/tvserver/Android.mk ...
"have hardware/amlogic/media"
"have hardware/amlogic/media"
[954/954] including vendor/widevine/Android.mk ...
device/khadas/kvim3/Kernel.mk:174: warning: overriding commands for target `out/target/product/kvim3/obj/lib_vendor/mali.ko'
vendor/amlogic/common//gpu/gpu-v2.mk:23: warning: ignoring old commands for target `out/target/product/kvim3/obj/lib_vendor/mali.ko'
build/make/core/base_rules.mk:412: warning: overriding commands for target `out/target/product/kvim3/system/usr/icu/icudt60l.dat'
build/make/core/base_rules.mk:412: warning: ignoring old commands for target `out/target/product/kvim3/system/usr/icu/icudt60l.dat'
build/make/core/base_rules.mk:412: warning: overriding commands for target `out/host/linux-x86/usr/icu/icudt60l.dat'
build/make/core/base_rules.mk:412: warning: ignoring old commands for target `out/host/linux-x86/usr/icu/icudt60l.dat'
build/make/core/Makefile:28: warning: overriding commands for target `out/target/product/kvim3/obj/lib_vendor/ddr_window_64.ko'
device/khadas/kvim3/Kernel.mk:174: warning: ignoring old commands for target `out/target/product/kvim3/obj/lib_vendor/ddr_window_64.ko'
build/make/core/Makefile:28: warning: overriding commands for target `out/target/product/kvim3/vendor/etc/init/android.hardware.wifi@1.0-service.rc'
build/make/core/base_rules.mk:426: warning: ignoring old commands for target `out/target/product/kvim3/vendor/etc/init/android.hardware.wifi@1.0-service.rc'
[ 99% 1200/1201] glob vendor/amlogic/common/interfaces/tvserver/1.0/src
[  0% 6/71947] Yacc: dtc <= external/dtc/dtc-parser.y
external/dtc/dtc-parser.y: conflicts: 3 shift/reduce
[  0% 10/71947] host C: dtc <= external/dtc/checks.c
FAILED: out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/checks.o 
/bin/bash -c "PWD=/proc/self/cwd  prebuilts/clang/host/linux-x86/clang-4691093/bin/clang   	-I external/dtc -I out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates -I out/host/linux-x86/gen/EXECUTABLES/dtc_intermediates -I libnativehelper/include_jni \$(cat out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/import_includes)  -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I libnativehelper/include -I frameworks/native/include -I frameworks/native/opengl/include -I frameworks/av/include  -c  -Wa,--noexecstack -fPIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS --gcc-toolchain=prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 --sysroot prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot -fstack-protector-strong -m64 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -fdebug-prefix-map=\$PWD/=   -target x86_64-linux-gnu -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin   -std=gnu99  -Wall -Werror -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -fPIE   -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -MD -MF out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/checks.d -o out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/checks.o external/dtc/checks.c"
prebuilts/clang/host/linux-x86/clang-4691093/bin/clang.real: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
[  0% 11/71947] host C: dtc <= external/dtc/data.c
FAILED: out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/data.o 
/bin/bash -c "PWD=/proc/self/cwd  prebuilts/clang/host/linux-x86/clang-4691093/bin/clang   	-I external/dtc -I out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates -I out/host/linux-x86/gen/EXECUTABLES/dtc_intermediates -I libnativehelper/include_jni \$(cat out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/import_includes)  -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I libnativehelper/include -I frameworks/native/include -I frameworks/native/opengl/include -I frameworks/av/include  -c  -Wa,--noexecstack -fPIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS --gcc-toolchain=prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 --sysroot prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot -fstack-protector-strong -m64 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -fdebug-prefix-map=\$PWD/=   -target x86_64-linux-gnu -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin   -std=gnu99  -Wall -Werror -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -fPIE   -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -MD -MF out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/data.d -o out/host/linux-x86/obj/EXECUTABLES/dtc_intermediates/data.o external/dtc/data.c"
prebuilts/clang/host/linux-x86/clang-4691093/bin/clang.real: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
ninja: build stopped: subcommand failed.
00:11:23 ninja failed with: exit status 1

#### failed to build some targets (02:14 (mm:ss)) ####

We have not used Ubuntu 20.04 to compile the code of android 9.0. The new version of the system is not necessarily suitable for compiling the old version of the SDK, because there are some tool and code compatibility issues.

1 Like

Understand! It’s acceptable for me to directly make an Ubuntu 18.04 VM to build android.
Thank you @Terry .

And I really need your help to answer my question on this post .

Because it got hard to understand how to update DTS file and kernel driver for Android developer when we realize the great fenix can not help AOSP.

Thank you very much.

For the newest commit of fenix these steps works for me to have /dev/spidev1.0 based on VIM3 ubuntu spi使用问题 - #2 by numbqq and suggestions above.

1.Modify /fenix/linux/arch/arm64/boot/dts/amlogic/kvim3_linux.dts b/arch/arm64/boot/dts/amlogic/kvim3_linux.dts as below:

 &pwm_ef {
		status = "okay";
		pinctrl-names = "default";
		pinctrl-0 = <&pwm_f_pins1>;
 };

 ...	 

 &spicc1 {
		status = "enable";
		pinctrl-names = "default";
		pinctrl-0 = <&spicc1_pins>;
		cs-gpios = <&gpio GPIOH_6 0>;
 ...
  1. Run make kernel && make debs && make

  2. Replace /boot/zImage and /boot/dtb/kvim3_linux.dtb with Image and kvim3_linux.dtb which are built at step 2.

    $scp ./fenix/linux/arch/arm64/boot/Image khadas@192.168.XXX.XXX:/tmp
    $scp ./fenix/linux/arch/arm64/boot/dts/amlogic/kvim3_linux.dtb  khadas@192.168.XXX.XXX:/tmp
    $ssh khadas@192.168.XXX.XXX
    $sudo mv /tmp/Image /boot/zImage
    $sudo mv /tmp/kvim3_linux.dtb /boot/dtb
    
  3. Update device tree overlay.

    vim /boot/env.txt
    to change this line: overlays=uart3 i2c3 os08a10 spi1

5.WiringPi check gpio.

`	khadas@Khadas:~$ gpio readall
 +------+-----+----------+------+---+----+---- Model  Khadas VIM3 --+----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode |   Name   | wPi | GPIO |
 +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
 |      |     |       5V |      |   |    |       |  1 || 21 |       |    |   |      | GND      |     |      |
 |      |     |       5V |      |   |    |       |  2 || 22 | P/U   |    | 1 | ALT1 | PIN.A15  | 6   |  475 |
 |      |     |   USB_DM |      |   |    |       |  3 || 23 | P/U   |    | 1 | ALT1 | PIN.A14  | 7   |  474 |
 |      |     |   USB_DP |      |   |    |       |  4 || 24 |       |    |   |      | GND      |     |      |
 |      |     |      GND |      |   |    |       |  5 || 25 | P/U   |    | 1 | ALT0 | PIN.AO2  | 8   |  498 |
 |      |     |   MCU3V3 |      |   |    |       |  6 || 26 | P/U   |    | 1 | ALT0 | PIN.AO3  | 9   |  499 |
 |      |     |  MCUNRST |      |   |    |       |  7 || 27 |       |    |   |      | 3V3      |     |      |
 |      |     |  MCUSWIM |      |   |    |       |  8 || 28 |       |    |   |      | GND      |     |      |
 |      |     |      GND |      |   |    |       |  9 || 29 | P/D   |    | 0 | ALT0 | PIN.A1   | 10  |  461 |
 |      |  18 |     ADC0 |      |   |    |       | 10 || 30 | P/D   |    | 1 | ALT0 | PIN.A0   | 11  |  460 |
 |      |     |      1V8 |      |   |    |       | 11 || 31 | P/D   |    | 0 | ALT0 | PIN.A3   | 12  |  463 |
 |      |  19 |     ADC1 |      |   |    |       | 12 || 32 | P/D   |    | 0 | ALT0 | PIN.A2   | 13  |  462 |
 |  506 |   1 | PIN.AO10 | ALT3 | 0 |    |   P/U | 13 || 33 | P/D   |    | 0 | ALT1 | PIN.A4   | 14  |  464 |
 |      |     |     GND3 |      |   |    |       | 14 || 34 |       |    |   |      | GND      |     |      |
 |  433 |   2 |   PIN.H6 |  OUT | 1 |    |   P/D | 15 || 35 | P/D   |    | 0 | ALT2 | PWM-F    | 15  |  432 |
 |  434 |   3 |   PIN.H7 | ALT2 | 0 |    |   P/D | 16 || 36 |       |    |   |      | RTC      |     |      |
 |      |     |      GND |      |   |    |       | 17 || 37 | P/D   |    | 0 | ALT2 | PIN.H4   | 16  |  431 |
 |  497 |   4 |  PIN.AO1 | ALT0 | 1 |    |   P/U | 18 || 38 |       |    |   |      | MCU-FA1  |     |      |
 |  496 |   5 |  PIN.AO0 | ALT0 | 1 |    |   P/U | 19 || 39 | P/D   |    | 0 | IN   | PIN.Z15  | 17  |  426 |
 |      |     |      3V3 |      |   |    |       | 20 || 40 |       |    |   |      | GND      |     |      |
 +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+

 `
  1. Check pins related to SPI.

    VIM3 SPI:
    PIN37: GPIOH_4/SPIB_MOSI     -> type ALT2
    PIN35: PWM_F/SPIB_MISO       -> type ALT2
    PIN15: UARTC_RX/SPIB_SS     -> type OUT
    PIN16: UARTC_TX/SPIB_SCLK -> type ALT2
    

Thanks @Frank and @numbqq and @OSHMUHA and @kwklaus.

3 Likes