1 Reply Latest reply on Oct 27, 2017 2:18 AM by Lockdog

    D2000: how to connect the SPI to multiple slaves?

    Reingher

      how to connect 4 SPI as slaves the D200?

       

      Los pines SPI son SPI_M_SS[3:0]

       

      SPipon.png

       

      but the F1_SPI_M_SS1 is connected to BATTMON_1P8V_REF, How can I use it?

       

      SPI!.png

       

      how to connect the SPI to multiple slaves?

        • 1. Re: D2000: how to connect the SPI to multiple slaves?
          Lockdog

          Hi,

          Forget about SSx pins. You can use any other as Slave Select. Just need to initialize required GPIO and control it in your spi transfer functions.

          For example:

          #define sx1272_csn_enable() qm_gpio_clear_pin(QM_GPIO_0, CSN_SX1272)
          #define sx1272_csn_disable() qm_gpio_set_pin(QM_GPIO_0, CSN_SX1272)
          

           

          void writeRegister(uint8_t addr, uint8_t value)
          {
          qm_spi_transfer_t polled_xfer_desc;
          qm_spi_status_t status;
          
          uint8_t spi_buf[2];
          uint8_t rx_buf[2];
          
          spi_buf[0] = addr | 0x80;
          spi_buf[1] = value;
          
          polled_xfer_desc.tx = spi_buf;
          polled_xfer_desc.rx = rx_buf;
          polled_xfer_desc.tx_len = 2;
          polled_xfer_desc.rx_len = 2;
          
          sx1272_csn_enable(); //SS pin LOW
          qm_spi_transfer(QM_SPI_MST_0, &polled_xfer_desc, &status);
          sx1272_csn_disable(); //SS pin HIGH
          }