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

question about SPI communication.

I am using SDK version 17.0.2.
The example code uses SPI.

The following changes have been made to the pin settings.

nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
spi_config.ss_pin   = 28; ///SPI_SS_PIN;
spi_config.miso_pin = SPI_MISO_PIN;
spi_config.mosi_pin = 3;  //SPI_MOSI_PIN;
spi_config.sck_pin  = 4;  // SPI_SCK_PIN;
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL));

Questions

1. Pin behavior is strange.

Port Program Setup Pin Operation
SS 28 28
clock 4 3
MOSI 3 4

Why do the clock and MISO pins work interchangeably?

2. Why does the timing of the CLK signal increase and decrease??

3. Through the example code, it was confirmed that "Nordic" is expressed using SPI communication.
But it doesn't work.

#define SPI_INSTANCE  0 /**< SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);  /**< SPI instance. */
static volatile bool spi_xfer_done;  /**< Flag used to indicate that SPI instance completed the transfer. */

#define TEST_STRING "Nordic"
static uint8_t       m_tx_buf[] = TEST_STRING;           /**< TX buffer. */
static uint8_t       m_rx_buf[sizeof(TEST_STRING) + 1];    /**< RX buffer. */
static const uint8_t m_length = sizeof(m_tx_buf);        /**< Transfer length. */

Please let me know what mistake I made.

Parents Reply Children
No Data
Related