This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

two channels 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? is it possible to achieve on nrf52 DK. 1>How to set up and configure the two spi channels? should i enable both spi1 and spi0? 2>if possible Can anyone offer me some example?

Thank You very much!!

Parents Reply Children
  • hi wojtek, Thank you very much. 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?

Related