Multiple Devices on SPI Bus
Posted: Wed Jan 17, 2024 11:58 pm
Hello folks,
I have a DM9051 and a CC1201 running on the same SPI Bus. Both of them use polling transactions (spi_device_polling_transmit()) and work fine together most of the time. However, occasionally, I'll get a few errors like:
What is the best practices approach when working with multiple devices on the same SPI bus? Suppose the following scenario:
So, does this mean that the best practice here is to do some error checking and retrying when calling spi_device_acquire_bus()?
I have a DM9051 and a CC1201 running on the same SPI Bus. Both of them use polling transactions (spi_device_polling_transmit()) and work fine together most of the time. However, occasionally, I'll get a few errors like:
E (54778) spi_master: spi_device_acquire_bus(977): Cannot acquire bus when a polling transaction is in progress.
E (54788) spi_master: spi_device_polling_start(1043): Cannot send polling transaction while the previous polling transaction is not terminated.
What is the best practices approach when working with multiple devices on the same SPI bus? Suppose the following scenario:
- Task 1 calls spi_device_acquire_bus()
- Task 1 calls spi_device_polling_transmit() and sets the polling flag to true
- Task 2 calls spi_device_acquire_bus()
Code: Select all
SPI_CHECK(!spi_bus_device_is_polling(device), "Cannot acquire bus when a polling transaction is in progress.", ESP_ERR_INVALID_STATE );