<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Direct Hardware Register Access in Zephyre</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83240/direct-hardware-register-access-in-zephyre</link><description>Hello.. I want to access the nRF5340 registers to maniulate there values, for example : If, I want to acess the PSEL.RTS register or CONFIG of UART0 to initialize these. How may I have access of these to write any instruction like PSEL.RTS = 0x......</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Jan 2022 07:20:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83240/direct-hardware-register-access-in-zephyre" /><item><title>RE: Direct Hardware Register Access in Zephyre</title><link>https://devzone.nordicsemi.com/thread/347059?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 07:20:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cae02327-52b7-4c90-9753-b64c7b324b02</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Gulzar Singh,&lt;/p&gt;
[quote user="mexco"]For example: let I want led on Pin 12 of P0[/quote]
&lt;p&gt;#define led_pin 12&amp;nbsp;&lt;br /&gt;#define button_pin (30 + 31)&amp;nbsp; &amp;nbsp;// Since on port1.&lt;br /&gt;&lt;br /&gt;Note that nRF53 does only have 48 general purpose I/= pins so 30 on P1 is not a valid pin.&lt;/p&gt;
[quote user="mexco"]2. I am using nRF5340DK kit. Does , the default internal Clock Nordic SOC starts automatically jut after power on or need some&amp;nbsp;configuration ?[/quote]
&lt;p&gt;The clock sources can be configured and you can set them to be automatically started. there is a lot of info regarding that in devzone like &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/62691/how-can-i-use-zephyr-s-api-to-set-clock-source-to-external-32mhz-crystal-for-nrf52840-dk"&gt;here&lt;/a&gt;. Please search for those threads and see if you find them useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Direct Hardware Register Access in Zephyre</title><link>https://devzone.nordicsemi.com/thread/347024?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 20:21:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33fe983e-9c22-4b5b-8bd9-7fec86742414</guid><dc:creator>mexco</dc:creator><description>&lt;p&gt;Dear,&lt;/p&gt;
&lt;p&gt;1. How to generate this pin constant:&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/83240/direct-hardware-register-access-in-zephyre/346832#346832"]#define led_pin 21[/quote]
&lt;p&gt;For example: let I want led on Pin 12 of P0, Button on Pin 30 of P1 .. then how will the pin constant to use above #define led ..., #define Button ...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. I am using nRF5340DK kit. Does , the default internal Clock Nordic SOC starts automatically jut after power on or need some&amp;nbsp;configuration ?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Direct Hardware Register Access in Zephyre</title><link>https://devzone.nordicsemi.com/thread/346832?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 07:33:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96f7928e-4400-4145-830c-80b0ae56894d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;depends on how you are using led_pin? If you are using v1.8.0\nrf\lib\dk_buttons_and_leds\dk_buttons_and_leds.c library, then you should set the led pins in the device tree (zephyr\boards\arm\nrf5340dk_nrf5340\nrf5340_cpuapp_common.dts) for example &amp;quot;led0&amp;quot; node. This is set for the DK board of nRF5340 and if your board is different, then you should create board files for your own board.&lt;/p&gt;
&lt;p&gt;If you want to access directly the gpio, then use the API provided in modules\hal\nordic\nrfx\hal\nrf_gpio.h. for example if you want to toggle and led with gpio number 21, then you just use&amp;nbsp;nrf_gpio_pin_toggle(21);&amp;nbsp;It should be enough to just define is as below in this case&lt;/p&gt;
&lt;p&gt;#define led_pin 21&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Direct Hardware Register Access in Zephyre</title><link>https://devzone.nordicsemi.com/thread/346816?ContentTypeID=1</link><pubDate>Sun, 09 Jan 2022 17:14:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c60fb758-fee1-48da-8672-dfc8e711b154</guid><dc:creator>mexco</dc:creator><description>&lt;p&gt;Hi Susheel, I have gone through these files. How may I rename a GPIO pin for example : if I want to use Port0 pin 2 as led_pin, then may I define as :&lt;/p&gt;
&lt;p&gt;#define led-pin ...?&lt;/p&gt;
&lt;p&gt;or static const led_pin ..?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Direct Hardware Register Access in Zephyre</title><link>https://devzone.nordicsemi.com/thread/345934?ContentTypeID=1</link><pubDate>Tue, 04 Jan 2022 13:58:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8ab7652-3aa0-4b8a-b7a2-f773c1cdf198</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am not sure if I understand your question correctly.&lt;/p&gt;
&lt;p&gt;Irrespective of any RTOS or bare metal based system, you should not directly access any peripheral register while using any driver/library that does it for you. But if you are not using any driver or library then you access the registers the same using NRF_XXX-&amp;gt;REGISTER which are defined in the &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nRF-MDK/Download?lang=en#infotabs"&gt;MDK &lt;/a&gt;files in these files&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3463.nrf5340_5F00_application.h"&gt;devzone.nordicsemi.com/.../3463.nrf5340_5F00_application.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0310.nrf5340_5F00_application_5F00_bitfields.h"&gt;devzone.nordicsemi.com/.../0310.nrf5340_5F00_application_5F00_bitfields.h&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>