GPIO example not working

V190830 already has TS050 support. Have you tried?

Some GPIOs are not configured as GPIO function by default, you need to edit the DTS.

https://docs.khadas.com/vim3/HowToAccessI2c.html

We already have a workable camera sample on VIM3, but not launched yet.

This is for a command line access, how can I use it on a C program?

Estimated date for release?

1 Like

You can use open(), ioctl(), read(), write() to access the I2C device.

https://elinux.org/Interfacing_with_I2C_Devices

3 Likes

Let me explain a bit more… where I think Khadas lacks explanation… if you are coming from MCU world, without OS (arduino, etc) then you need to understand linux basics… you won’t access the hardware directly. Linux Kernel (drivers) will be in charge of accessing that and provide a sysfs device ( a file in /sys/…). Your app, will run in “userspace”, only through this linux devices, which you will write or read just like any other file, with specific parameters and values permitted (you have to check each driver). In fact WiringPi does exactly this, it interacts with linux drivers via their sysfs devices, and abstracts this layer in functions with the same signature of Arduino Wiring. So… it will be of your best interest to learn the linux way and avoid wiring. So, from a C program, just read/write those files. And if you happen to need extra control, modify the specific driver… All the source is available via fenix script, once you build it you will see linux folder where you can modify (including the DTB).

In fact you need to modify the DTS (device tree source), the DTB is the compiled version of the DTS. Then you can compile the DTS and send it to your board via scp or rsync command (to /boot/… directory), I think you will find it in the dtb subfolder. Is not hard, but they fail to document these basics, so…

Hope this helps you understand where you need to go…

3 Likes

Well I won’t use wiring pi. How do I use these pins? Is there any example for this?

@fkaraokur You can use C API to control it . But there no example for it . I think you can found some examples from google search.

Are gpio pins working in ubuntu 5.7 rc7? Because vim3 freezes in gpio readall command and I have to restart!

@fkaraokur WiringPi just supports for 4.9 kernel.