Y2Kot
February 20, 2023, 5:33pm
1
Which system do you use? Android, Ubuntu, OOWOW or others?
Android
Which version of system do you use? Khadas official images, self built images, or others?
Khadas official images
Please describe your issue below:
I want to use I2C and GPIO interfaces. However on android I can use only 2 GPIO. I2C is unavailable at all.
How can I enable I2C on vim 4? And how can I enable some more GPIO? I need at least 5 GPIO and 1 I2C.
If it can be done only with rom building, can you help me with modifying files?
goenjoy
February 21, 2023, 3:43am
2
Figure I2CM_ A interface. The code is available by default.
VIM4:/ # i2cdetect -l
i2c-3 i2c Meson I2C adapter I2C Adapter
i2c-1 i2c Meson I2C adapter I2C Adapter
i2c-6 i2c Meson I2C adapter I2C Adapter
i2c-2 i2c Meson I2C adapter I2C Adapter
i2c-0 i2c Meson I2C adapter I2C Adapter
i2c-5 i2c Meson I2C adapter I2C Adapter
VIM4:/ #
VIM4:/ # i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
VIM4:/ #
Please refer to this link for modification.
We are trying to use the VIM board in production but I need these problems fixed quickly. Could you please give detailed instructions on how to change some of these pins for GPIO use.
1 Like
Y2Kot
March 2, 2023, 11:45am
3
@goenjoy thanks for your help, I2C is working good.
However I’ve tried to revert common and build rom to make gpio work. It’s build success and flashed success to. However I see only boot logo for 3 seconds on hdmi screen. After this 3 seconds I see only black screen. Also I a have no image on touch screen
@Y2Kot Please post the whole compilation command step.
Y2Kot
March 2, 2023, 1:20pm
5
@goenjoy
cd bootloader/uboot
./mk kvim4 --avb2 --vab
./mk kvim4 -v 5.4 -j20
. build/envsetup.sh
lunch kvim4-userdebug
make -j20 otapackage
also, before build, I execute
git revert bc1bdb7ebee07dfef5c57f712b8e747f7cf29f8a
in MY_DIR/common folder
Y2Kot
March 2, 2023, 2:00pm
6
@goenjoy can you explain, how shout I make to enable 5 GPIO and 1 I2C:
&i2c0 {
status = "okay";
pinctrl-names="default";
pinctrl-0=<&i2c0_pins1>;
clock-frequency = <100000>; /* default 100k */
};
&i2c1 {
status = "okay";
pinctrl-names="default";
pinctrl-0=<&i2c1_pins1>;
es8316: es8316@10 {
compatible = "everest,es8316";
#sound-dai-cells = <0>;
reg = <0x10>;
status = "okay";
io-channels = <&saradc 3>;
io-channel-names = "jack-chan-3";
hp_val = <784>; //val=voltage/1800mV*1023
hp_tolerance = <50>;
spk-con-gpio = <&gpio GPIOT_9 0>;
};
};
Am I correct?
@Y2Kot Have you compiled and upgraded before? Can it boot and enter the desktop? In addition, please make sure that the downloaded code is accurate.
./mk kvim4 -v 5.4 -j20
Please paste the LOG in the last paragraph of the above command.
Y2Kot
March 3, 2023, 6:10am
8
@goenjoy no, I’m compiling for the first time. Its show khadas logo and blackscreen, I didn’t see desktop.
I think that problem was in command:
git revert bc1bdb7ebee07dfef5c57f712b8e747f7cf29f8a
and now I’m fully download code again to make manual changes in kvim4.dts as I print above. Am I correct? or git revert bc1bdb7ebee07dfef5c57f712b8e747f7cf29f8a
is a right command?
Y2Kot
March 3, 2023, 6:11am
9
I’ll send log after download will complete
Y2Kot
March 3, 2023, 12:08pm
10
@goenjoy here is my kernel build log kernel_build.log · GitHub
I noticed that my update.img have 1.8gb size, however your image is 2.1gb. Can I missed some files?
@Y2Kot The LOG you posted is uboot, not kernel. So I suspect you haven’t compiled the kernel.
./mk kvim4 -v 5.4 -jN
Y2Kot
March 6, 2023, 7:31am
12
@goenjoy
does kernel build must be called from project_root directory? If so I have build error: kernel · GitHub
yes
Y2Kot:
If so I have build error: kernel · GitHub
/usr/bin/as: unrecognized option ‘-EL’
clang-11: error: assembler command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/home/ubuntu/vim4/common/scripts/Makefile.build:284: scripts/mod/empty.o] Error 1
make[1]: *** [/home/ubuntu/vim4/common/Makefile:1247: prepare0] Error 2
https://docs.khadas.com/products/sbc/vim4/development/android/install-toolchains
Have you installed the tool chain in strict accordance with the document?
If the installation is successful, it is the problem of downloading the code. Have you performed step 4 in the download document?
https://docs.khadas.com/products/sbc/vim4/development/android/download-android-source-code
Y2Kot
March 6, 2023, 11:28am
14
after installing sudo apt-get install gcc-5-aarch64-linux-gnu kernel build successfully and I load into desktop. Thank you for help! I2C and GPIO also works
Y2Kot
March 7, 2023, 12:54pm
15
@goenjoy i2cget binary file from vim4 can’t read word from i2c. Is it possible to get binaries for i2cget, i2cset from vim3? They works well
Y2Kot
March 8, 2023, 4:36pm
17
@goenjoy the i2cget app in vim4 can’t read WORD from register, only one byte, however i2cget app from vim3 can do it.
Y2Kot
March 14, 2023, 5:42am
18
@goenjoy where I should change i2cget binary to put it from vim3 rom to vim4?
Y2Kot
March 15, 2023, 12:09pm
20
@goenjoy I wrote about this.
/* i2ctools.c - i2c tools
*
* Copyright 2018 The Android Open Source Project
*
* https://www.kernel.org/doc/Documentation/i2c/
*
* Note: -y must have the same value in each toy for `confirm`.
*
* TODO: i2cdetect -q/-r and the "auto" mode?
* TODO: i2cdump non-byte modes, -r FIRST-LAST?
* TODO: i2cget non-byte modes? default to current read address?
* TODO: i2cset -r? -m MASK? c/s modes, p mode modifier?
USE_I2CDETECT(NEWTOY(i2cdetect, ">3aFly", TOYFLAG_USR|TOYFLAG_BIN))
USE_I2CDUMP(NEWTOY(i2cdump, "<2>2fy", TOYFLAG_USR|TOYFLAG_BIN))
USE_I2CGET(NEWTOY(i2cget, "<3>3fy", TOYFLAG_USR|TOYFLAG_BIN))
USE_I2CSET(NEWTOY(i2cset, "<4fy", TOYFLAG_USR|TOYFLAG_BIN))
config I2CDETECT
bool "i2cdetect"
This file has been truncated. show original
I found TODO:
i2cget non-byte modes? default to current read address?
Is it possible to implement word read?