hello there i want to interface nrf51 dk with ds3234 using spi. i see spi master example. how to assign SPI I/O pins. can you tell me how to do it?? i find SPIMO_SCK_PIN. how to know about pin numbers??
hello there i want to interface nrf51 dk with ds3234 using spi. i see spi master example. how to assign SPI I/O pins. can you tell me how to do it?? i find SPIMO_SCK_PIN. how to know about pin numbers??
Hi
The pin configuration for nRF51 peripherals is usually fetched from a configuration file specific for the development board that you are using. If you are using the the nRF51-DK (PCA10028) then the configuration is in file \nRF51_SDK_10.0.0_dc26b5e\examples\bsp\pca10028.h. In this file, the configuration for e.g. the SPI master 0 and SPI master 1 is defined as
#define SPIM0_SCK_PIN 4 /**< SPI clock GPIO pin number. */
#define SPIM0_MOSI_PIN 1 /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM0_MISO_PIN 3 /**< SPI Master In Slave Out GPIO pin number. */
#define SPIM0_SS_PIN 2 /**< SPI Slave Select GPIO pin number. */
#define SPIM1_SCK_PIN 15 /**< SPI clock GPIO pin number. */
#define SPIM1_MOSI_PIN 12 /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM1_MISO_PIN 14 /**< SPI Master In Slave Out GPIO pin number. */
#define SPIM1_SS_PIN 13 /**< SPI Slave Select GPIO pin number. */
So change those defines in order to connect SPI master to different GPIO pins.
Then in order to enable SPI0 master in e.g. the spi_master example, you must do that in the driver configuration file \nRF51_SDK_10.0.0_dc26b5e\examples\peripheral\spi_master\config\spi_master_pca10028\nrf_drv_config.h by defining
#define SPI0_ENABLED 1