Skip to content

Support for hardware SPI on NEC V25 port#2453

Merged
ghaerr merged 5 commits intoghaerr:masterfrom
swausd:master
Nov 13, 2025
Merged

Support for hardware SPI on NEC V25 port#2453
ghaerr merged 5 commits intoghaerr:masterfrom
swausd:master

Conversation

@swausd
Copy link
Copy Markdown
Contributor

@swausd swausd commented Nov 13, 2025

ssd-sd block driver now supports hardware SPI on NEC V25 MCU or software SPI (bit-banged) on 8018x and NEC V25. Added new option Interface SD card with hardware SPI in make menuconfig if NEC V25 system is selected. The bit banged driver should only be used if the serial port 0 is not available.

The new hardware driver use SPI Mode 3 (hardware limit of V25) on serial port 0. Despite SD cards usually require SPI mode 0, the hardware driver in mode 3 works with all the different SD cards i have (3 different brands, two noname and sandisk compact extreme).

Clock is configurable by setting prescaler value in the driver code spi-hw-necv25.S. Default CPU clock / 2 which is the max clock usable. For my current system that is 5 MHz. With the bit-banged driver it is about 128KHz.

I introduced two new assembler functions for block read/write and changed ssd-sd.c accordingly.
Minix filesystem should be used as this is much faster than FAT16.

For connecting the SD card and port usage see spi-hw-nev25.S and sp-necv25.S.

swausd added 5 commits November 12, 2025 10:47
New driver for hardware SPI Mode 3 SD card interface using serial port 0 in synchronous IO mode. Baud rate can be configured in spi-hw-necv25.S default CPU clock/2. which is the fastest clock possible.
Added new option in config.in for CONFIG_HW_SPI if CONFIG_ARCH_NECV25 is selected
and renamed spi-8018x.h to spi.h
@ghaerr
Copy link
Copy Markdown
Owner

ghaerr commented Nov 13, 2025

Thank you @swausd, fantastic work as always! This is very nice having both software and hardware SPI drivers in ELKS! :)

@ghaerr ghaerr merged commit 21ccb78 into ghaerr:master Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants