nrf5340: How to Reconfigure Pins P0.08. P0.09, P0.10, P0.11, P0.12 for SPI Bus

Hello, 

I developed a driver for communicating with the kx134-1211 accelerometer over SPI for the nrf5340-dk. The driver works when the following pins are configured for SPI in the overlay file: 

 &spi1 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = <47>;
    mosi-pin = <45>;
    miso-pin = <46>;
    cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;

    kx134@0 {
        compatible = "rohm,kx134";
        label = "KX134";
        spi-max-frequency = <8000000>;
        reg = <0>;
        irq-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
    };
};

 Im trying to now move over to a custom nrf5340 board that I developed where the following pins are set for the SPI bus: 

 &spi1 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = <8>;
    mosi-pin = <10>;
    miso-pin = <9>;
    cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;

    kx134@0 {
        compatible = "rohm,kx134";
        label = "KX134";
        spi-max-frequency = <8000000>;
        reg = <0>;
        irq-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
    };
};
And I am unable to detect the device, either on my board or the DK by changing the overlay file to the new pin configuration. Ive probed the pins using my logic analyzer and I do not see the anticipated wave form either - indicating it is a pin configuring issue. 
When trouble shooting I came across the following post. It is shown that the network core is using pins 10,11 on for the dk board for its uart0 instance: 
On my custom board I am not using either of these features and I would like to just use the pins for my spi bus. 
The data sheet implies these pins should be configurable as GPIO and SPIM so im not sure if that is potentially the issue. 

Ive already tried the following: 
1. create an nrf5340dk_nrf5340_cpunet.overlay file to override the uart0 instance on the netcore: 
&uart0 {
    status = "okay";
    current-speed = <115200>;
    tx-pin = <33>;
    rx-pin = <32>;
    rx-pull-up;
    rts-pin = <4>;
    cts-pin = <5>;
    cts-pull-up;
};
2. Ive tried (1) in combination with  manually editing the dts files in the nrf5340dk_nrf5340 board file to comment out and delete all the button instances involving P0.08, P0.09
3. I've tried (both with and without (1)) manually editing the nrf5340dk_nrf5340 to change all instances of the following pins  P0.08. P0.09, P0.10, P0.11, P0.12 to available GPIO pins 
None of these approaches seemed to work. 
I was going to create a custom board file but since manually changing the nrf5340dk board api didnt work  it seems unlikely that effort would fix it until I can confirm there is nothing else I am unaware of here?  
Any help would be greatly appreciated. 
Thanks, 
Matt 
Parents
  • Hi Matt,

    Passing the control over detected pins to the network core has been changed here

    If you are using some older version of NCS, you might have an issue because pins might still be hardcoded instead of being configured to use devicetree. 
    In your case, pins 10 and 11 are probably hardcoded as you can see here and then used in the same file. You would probably need to comment out the lines where pins are assigned to the network core in the board file. 

    Best regards,
    Dejan

Reply
  • Hi Matt,

    Passing the control over detected pins to the network core has been changed here

    If you are using some older version of NCS, you might have an issue because pins might still be hardcoded instead of being configured to use devicetree. 
    In your case, pins 10 and 11 are probably hardcoded as you can see here and then used in the same file. You would probably need to comment out the lines where pins are assigned to the network core in the board file. 

    Best regards,
    Dejan

Children
Related