This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

multi instance of spi on nrf52

Hi, i am new to embedded system.I want to use nrf52 DK as master and connected with two slaves by two spi channels. since in hardware design, I have designed the chip with two separated spi buses. hence i have to use two instances of spi. i have checked the spi example,but i am still confused about how to configure two spi instances.

 nrf_drv_spi_config_t const config ={
#if (SPI0_ENABLED == 1)
    .sck_pin  = SPIM0_SCK_PIN,
    .mosi_pin = SPIM0_MOSI_PIN,
    .miso_pin = SPIM0_MISO_PIN,
    .ss_pin   = SPIM0_SS_PIN,
#elif (SPI1_ENABLED == 1)
    .sck_pin  = SPIM1_SCK_PIN,
    .mosi_pin = SPIM1_MOSI_PIN,
    .miso_pin = SPIM1_MISO_PIN,
    .ss_pin   = SPIM1_SS_PIN,
#elif (SPI2_ENABLED == 1)
    .sck_pin  = SPIM2_SCK_PIN,
    .mosi_pin = SPIM2_MOSI_PIN,
    .miso_pin = SPIM2_MISO_PIN,
    .ss_pin   = SPIM2_SS_PIN,
#endif
.irq_priority = APP_IRQ_PRIORITY_LOW,
.orc          = 0xCC,
.frequency    = NRF_DRV_SPI_FREQ_1M,
.mode         = NRF_DRV_SPI_MODE_1,
.bit_order    = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST,
.ss_pin       = NRF_DRV_SPI_PIN_NOT_USED, //added by DS - if not specified, the nrf_drv_spi_init() will set this to high, which is wrong, CS for AS3911 is active low};

for this function, how to enable two spi instance and configure two sck, mosi,miso,ss pin? Is it possible to receive the data from two spi buses at the same time?

Thank you

Related