SPI frequency issue on nRF7002 DK

Hi there

I'm trying to make the SPI work on nRF53 (My board is nRF7002 DK) refer the tutorial academy.nordicsemi.com/.../ but I had the issue about frequency of spi peripheral.

Specifically:
When I config the the max frequency of SPI equal to 125Khz, I can get the output signal on the logic analyzer

&spi1 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    pinctrl-0 = <&spi1_default>;
    pinctrl-1 = <&spi1_sleep>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
    max-frequency = <0x7a1200>;
    gendev: gendev@0 {
        compatible = "vnd,spi-device";
        reg = <0>;
        spi-max-frequency = <125000>;  // <= THIS CHANGE
        label = "GenDev";
    };
};

But when I try to change the frequency of SPI to higher, such as 500Khz, 1MHz. Signal on logic analyzer becomes strange (Please refer below picture)

&spi1 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    pinctrl-0 = <&spi1_default>;
    pinctrl-1 = <&spi1_sleep>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
    max-frequency = <0x7a1200>;
    gendev: gendev@0 {
        compatible = "vnd,spi-device";
        reg = <0>;
        spi-max-frequency = <1000000>;  // <= THIS CHANGE
        label = "GenDev";
    };
};
I also tried with SPI0-> SPI4 but still get the same issue
Below is the source code I used (I use nRF connect SDK 2.9.0)
Did I miss anything? Looking forward to your feedback.
Thank you
Parents Reply Children
  • Thank you for reply

    1. What pins are you using for SPI data pins in your sample here?

    My full device tree:

    &spi1 {
        compatible = "nordic,nrf-spim";
        status = "okay";
        pinctrl-0 = <&spi1_default>;
        pinctrl-1 = <&spi1_sleep>;
        pinctrl-names = "default""sleep";
        cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
        max-frequency = <0x7a1200>;
        gendev: gendev@0 {
            compatible = "vnd,spi-device";
            reg = <0>;
            spi-max-frequency = <125000>;  // <= THIS CHANGE
            label = "GenDev";
        };
    };

    &pinctrl {
    spi1_default: spi1_default {
    group1 {
    psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,
    <NRF_PSEL(SPIM_MOSI, 0, 7)>,
    <NRF_PSEL(SPIM_MISO, 0, 26)>;
    };
    };
    spi1_sleep: spi1_sleep {
    group1 {
    psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,
    <NRF_PSEL(SPIM_MOSI, 0, 7)>,
    <NRF_PSEL(SPIM_MISO, 0, 26)>;
    low-power-enable;
    };
    };
    };

    I got this on the sample refer the SPI tutorial of Nordic https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-5-serial-peripheral-interface-spi/topic/zephyr-spi-api/

    You can also check my full code in the attachment

    2. Note that some of the pins are connected to other function on the DK already

    I'm using nRF7002-DK (PCA10143). I checked this don't use the pin 0.06, 0.07, 0.26 and 0.25.

    Below is the detailed image of the board I used.

    3. What kind of SPI device are you trying to communicate with here?

    That's just a sample. There I try to send SPI signal and read it with logic analyzer.

    The problem is when I config the spi-max-frequency = <125000>;, I can capture the signal on logic analyer. But when I changed this to spi-max-frequency = <1000000>;, I just get the CS signal and no MOSI or SCK signal (See the image I attached in the original post)

    4. Do you see any logging from the application when running this project on your end?

    I don't see any unusual phenomenon on the Log (Use printf). LED flashes normally

    You can check the operation on the attachment

    If you need more information, please let me know

    Have a nice day

Related