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

Creating Two SPI instances for same slave

We are using NRF52832, SDK 11.0.0.2 alpha, S132 soft Device ,I need some clarifications on using SPI,

  1. In nrf52832 SPI Master driver is it possible to create two SPI instances for the same slave device.
  2. If Yes is it possible to configure the instance as one for DMA transactions(USE_EASY_DMA==1) and the other for normal SPI transactions(USE_EASY_DMA==0).
Parents
  • If they are using the same pins it is no surprise i doesn't work. When uninitializing the SPI instance it will free the pins used, such that the SPIM instance will be able to use them. Try to do this instead of uninit:

    NRF_SPI1->PSEL.MISO = (SPI_PSEL_MISO_PSELMISO_Disconnected << SPI_PSEL_MISO_PSELMISO_Pos);
    NRF_SPI1->PSEL.MOSI = (SPI_PSEL_MOSI_PSELMOSI_Disconnected << SPI_PSEL_MOSI_PSELMOSI_Pos);
    NRF_SPI1->PSEL.SCK = (SPI_PSEL_SCK_PSELSCK_Disconnected << SPI_PSEL_SCK_PSELSCK_Pos);
    

    You will ofcourse have to set them up again (and disconnect the SPIM2 pins) before using SPI1 again.

Reply
  • If they are using the same pins it is no surprise i doesn't work. When uninitializing the SPI instance it will free the pins used, such that the SPIM instance will be able to use them. Try to do this instead of uninit:

    NRF_SPI1->PSEL.MISO = (SPI_PSEL_MISO_PSELMISO_Disconnected << SPI_PSEL_MISO_PSELMISO_Pos);
    NRF_SPI1->PSEL.MOSI = (SPI_PSEL_MOSI_PSELMOSI_Disconnected << SPI_PSEL_MOSI_PSELMOSI_Pos);
    NRF_SPI1->PSEL.SCK = (SPI_PSEL_SCK_PSELSCK_Disconnected << SPI_PSEL_SCK_PSELSCK_Pos);
    

    You will ofcourse have to set them up again (and disconnect the SPIM2 pins) before using SPI1 again.

Children
Related