gschorcht / spi-ch341-usb

Linux kernel driver for CH341A USB to SPI and GPIO adapters
160 stars 63 forks source link

No /dev/spidevA.B #22

Open xboxplayer9889 opened 2 years ago

xboxplayer9889 commented 2 years ago

I tried to compile and insert in Mageia Linux 5.15.23-desktop-1.mga8 and an old computer with Debian Linux too. The Debian could compile and start /dev/spidev0.0-2 auto, but Mageia doesn't creates spidev devices.

`make

Error! Unknown action specified: spi-ch341-usb make -C /lib/modules/5.15.23-desktop-1.mga8/build M=/root/gschorcht/spi-ch341-usb-master modules make[1]: Entering directory '/usr/src/kernel-5.15.23-desktop-1.mga8'

Error! Unknown action specified: spi-ch341-usb CC [M] /root/gschorcht/spi-ch341-usb-master/spi-ch341-usb.o

Error! Unknown action specified: spi-ch341-usb MODPOST /root/gschorcht/spi-ch341-usb-master/Module.symvers CC [M] /root/gschorcht/spi-ch341-usb-master/spi-ch341-usb.mod.o LD [M] /root/gschorcht/spi-ch341-usb-master/spi-ch341-usb.ko make[1]: Leaving directory '/usr/src/kernel-5.15.23-desktop-1.mga8' ` after loading spi-ch341-usb.ko new spi devices appears in /sys/class/spi_master/spi0 but no /dev/spidev.

`journalctl -ae

kernel: usbcore: registered new interface driver spi-ch341-usb kernel: usb 1-9: new full-speed USB device number 6 using xhci_hcd kernel: usb 1-9: New USB device found, idVendor=1a86, idProduct=5512, bcdDevic> kernel: usb 1-9: New USB device strings: Mfr=0, Product=0, SerialNumber=0 kernel: spi-ch341-usb 1-9:1.0: ch341_cfg_probe: output cs0 SPI slave with cs=0 kernel: spi-ch341-usb 1-9:1.0: ch341_cfg_probe: output cs1 SPI slave with cs=1 kernel: spi-ch341-usb 1-9:1.0: ch341_cfg_probe: output cs2 SPI slave with cs=2 kernel: spi-ch341-usb 1-9:1.0: ch341_cfg_probe: input gpio4 gpio=0 irq=0 (hwi> kernel: spi-ch341-usb 1-9:1.0: ch341_cfg_probe: input gpio5 gpio=1 irq=1 kernel: spi-ch341-usb 1-9:1.0: ch341_spi_probe: SPI master connected to SPI bu> kernel: spi-ch341-usb 1-9:1.0: ch341_spi_probe: SPI device /dev/spidev0.0 crea> kernel: spi-ch341-usb 1-9:1.0: ch341_spi_probe: SPI device /dev/spidev0.1 crea> kernel: spi-ch341-usb 1-9:1.0: ch341_spi_probe: SPI device /dev/spidev0.2 crea> kernel: spi-ch341-usb 1-9:1.0: ch341_usb_probe: connected`

xboxplayer9889 commented 2 years ago

I can create it manually echo spidev > /sys/bus/spi/devices/spiB.C/driver_override echo spiB.C > /sys/bus/spi/drivers/spidev/bind

https://www.kernel.org/doc/html/latest/spi/spidev.html

And now I found: https://github.com/dimich-dmb/spi-ch341-usb#using-spi-slaves

xboxplayer9889 commented 2 years ago

Although I can compile and load driver, there is some error maybe I did something not well, but I cannot access anything on spidev0.0 with:

I can connect AT25DF321A to ch341a-SPIinterface and flashrom can read/write it on its builtin spi (ch341_spi) but no flash found on linux_spi:dev=/dev/spidev0.0. I tried to read id from C but debian always read FF FF FF FF, Mageia gives error. I tried avrdude mod with linuxspi, but couldn't found atmel chips on both Linuxes above.

Can anybody help which device/ic works and how to access it through this spi-dev driver?