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

regarding customization for Thing52


I'm planning to make a custom board using Thing52, following the reference desing.
I have some questions
(1) Can I use nRF52840 instead of nRF52832?
(2) Do you provide an SPI example code that is simulate with GPIO?
I need to implement software SPI because the device I want to control only provides GPIO interface

thanks

sjkim

Parents Reply Children
  • I want to to execute the SPI protocol operation using GPIO Pins, want to configure to
    single master operation.
    Can any one provide me or help me in writing code that can simulate SPI timings using GPIO.
    I want to control the SPI device using GPIO in nRF52 as follow.

    void write_1byte_spi (uint8_t spidata)
    {
         for (j=0 ; j <= 7; j++) {
             if (((spidata << j) & 0x80) == 0)
                  GPIO_SPI_DATA_LOW();
            else
                 GPIO_SPI_DATA_HIGH();


             GPIO_SPI_CLK_LOW();
             GPIO_SPI_CLK_HIGH();
             spi_out_data = GPIO_SPI_DATA_READ();
             GPIO_SPI_CLK_LOW();
        }

          ............
    }

    thanks

    sjkim

  • If you take a look at the SPI Master & Slave examples, you notice that the pins do use the GPIOs on the nrf52 dev kit (see where SPI_SS_PIN, SPI_MISO_PIN, SPI_MOSI_PIN & SPI_SCK_PIN are defined in sdk_config.h). For example SPI_SS_PIN uses GPIO pin P0.29 on the nrf52 dk.

Related