Kreyren/kreyren

Sending Serial Peripheral Interface (SPI) payload over USB on linux

Closed this issue · 6 comments

I want to be able to sent SPI payload over USB for flexibility where i expect to be able to do:

  • VBIOS flash
  • BIOS flash
  • pinetime flash

I was thinking i could get https://www.neven.cz/kategorie/elektronicke-soucastky/elektronicky-vyvoj/programatori-a-prislusenstvi-k-programovani/eeprom-flash-bios-usb-programator-s-cipem-ch341a-spi/ and do just cat file.rom > /dev/device but that is apparently not the case?

Solution: https://youtu.be/r8f-3syiFSc?t=385

Relevant

  1. Linux driver for MCP2210 https://github.com/daniel-santos/mcp2210-
    linux
  2. FOSDEM presentation about SPI over USB on linux https://archive.fosdem.org/2018/schedule/event/rapid_spi_over_usb/
  3. Linux driver for SPI over USB using ch341 https://github.com/gschorcht/spi-ch341-usb
  4. Linux kernel docs on SPI https://www.kernel.org/doc/html/v4.13/driver-api/spi.html
  5. Reference to use ch341a on linux for SPI https://jensd.be/980/linux/bios-or-spi-programming-on-windows-or-linux-using-a-ch341a
    5.1. https://www.youtube.com/watch?v=r8f-3syiFSc&feature=emb_title

Would FTDI work? They have good driver support in UART.

Would FTDI work? They have good driver support in UART.

Can you eleborate how do you think it would work?

Like getting a FTDI chip that is enumerated as "something" that would allow cat file.rom > /dev/device ?

FWIW linux can do VBIOS flash using:

kreyren@system~$ echo 1 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom
kreyren@system~$ cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom > ~/rom.dump
kreyren@system~$ cat ~/file.rom > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom
kreyren@system~$ echo 0 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom

Which is what i though would be possible through the USB interface as this is for a scenario where the board is not detectable in the system e.g. https://github.com/kreyware/repairs/issues/1.

to clarify: dependency on flashrom is acceptable (current solution using ch341a + flashrom)

Hm.. So was the vBIOS?

andrealmeid.com/post/2020-05-01-vbios2

andrealmeid.com/post/2020-04-10-vbios @dantecpu

The GPU is not flashable over linux (gets me adapter err)

What does that mean

I am currently satisfied with flashrom + CH341A