Community
cancel
Showing results for 
Search instead for 
Did you mean: 
JGarc41
Beginner
928 Views

D2000: how to connect the SPI to multiple slaves?

how to connect 4 SPI as slaves the D200?

Los pines SPI son SPI_M_SS[3:0]

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

how to connect the SPI to multiple slaves?  

0 Kudos
1 Reply
AZimi
New Contributor II
64 Views

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

}

Reply