VIM1S no SPI pinout information

Hi. I’m searching for SPI pins in 40 PIN header and cannot find them, but as on S905Y4 datasheet, the pind Z0/Z6 are configurable as spi

But on your hardware guide cannot find info about and above of all how to attivate spi by boot/.env VIM1S file.
Thanks.

Nobody can answer about?

Hello @pappicio

@Frank will check and update here.

Yes, plesse, as you can see , in func4 specs referred to PIN name, gpioz_0/gpioz_5 are also SPI

Hello @pappicio ,

Sorry for the late reply. You can follow the steps below to enable SPI on VIM1S.

SPI PINs:

  • PIN29 - SPI_A_MOSI
  • PIN31 - SPI_A_CLK
  • PIN32 - SPI_A_MISO
  • PIN33 - SPI_A_SS0

Upgrade kernel:

cd /tmp
wget https://dl.khadas.com/.test/vim1s/khadas-vim1s-linux-5.4-dt-overlays_1.3~7215e3c_arm64.deb
wget https://dl.khadas.com/.test/vim1s/linux-dtb-amlogic-5.4_1.3_arm64.deb
wget https://dl.khadas.com/.test/vim1s/linux-image-amlogic-5.4_1.3_arm64.deb
sudo dpkg -i khadas-vim1s-linux-5.4-dt-overlays_1.3~7215e3c_arm64.deb 
sudo dpkg -i linux-dtb-amlogic-5.4_1.3_arm64.deb linux-image-amlogic-5.4_1.3_arm64.deb 
sync

Enable SPI:

You can enable SPI function via overlay, what you need to do is to edit file /boot/dtb/amlogic/kvim1s.dtb.overlay.env and add spi0 to fdt_overlays, it should be like this:

$ cat /boot/dtb/amlogic/kvim1s.dtb.overlay.env 
fdt_overlays=spi0

Sync and reboot.

If you have done steps above right you will find the spi device node after reboot.

$ ls -al /dev/spidev1.0 
crw-rw---- 1 root root 153, 0 Dec 20 08:50 /dev/spidev1.0

Download test program:

Download test program and compile:

cd /tmp
wget https://dl.khadas.com/.test/vim1s/spidev_test.c
gcc -o spidev_test spidev_test.c

Test

Shoutcut PIN29(SPI_A_MOSI) and PIN32(SPI_A_MISO), and then follow the steps to test.

$ echo "Hello World!" > ./spi_in.txt
$ ./spidev_test -i spi_in.txt -o ./spi_out.txt -D /dev/spidev1.0 
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)

If everything works, you can get Hello World! text from file spi_out.txt

$ cat spi_out.txt 
Hello World!
1 Like

Ok. Thanks a loro, I’ll try.
Only a question
Usually I use Fenix GitHub suorces and build Debian 11 system, I Have ro update the kernel or I can only follow next step?.
I mean, if tomorrof I download Fenix sources I find new updates supportinf spi protocol or I Have ro follow all descrivere step by step?
Thanks again.

When we send the pathes to GitHub you don’t need to follow the steps above, what you only need to do is edit overlay file to enable spi function.

At this moment, these pathes haven’t send yet but will be soon.

1 Like

cannot test, cos
sudo dpkg -i khadas-vim1s-linux-5.4-dt-overlays_1.3~7215e3c_arm64.deb
command give error on decompress “control.tar.zst”

dpkg-deb: errore: l’archivio “khadas-vim1s-linux-5.4-dt-overlays_1.3~7215e3c_arm64.deb” utilizza una compressione sconosciuta per l’elemento “control.tar.zst”, operazione annullata

if you can check, I build fenix Debian Bullseye release for my VIM1S.
Thanks.

EDITED:
no problem instead with last fenix UBUNTU 22.04 release, all seems to work, only have to try real SPI device attacked (adxl345 accelerometer module)

btw nothing to do with Klipper (3D printer firmware), while enabling i2c with different hardware module (not SPI adxl345, but I2C GY-521) all works well, and I can make input shaper tests with them. So, in some ways, I solved for tests, but SPI not seems to work at 100%, klipper revognizes SPI module, but on test, give comunication error:

on command: accelerometer_query

error appears: Invalid adxl345 id (got ff vs e5).

This is generally indicative of connection problems
(e.g. faulty wiring) or a faulty adxl345 chip.

the module was tested and working on a RP2040.

btw, test with spi.c works well, and “hello world” is written correctly.

Can you try this debian package on Debian ?

https://dl.khadas.com/.test/vim1s/khadas-vim1s-linux-5.4-dt-overlays_1.4~c727217_arm64.deb

I’ll try, thanks.
For now I’m testing VIM3L board, that has same problem on enabling spi1 pins…

Hello @pappicio

@ivan.li will check and update here.

checked, and create spidev0.1, but loose “gpio readall” (unknown comand), but with gpioinfo installed, I can see spi pin, but isn’t PINZ_3, but PINX_10, as in image.

so, I cannot try, cos PINX_10 not in pin header.

but maybe I’m wrong, also on raspberry the spi pins are marked as “unused” but accelerometer works… tomorriw I’ll retry to cinnect it to SPIZ pins to test if works…

no, just checked and on raspberry with SPI enabled thay are marked in this way:

zzzzzzz

We suggest you to use Ubuntu to check the full fucntions, the debian image may have many functions missing, we don’t provide much support on Debian just can bootup.

Originally we telling about Ubuntu, no spi Port enabled, tried also new .Deb files on Ubuntu, nothing to do. Tried on Debian with Debian .Deb file , nothing…
No problem for me to use Ubuntu instead of Debian, but the results are same, missing spi Port. Also on VIM3L, where I’ve tried both Ubuntu and Debian Fenix releases, no spi Port.
You tell me what to do, and I’ll do It, hopeing we, finally, found what described into docs, in this case, SPI Port!