Move MFRC522 to dedicated SPI3_HOST bus (SCK16/MOSI17/MISO13/CS26) separate from display SPI2

This commit is contained in:
2026-09-10 07:13:15 +02:00
parent 05d8012c8b
commit 12690657cc
3 changed files with 57 additions and 32 deletions

View File

@@ -63,10 +63,18 @@ static void on_picc_state_changed(void *arg, esp_event_base_t base, int32_t even
esp_err_t rfid_manager_init(void)
{
/* Dedicated SPI3_HOST (HSPI) bus for the reader - independent controller
* so the display (SPI2_HOST) and the RFID never share bus timing. The
* rc522 driver will call spi_bus_initialize() itself on this host. */
static spi_bus_config_t rfid_bus_cfg = {
.sclk_io_num = HW_RFID_SCK_GPIO,
.mosi_io_num = HW_RFID_MOSI_GPIO,
.miso_io_num = HW_RFID_MISO_GPIO,
};
rc522_spi_config_t driver_config = {
.host_id = HW_SPI_HOST,
/* Bus already owned by spi_bus_manager: attaching as an extra device. */
.bus_config = NULL,
.host_id = HW_RFID_SPI_HOST,
.bus_config = &rfid_bus_cfg,
.dev_config = {
.spics_io_num = HW_RC522_CS_GPIO,
.clock_speed_hz = RC522_SPI_CLK_HZ,