<?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>Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77558/cant-change-registers-via-pionters-on-nrf53</link><description>Hi, I want write code on rust, but build system of nrf sdk for nrf5340 too hard for creating bindings, so I decide to create own HAL on rust and embed it in C with BLE stack on C. I start write test code on C for blinking leds on nrf5340dk. When I write</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 08 Aug 2021 21:23:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77558/cant-change-registers-via-pionters-on-nrf53" /><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/323895?ContentTypeID=1</link><pubDate>Sun, 08 Aug 2021 21:23:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60a5c133-ffe8-4758-a605-88f9ab14e7c9</guid><dc:creator>TiNy</dc:creator><description>&lt;p&gt;Thank for your answer and &lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;advice&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;. It work exactly how you say. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/322386?ContentTypeID=1</link><pubDate>Thu, 29 Jul 2021 08:41:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb6d08bc-723f-4a7d-bfec-18a89299298a</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hello again!&lt;br /&gt;&lt;br /&gt;Apologies for the delayed answer here. I reached out to some colleagues and they pointed out a mistake in your code.&amp;nbsp;When you deal with pointer types the arithmetic take the pointer type into account. As an example, if you have a pointer to an array of uint32_t, and you want to access the next element in the array you have to increase the pointer by 4. In this case this means that your &lt;strong&gt;gpio_out_clr&lt;/strong&gt; and &lt;strong&gt;gpio_dir_set&lt;/strong&gt; pointers end up with the wrong value. This can be fixed by casting&amp;nbsp;&lt;strong&gt;gpio_base&lt;/strong&gt; to and int before doing the addition. Like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;volatile uint32_t *gpio_base = (uint32_t *) 0x50842500UL;
volatile uint32_t *gpio_out_clr = (uint32_t *) ((int)gpio_base + 0x00CUL);
volatile uint32_t *gpio_dir_set = (uint32_t *) ((int)gpio_base + 0x018UL);

*gpio_dir_set = 0xf0180000UL;
*gpio_out_clr = 0x00180000UL;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;By the way,&amp;nbsp;one of the developers pointed out that you can use the standalone&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/nrfx"&gt;nRFX&lt;/a&gt;&amp;nbsp;driver set as a starting point, instead of implementing your own HAL.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/320474?ContentTypeID=1</link><pubDate>Fri, 16 Jul 2021 14:12:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b0dbde9-c401-4d09-ada3-a8a7cef1740b</guid><dc:creator>TiNy</dc:creator><description>&lt;p&gt;Thanks for response. I&amp;#39;ll wait you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/320472?ContentTypeID=1</link><pubDate>Fri, 16 Jul 2021 14:10:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f40bbf0-6c57-4eb5-b7f9-5b15ee38b22d</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Interesting. The SPU should not affect anything unless you&amp;#39;re building for&amp;nbsp;&lt;span&gt;nrf5340dk_nrf5340_cpuapp&lt;strong&gt;ns&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;, but if that&amp;#39;s not the case I need to do some more investigation.&lt;br /&gt;&lt;br /&gt;Will get back to you over the weekend! Thank you for your patience.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/320468?ContentTypeID=1</link><pubDate>Fri, 16 Jul 2021 14:01:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e57489cd-24b9-4678-9a77-dac81b829a4d</guid><dc:creator>TiNy</dc:creator><description>&lt;p&gt;nrf5340dk_nrf5340_cpuapp&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/320463?ContentTypeID=1</link><pubDate>Fri, 16 Jul 2021 13:54:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb4dcfd8-6762-4ad4-9299-c2b8fd08ec23</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Which board are you targeting when building for the nRF Connect SDK?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/320458?ContentTypeID=1</link><pubDate>Fri, 16 Jul 2021 13:50:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06ba5cfa-7a22-4219-898e-9379c57ecb4f</guid><dc:creator>TiNy</dc:creator><description>&lt;p&gt;oh, I see, thanks for link, but I still confused whats exactly wrong with code above? Why when I setup registers via set command at gdb its work fine, but when i do same setup from C code in nrfconnect sdk, its not work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cant change registers via pionters on nrf53</title><link>https://devzone.nordicsemi.com/thread/320433?ContentTypeID=1</link><pubDate>Fri, 16 Jul 2021 12:55:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b57d406-8f3c-4ad4-b218-04f9e9b9dca6</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hello!&lt;br /&gt;&lt;br /&gt;There already exists&amp;nbsp; some &lt;a href="https://crates.io/keywords/nrf53?sort=alpha"&gt;Rust crates for nRF53&lt;/a&gt;. I suggest trying out those. If you are facing issues with the crates or wonder about their usage please reach out to the &lt;a href="https://github.com/rust-embedded/wg"&gt;Rust embedded working group&lt;/a&gt;&amp;nbsp;as they probably can provide better help than us.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>