migration from 1.9.1 to 2.1.2

Hi,

I'm migrating a vscode project from 1.9.1 to 2.1.2.

I'm testing on  nrf52840dk_nrf52840.

I'm using I2S.

In the 1.9.1 environment I have an overlay.

&i2s0: &i2s0 {
status = "okay";
sck-pin = <25>;
lrck-pin = <26>;
sdout-pin = <27>;
};

and i2s works fine, but I can't make it work in the 2.1.2 environment.

If I compile in 2.1.2 without an overlay the compile works, but  the zephyr.dts has the following for i2s0.

i2s0: i2s_rxtx: i2s@40025000 {
compatible = "nordic,nrf-i2s";
#address-cells = < 0x1 >;
#size-cells = < 0x0 >;
reg = < 0x40025000 0x1000 >;
interrupts = < 0x25 0x1 >;
status = "disabled";;
};

If I add an overlay the changes status from disabled to ok the compile fails because there is no pinctrl entry for i2s0.

My prj.conf has the following line

'

CONFIG_I2S=y

What do I have to do to enable I2s in 2.1.2?

Parents Reply Children
  • Pin Ctrl was added in NCS 2.0.  so you will need to add reference to it in your overlay if you are changing the pins.

    If you look at the attached code you can add this to the overlay and see if that helps.

    &i2s0 {
        status = "okay";
    	pinctrl-0 = <&i2s0_default>;
     	pinctrl-1 = <&i2s0_sleep>;
        pinctrl-names = "default", "sleep";
    };
    
    &pinctrl {
        i2s0_default: i2s0_default {
                group1 {
                        psels = <NRF_PSEL(I2S_MCK, 0, 12)>;
                        nordic,drive-mode = <NRF_DRIVE_H0H1>;
                };
    
                group2 {
                        psels = <NRF_PSEL(I2S_SCK_M, 0, 14)>,
                                <NRF_PSEL(I2S_LRCK_M, 0, 16)>,
                                <NRF_PSEL(I2S_SDOUT, 0, 13)>,
                                <NRF_PSEL(I2S_SDIN, 0, 15)>;
                };
    
        };
    
        i2s0_sleep: i2s0_sleep {
                group1 {
                        psels = <NRF_PSEL(I2S_MCK, 0, 12)>,
                                <NRF_PSEL(I2S_SCK_M, 0, 14)>,
                                <NRF_PSEL(I2S_LRCK_M, 0, 16)>,
                                <NRF_PSEL(I2S_SDOUT, 0, 13)>,
                                <NRF_PSEL(I2S_SDIN, 0, 15)>;
                        low-power-enable;
                };
    
        };
    };

  • Thank you so much.

    I added this code to my project and it seems to work (my test hardware is at my customers - he will test the new image for me in  day or two)

    I've a question or two, if that's OK.

    I think I understand the construct.

    Where do I find the documentation that tells me the details? 

    For a given peripheral:

         what pins go in groups 1 and 2

          what are their names

    Thanks

  • Here is the documentation on Pin Control 
    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_pinctrl.html
    The groups specify pin function selections and can share properties among the pins in the group

  • I've looked at the documentation and I don't see anything that tells me that the framework for i2s is

    {
    group1 {
    psels = <NRF_PSEL(I2S_MCK, 0, 12)>;
    nordic,drive-mode = <NRF_DRIVE_H0H1>;
    };

    group2 {
    psels = <NRF_PSEL(I2S_SCK_M, 0, 14)>,
    <NRF_PSEL(I2S_LRCK_M, 0, 16)>,
    <NRF_PSEL(I2S_SDOUT, 0, 13)>,
    <NRF_PSEL(I2S_SDIN, 0, 15)>;
    };

    How do I find that, for i2s the master clock is 

    <NRF_PSEL(I2S_MCK, 0, 12)>;

    and that it is in group1.

    What am I missing?

  • Hello Martin,

    Pinctrl can be a bit confusing at first, and the DevAcademy might explain it better than I do.

    KentOverton said:

    For a given peripheral:

         what pins go in groups 1 and 2

          what are their names

    They do not necessarily go into any groups. Though if you want a property on a specific pin you would have to group it, in order to enable the property. Properties are enabled on the pins in its group.

    So certain pins do not belong to a certain group, and the groups doesn't even need to be called group1,2 etc. 

    NRF_DRIVE_H0H1 enables high drive though, which is something you might want. I believe standard drive would otherwise be enabled by default, though I'm not sure about that.

    Merry Christmas & Regards,

    Elfving

Related