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

Arduino SPI PIN number

Hi Dev Zone, 

I am going to communicate my nRF52840 Preview DK with an arduino shield. I am checking the PIN number. According to the information about the Arduino board, the SPI pins are 10,11,12,13. Corresponding to nRF52840 Preview DK, they are p1.12, p1.13, p1.14, p1.15.

However, from some nRF52480 example code, the PIN are setting as:

#define SPI_MOSI_PIN 23 // MOSI (P0.23)
#define SPI_MISO_PIN 24 // MISO (P0.24)
#define SPI_SCK_PIN 25 // SCK (P0.25)
#define SPI_SCE_PIN 22 // SS (P0.22)

I am very confused, could you please help me clarify the PIN number for nRF52480 preview DK? 

Thanks!! 

Parents
  • Hi,

    Example SPI configuration for Arduino shield can be found in file st7565LCD.c (sdk\nrf5\examples\peripheral\spi_master_using_nrf_spi_mngr)

    It has following configuration:


    .sck_pin = ARDUINO_13_PIN,
    .mosi_pin = ARDUINO_11_PIN,
    .miso_pin = NRF_DRV_SPI_PIN_NOT_USED,
    .ss_pin = ARDUINO_10_PIN,

  • Thanks!

    In st7565LCD.c file,

    1) Could you please tell me which functions are used to read and write data to SPI peripheral device?

    2) Is it possible to read and write the registers such as SPDR, SPSR and how to access the bit such as SPIF?

    Sorry about these specific questions. The Arudino shield I am using uses a 3rd party library and AVR library, in that library, it uses SPDR, SPSR register and set register's bit.  

     

  • Hi,

    Regarding second point file st7565LCD.c is using spi transaction manager so you will not find direct access to registers as it is too high abstraction layer for SPI. You can read a bit more about SPI transaction manager here.

    Functions used for communication:

    nrf_spi_mngr_schedule  - you can schedule many transactions which will be processed via interrupts when the bus is free.

    nrf_spi_mngr_perform - you can schedule one transaction and you will wait until it is finished.

Reply
  • Hi,

    Regarding second point file st7565LCD.c is using spi transaction manager so you will not find direct access to registers as it is too high abstraction layer for SPI. You can read a bit more about SPI transaction manager here.

    Functions used for communication:

    nrf_spi_mngr_schedule  - you can schedule many transactions which will be processed via interrupts when the bus is free.

    nrf_spi_mngr_perform - you can schedule one transaction and you will wait until it is finished.

Children
No Data
Related