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

Proper peripheral configuration with overlay file

Good evening, 

I am using a nrf52840DK to set up a product prototype and I have a couple of questions about the peripherals. My nRF Connect SDK version is 1.5.99.

1. I am building for the nrf52840dk_nrf52840 target and use an overlay file to overwrite with my own configs. I have an interrupt signal I want to put on P0.20. But that pin is used for qspi as defined in nrf52840dk_nrf52840.dts. How do I deactivate qspi so I can use that pin for my purpose? I know I could just use another one but for sake of knowing it, I am looking for an answer. I have this in my overlay file, but it doesn't seem to have an effect, at least the interrupt signal is not coming. (I tested it on other pins and it works, so I am sure that the code is not the problem).

&qspi {
status = "disabled";
};

2. Some peripherals cannot be used at the same time, e.g. spi0 and i2c0 cannot be used together. I found out after looking at the .dts files. Is that information documented somewhere else? What's the technical reason?

3. Some pins are marked as Standard drive, low frequency I/O only in the docs. But the .dts file for the nRF52840DK put for example SPI on these pins, why is that? Is it for sake of Arduino compatibility or doesn't it matter that much in the end? I will follow the recommandation but I'm just curious why the peripherals are being put there by default.

Looking forward for some enlightenment!

Parents
  • Hi,

    I am sorry for the late reply, there has been some public holidays here in Norway and Devzone staffing a bit lower.

    1. I am building for the nrf52840dk_nrf52840 target and use an overlay file to overwrite with my own configs. I have an interrupt signal I want to put on P0.20. But that pin is used for qspi as defined in nrf52840dk_nrf52840.dts. How do I deactivate qspi so I can use that pin for my purpose? I know I could just use another one but for sake of knowing it, I am looking for an answer. I have this in my overlay file, but it doesn't seem to have an effect, at least the interrupt signal is not coming. (I tested it on other pins and it works, so I am sure that the code is not the problem).

    &qspi {
    status = "disabled";
    };

    The code for disabling looks correct to me, so I am not sure why it's not working for you. How do you know it isn't working? And how does your zephyr.dts looks like? Is it included in the build?

    2. Some peripherals cannot be used at the same time, e.g. spi0 and i2c0 cannot be used together. I found out after looking at the .dts files. Is that information documented somewhere else? What's the technical reason?

     Some peripherals share the same peripheral ID and base address, it could be because the peripheral share some registers or other common resources, or their operation are mutually exclusive, etc. You can read more about the Peripheral interface and Peripheral ID in the nRF52840 Product Specification or in this page in the infocenter.

    If you take a look at the instatiation table you will see that TWI0 and SPI0 share the same base address and you can only enable one at a time. You can use SPI0 and TWI1 instead for example.

    3. Some pins are marked as Standard drive, low frequency I/O only in the docs. But the .dts file for the nRF52840DK put for example SPI on these pins, why is that? Is it for sake of Arduino compatibility or doesn't it matter that much in the end? I will follow the recommandation but I'm just curious why the peripherals are being put there by default.

     This is mainly a design choice for Arduino shield compatibility yes, perhaps based on the pins we had available for routing, since there is no many GPIO pins extras when using LEDs, buttons, analog pins, etc in the DK. Using standard drive, low frequency i/o pins will only affect the radio sensitivity if you have high drive/frequency while the radio is active, so using these pins for SPI between radio events is no problem. That said the nRF52840 DK is no meant to be used in production but as a development tool, so having a couple of dB lower sensitivity while doing FW development should not be a problem either.

     Best regards,

    Marjeris

Reply
  • Hi,

    I am sorry for the late reply, there has been some public holidays here in Norway and Devzone staffing a bit lower.

    1. I am building for the nrf52840dk_nrf52840 target and use an overlay file to overwrite with my own configs. I have an interrupt signal I want to put on P0.20. But that pin is used for qspi as defined in nrf52840dk_nrf52840.dts. How do I deactivate qspi so I can use that pin for my purpose? I know I could just use another one but for sake of knowing it, I am looking for an answer. I have this in my overlay file, but it doesn't seem to have an effect, at least the interrupt signal is not coming. (I tested it on other pins and it works, so I am sure that the code is not the problem).

    &qspi {
    status = "disabled";
    };

    The code for disabling looks correct to me, so I am not sure why it's not working for you. How do you know it isn't working? And how does your zephyr.dts looks like? Is it included in the build?

    2. Some peripherals cannot be used at the same time, e.g. spi0 and i2c0 cannot be used together. I found out after looking at the .dts files. Is that information documented somewhere else? What's the technical reason?

     Some peripherals share the same peripheral ID and base address, it could be because the peripheral share some registers or other common resources, or their operation are mutually exclusive, etc. You can read more about the Peripheral interface and Peripheral ID in the nRF52840 Product Specification or in this page in the infocenter.

    If you take a look at the instatiation table you will see that TWI0 and SPI0 share the same base address and you can only enable one at a time. You can use SPI0 and TWI1 instead for example.

    3. Some pins are marked as Standard drive, low frequency I/O only in the docs. But the .dts file for the nRF52840DK put for example SPI on these pins, why is that? Is it for sake of Arduino compatibility or doesn't it matter that much in the end? I will follow the recommandation but I'm just curious why the peripherals are being put there by default.

     This is mainly a design choice for Arduino shield compatibility yes, perhaps based on the pins we had available for routing, since there is no many GPIO pins extras when using LEDs, buttons, analog pins, etc in the DK. Using standard drive, low frequency i/o pins will only affect the radio sensitivity if you have high drive/frequency while the radio is active, so using these pins for SPI between radio events is no problem. That said the nRF52840 DK is no meant to be used in production but as a development tool, so having a couple of dB lower sensitivity while doing FW development should not be a problem either.

     Best regards,

    Marjeris

Children
  • Hi Marjeris,

    thanks a lot for the explainations!

    The code for disabling looks correct to me, so I am not sure why it's not working for you. How do you know it isn't working? And how does your zephyr.dts looks like? Is it included in the build?

    I did know because the interrupt was not triggering, while changing to another pin, it worked. But If this is the correct way I will take a look at my configurations again, maybe I missed something else.

    If you take a look at the instatiation table you will see that TWI0 and SPI0 share the same base address and you can only enable one at a time. You can use SPI0 and TWI1 instead for example.

    That makes sense!

    That said the nRF52840 DK is no meant to be used in production but as a development tool, so having a couple of dB lower sensitivity while doing FW development should not be a problem either.

    That is true as well Slight smile

Related