Zephyr and Device Tree GPIO on Custom Board. GPIO won't turn on

Hello,

I'm currently using the nRF SDK V2.6.1 and Zephyr V3.5(.99?) The .99 is the "PATCH". I'm attempting to work with the nRF5340dk.

For context, I'm learning how to work with Zephyr, VS Code, and all that, since before this I was used to the SoftDevice.

I have tried a bunch of tutorials for GPIOs, but here's what doesn't make sense to me.

In VS Code, I created a new project based on the blinky sample, but I want to start from there, so I figured I'll add a simple gpio and start expanding from there.

So I created an Overlay file that looks like this:

And wrote a main file that looks like this:



And when I build it, the led from the original example lights up, but the other gpio (the "reset" pin) does not.

I have gone through several tutorials on the internet, but it doesn't help that most of them are using the original .dts file as opposed to the overlay, or the example doesn't work.

As per docs.zephyrproject.org/.../zephyr-user-node.html,
- I have attempted using the graphical DeviceTree functionality, to create an Overlay with the standard "zephyr,user" node, but the system Errors about not recognizing ZEPHYR_USER_NODE.
- I have attempted the code snippets attached and it doesn't work.

The code that I have compiles without error, but the GPIO just won't change. I have tried a couple other pin numbers, looking at device tree that they were not being used by something else, but I'm not sure how to get this to work.

I have also read other similar issues in the Nordic Support pages, but they seem to branch out towards different issues, where the solution doesn't seem to match what I'm doing.

Could you please provide a plain and simple example of how to add a custom GPIO from an overlay to a sample?

Thank you for your time,

Nico

Parents
  • Ok, I was able to get it going by switching to pin 0.12 as per  Can't override pin assignment in .overlay.

    However, I was trying to use P0.03, which connects to nft pins (nftc).  so I modified my overlay file to include

    And I switched to build for the secure setting, because I'll need to access the UICR register as per: devzone.nordicsemi.com/.../config_nfct_pins_as_gpios-y-doesn-t-work


    But I guess that's where I'm stuck...

  • Ok, I just realized that in the Dev Kit there are two unpopulated resistors to be able to enable P0.03 (an P0.02) because they are otherwise NFC pins by default.

    Please feel free to close this ticket as I was able to confirm that the code I presented does change the pin value, but I just couldn't see it happen because the resistors are not connected.

Reply
  • Ok, I just realized that in the Dev Kit there are two unpopulated resistors to be able to enable P0.03 (an P0.02) because they are otherwise NFC pins by default.

    Please feel free to close this ticket as I was able to confirm that the code I presented does change the pin value, but I just couldn't see it happen because the resistors are not connected.

Children
No Data