Nrf52dk_nrf52832 SPI test with default PINs work but it doesn't with the ones from my design

Hello everyone, 

I'm curretly working on a new design based on nrf52832, and I'm validating different interfaces.
Currently working on SPI, I'm testing it with a W25Q64 Flash and the PCA10040DK (nrf52832DK) and the spi_flash sample on NRF Connect SDK v3.0.2.  

This nrf52dk_nbrf52832.overlay files works : 

&spi1 {
    status = "okay";
    cs-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;

    pinctrl-0 = <&spi1_default>;
    pinctrl-1 = <&spi1_sleep>;
    pinctrl-names = "default", "sleep";

    w25q64: flash@0 {
        compatible = "jedec,spi-nor";
        label = "W25Q64";
        reg = <0>;
        spi-max-frequency = <8000000>;   /* nRF52 limit */
        jedec-id = [ef 40 17];
        size = <0x800000>;               /* 8 MiB */
    };
};



&pinctrl {

    spi1_default: spi1_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
                <NRF_PSEL(SPIM_MOSI, 0, 30)>,
                <NRF_PSEL(SPIM_MISO, 0, 29)>;
        };
    };

    spi1_sleep: spi1_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
                <NRF_PSEL(SPIM_MOSI, 0, 30)>,
                <NRF_PSEL(SPIM_MISO, 0, 29)>;
            low-power-enable;
        };
    };
};
It works and logs : 

W25Q64 SPI flash testing
========================

Perform test on single sector
Test 1: Flash erase
Flash erase succeeded!

Test 2: Flash write
Attempting to write 4 bytes
Data read matches data written. Good!!


But on my design I'd like to use  
P0.16 as SCK
P0.13 as MOSI
P0.14 as as MISO


And when I switch to it : 
    spi1_default: spi1_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 16)>,
                <NRF_PSEL(SPIM_MOSI, 0, 13)>,
                <NRF_PSEL(SPIM_MISO, 0, 14)>;
        };
    };

    spi1_sleep: spi1_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 16)>,
                <NRF_PSEL(SPIM_MOSI, 0, 13)>,
                <NRF_PSEL(SPIM_MISO, 0, 14)>;
            low-power-enable;
        };
    };

The sample logs : 
W25Q64: device not ready.


I've tried to look up what's happen on the analyser : 

When it fails :


When it succeeds : 

I don't see anythiong on the datasheet that would explain this, except maybe the TRACEDATA but I'm using RTT and logged NRF_CLOCK->TRACECONFIG == 0 so I guess this should'nt be a problem ? 




Anyway this is where I'm at so far, maybe some of you will help me with your lights I hope :) 

Have a good weekend,

Regards,

Aloïs KYROU
Parents
  • Hi,

    Your configs and dts seem correct. Usually this issue could occur because the pins are being initialized or used elsewhere. Could you verify that the pins P0.16, P0.13, or P0.14 are not being used by any other peripherals or by anything else on the custom board?

    Regards,

    Priyanka

  • Hi Priyanka and thanks for your answer,

    So far I'm still on the nrf52dk_nrf52832. 

    I checked and the pins were defined as buttons for the DK in the dts of the board : 

    buttons {
            compatible = "gpio-keys";
            button0: button_0 {
                gpios = <&gpio0 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 0";
                zephyr,code = <INPUT_KEY_0>;
            };
            button1: button_1 {
                gpios = <&gpio0 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 1";
                zephyr,code = <INPUT_KEY_1>;
            };
            button2: button_2 {
                gpios = <&gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 2";
                zephyr,code = <INPUT_KEY_2>;
            };
            button3: button_3 {
                gpios = <&gpio0 16 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 3";
                zephyr,code = <INPUT_KEY_3>;
            };
        };

    I added 

    /* Disable the four user buttons that ship with the nRF52-DK */
    &button0 {          
        status = "disabled";
    };

    &button1 {            
        status = "disabled";
    };

    &button2 {            
        status = "disabled";
    };

    &button3 {            
        status = "disabled";
    };


    To my overlay file but the problems is still here. Also I don't see any pin variation around the Chip select on the PINs I'd like to use (13,14 and 16) when I do the working version with default pins (31,30 29).



    How to check it further ? 

    Thanks in advance,
    Aloïs
Reply
  • Hi Priyanka and thanks for your answer,

    So far I'm still on the nrf52dk_nrf52832. 

    I checked and the pins were defined as buttons for the DK in the dts of the board : 

    buttons {
            compatible = "gpio-keys";
            button0: button_0 {
                gpios = <&gpio0 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 0";
                zephyr,code = <INPUT_KEY_0>;
            };
            button1: button_1 {
                gpios = <&gpio0 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 1";
                zephyr,code = <INPUT_KEY_1>;
            };
            button2: button_2 {
                gpios = <&gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 2";
                zephyr,code = <INPUT_KEY_2>;
            };
            button3: button_3 {
                gpios = <&gpio0 16 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                label = "Push button switch 3";
                zephyr,code = <INPUT_KEY_3>;
            };
        };

    I added 

    /* Disable the four user buttons that ship with the nRF52-DK */
    &button0 {          
        status = "disabled";
    };

    &button1 {            
        status = "disabled";
    };

    &button2 {            
        status = "disabled";
    };

    &button3 {            
        status = "disabled";
    };


    To my overlay file but the problems is still here. Also I don't see any pin variation around the Chip select on the PINs I'd like to use (13,14 and 16) when I do the working version with default pins (31,30 29).



    How to check it further ? 

    Thanks in advance,
    Aloïs
Children
No Data
Related