SPI port for 2 devices ?

Dear Members,




I want to use SPI LCD and Sdcard, they have different CS, but sharing the same SPI ports,

I have used different SPI instance but not giving us a good response yet, any clues ?

SPI1 for SDcard, SPI2 for LCD,

SPI configuration for LCD:

nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.ss_pin   = SPI_SS_PIN;
    spi_config.miso_pin = SPI_MISO_PIN;
    spi_config.mosi_pin = SPI_MOSI_PIN;
    spi_config.sck_pin  = SPI_SCK_PIN;
      spi_config.frequency = NRF_SPI_FREQ_1M;   ///< 4 Mbps


   nrf_gpio_cfg_output(SPI_DC_PIN_LCD);
      nrf_gpio_cfg_output(SPI_RES_PIN_LCD);

for SD card :

#define SDC_SCK_PIN      NRF_GPIO_PIN_MAP(0,21)  ///< SDC serial clock (SCK) pin.
#define SDC_MOSI_PIN    SER_CON_SPIS_MOSI_PIN  ///< SDC serial data in (DI) pin.
#define SDC_MISO_PIN     NRF_GPIO_PIN_MAP(0,20)  ///< SDC serial data out (DO) pin.
#define SDC_CS_PIN       ARDUINO_10_PIN    ///< SDC chip select (CS) pin.

Any ideas ? thanks

Parents
  • Hi there,

    Could you share more of your code and elaborate a bit more on what the issue is?

    I want to use SPI LCD and Sdcard, they have different CS, but sharing the same SPI ports,

    So the two SPI instances use the same GPIOs? Do you initialize and un-initialize the instances when you switch from one instance to the other? Only one instance should drive any GPIO at a time. 

    regards

    Jared 

Reply
  • Hi there,

    Could you share more of your code and elaborate a bit more on what the issue is?

    I want to use SPI LCD and Sdcard, they have different CS, but sharing the same SPI ports,

    So the two SPI instances use the same GPIOs? Do you initialize and un-initialize the instances when you switch from one instance to the other? Only one instance should drive any GPIO at a time. 

    regards

    Jared 

Children
No Data
Related