While looking into the mcp2515 driver I noticed something unexpected. In mcp2515_instantiate() it does the follofing: SPI_SETFREQUENCY(config->spi, CONFIG_MCP2515_SPI_SCK_FREQUENCY); SPI_SETMODE(config->spi, MCP2515_SPI_MODE); SPI_SETBITS(config->spi, 8); SPI_HWFEATURES(config->spi, 0);
In mcp2515_read_2regs() and all the other transfer functions it does the following: SPI_LOCK(priv->config->spi, true); SPI_SELECT(priv->config->spi, SPIDEV_CANBUS(0), true); SPI_EXCHANGE(priv->config->spi, priv->spi_txbuf, priv->spi_rxbuf, 4); SPI_SELECT(priv->config->spi, SPIDEV_CANBUS(0), false); SPI_LOCK(priv->config->spi, false); What puzzles me is that all he mode settings are done without locking the SPI and only once during the init phase. I would have expected it to be done in each and every transfer within the LOCK region. When I look into the e.g. RP2040 code then the config->spi doesn't look to be unique for the single mcp2515 instance. -- B.Walter <be...@bwct.de> https://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.