How to disable SPI and change to regular GPIO on Hilink HLK-7688a

please help, i need the GPIO pin to connect to my relay module using Hilink HLK-7688a board

what's left on my board is only SPI, can SPI be disabled and used as a GPIO pin that can respond to active Low or High?

I've tried changing the dts and dtsi files but the kernel panics always occur

I don’t see any Hilink devices in the table of hardware, is this an openwrt supported device?

1 Like

According to the dts, the flash chip is connected via SPI, so you can't disable SPI. What about UART1 and i2c?

Thank you for the information

for UART1 I use connect to RS485 module and I2C connect to RTC module

What about i2s?

If you are really out of pins, you could add an i2c or SPI GPIO extender. If you define it in the .dts you can use the pins like any other GPIO pin.

for i2s, the GPIO has been successfully changed via the dts file, still lacking 3 gpio to connect to the relay module

Hilink HLK-7688a module, there are many GPIO you could use, how about LED0 - LED4?
The worst case is using an I2C-to-GPIO chip on I2C bus.

for LED0 - LED4 already allocated to Leds WAN1, LAN1, LAN2, Alarm1 and Alarm2

WAN1, LAN1, LAN2 indications, are not important as the Relays.

I would go for an i2c port extender then - they are easy to use, cheap and work well (e.g. PCF8574A, MCP23018, SX1509 ...). Just keep in mind that the PCF cannot source much current, it won't work with active-high relays without additional circuitry (I had to redesign a PCB because of this and me not doing enough research).

btw, it would make matters a bit easier if you told us what you have already connected and which GPIOs are already occupied.

the following GPIOs have been connected :

  • UART1 for RS485 . module

  • i2c for RTC module

  • i2s > 3 pins for Digital Input and 1 pin for relay module

still need 3 more GPIO pins for relay module