Does Zephyr SPI APIs support two chip select pins?

I would like to use Zephyr SPI APIs (docs.zephyrproject.org/.../spi.html) to control external ADCs. Since I need two chip select pins for selection ADC1, ADC2, ADC3, and ADC4. Does Zephyr SPI APIs support two chip select pins?

Parents
  • Hi

    There is no problem with multiple external ADC, you just need to set them up in a overlay. 

    This is described https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/api/bindings/spi/nordic,nrf-spi.html

    You can see below how it was done on the thingy91 with two different accelerometers on the same SPI bus 

    Regards

    Runar

  • Thanks for your reply!

  • No worries, happy to help. I will just set this case to closed if that is okey with you? 

    Regards

    Runar

  • Thanks for your reply! Now I encounter another problem. From sample you provided, there are two SPI chip select pins (gpio0,8 and gpio0,7). How can I control SPI chip select for selecting adxl362 or adxl372?

  • If you are using the sensor api it you dont have to worry about it. The API does it for you https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/sensor.html#sensor-api 

    Regards

    Runar

  • Thanks for your reply! Which API is used for SPI chip selection?

  • Hi, are you using the sensor API I linked in my last post?  If not this blog covers how to use spi in zephyr for e generic device https://blog.golioth.io/how-to-use-generic-spi-devices-with-zephyr/ 

    Anyway you should not have to worry about the chip select 

    Regards

    Runar

Reply Children
    1. Thanks for your reply! I don't use sensor API in your last post. Do you mean if I access adxl362 or adxl372 device nodes directly, I don’t need to worry about SPI chip selection? If the answer is yes, does Nordic provide C samples to access adxl362 or adxl372?
  • That is correct, its well described in the blog from the last post. 

    I had a look and we don't have any samples for the adxl362 or adxl372 not using the sensor api. But there are Zephyr samples where they are used togheter with the Sensor API. If you check Zephyr/drivers/sensor/ you will find both the adxl362 or adxl372 that you can have a look at. 

    Regards

    Runar

  • Thanks for your reply!