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

Configuring MISO pin for SPIM nrf52

Greetings I am working on an application that logs data to SPI flash device. I am having an issue where it appears that the pin configured as a MISO for SPIM is garbling up the flash device's responses. I have verified with a logic analyzer that the device response is correct when unloaded and gets corrupted when terminated into the Nordic development board (pca10040). I have noted the same behavior for all pins on the nrf52. I have also used a number of different flash devices (Adesto AT25XE021A type devices) all with the same result. After the spi peripheral is initialized, the application attempts to read the device ID from the flash module. The correct response should be 0x1F, 0x43, 0x01, 0x00 but instead I read 0x1E, 0x08, 0x00, 0x00...

I have included my init code for inspection and have also noted that there is an errata where the Pin CNF gets reset whenever the device goes to sleep when in debug interface mode.

Here is how my pins are defined in nrf_drv_config.h...

#define SPI1_ENABLED 1

#if (SPI1_ENABLED == 1)
#define SPI1_USE_EASY_DMA 1

#define SPI1_CONFIG_SCK_PIN         25
#define SPI1_CONFIG_MOSI_PIN        23
#define SPI1_CONFIG_MISO_PIN        24
#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW

#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
#endif

This is the inline function called to configure the GPIO for the MISO input...

__STATIC_INLINE void nrf_gpio_cfg_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config) {
    nrf_gpio_cfg(
            pin_number,
            NRF_GPIO_PIN_DIR_INPUT,
            NRF_GPIO_PIN_INPUT_CONNECT,
            pull_config,
            NRF_GPIO_PIN_S0S1,
            NRF_GPIO_PIN_NOSENSE); }

I have verified that the correct code is being called during initialization (SPI Master mode code) and am using the latest SDK code implementing the spi driver.

Other than the above mentioned errata, what could be causing the MISO signal to act as though it is being driven by the nrf52 even though it is configured as an input?

Any info would be appreciated!

Trog

Related