<?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>Any examples of direct read &amp;amp; write of nRF51822 registers?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9075/any-examples-of-direct-read-write-of-nrf51822-registers</link><description>Hi, are there any examples in C for how to directly access the registers on the chip? I realize this is a super basic question, but all the register access in the examples is wrapped in functions and macros that are not accessible, and I haven&amp;#39;t found</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 06 Sep 2015 08:12:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9075/any-examples-of-direct-read-write-of-nrf51822-registers" /><item><title>RE: Any examples of direct read &amp; write of nRF51822 registers?</title><link>https://devzone.nordicsemi.com/thread/33401?ContentTypeID=1</link><pubDate>Sun, 06 Sep 2015 08:12:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c2d933a-0965-48c7-b1a9-c721f5d35174</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Ah yes - I don&amp;#39;t know why that macro define is there as the nrf51 series never had SPI with EasyDMA, the SPIS one does work as that does have DMA. I see it even defines SPIM1 at 0x40004000 which is just wrong.&lt;/p&gt;
&lt;p&gt;The nrf52 series finally does implement an SPI master with DMA so it&amp;#39;s valid for that chip, but, yes, not for the 51822.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any examples of direct read &amp; write of nRF51822 registers?</title><link>https://devzone.nordicsemi.com/thread/33400?ContentTypeID=1</link><pubDate>Sun, 06 Sep 2015 07:52:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f09d7f85-d817-4a2a-90a2-6cde0ea7b1fd</guid><dc:creator>Doug_H</dc:creator><description>&lt;p&gt;That&amp;#39;s it for sure. I got sidetracked by using the incorrect macro. There&amp;#39;s a macro called NRF_SPIM1 (for SPI master I assumed) and it&amp;#39;s mapped to a structure that maps pointers to the TX and RX data buffers among other things. Turns out this structure isn&amp;#39;t used in any of the examples you suggested, so I switched over to NRF_SPI0 and accessing the TXD and RXD is a piece of cake. Thanks again for your advice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any examples of direct read &amp; write of nRF51822 registers?</title><link>https://devzone.nordicsemi.com/thread/33399?ContentTypeID=1</link><pubDate>Sun, 06 Sep 2015 06:06:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:174d810b-c54e-46c1-83dd-3c3330e1caa9</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;From memory&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_SPI0-&amp;gt;TXD = data
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But check the spi master driver if you want examples of that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any examples of direct read &amp; write of nRF51822 registers?</title><link>https://devzone.nordicsemi.com/thread/33398?ContentTypeID=1</link><pubDate>Sun, 06 Sep 2015 04:49:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:308d7f04-6eb2-4172-a78c-3a23456e730e</guid><dc:creator>Doug_H</dc:creator><description>&lt;p&gt;HI RK, thanks for your help on this. I&amp;#39;ll go over the files and examples you suggest. I mostly have found what I need, just stuck on how to write to the SPI TX Register in the chip. I&amp;#39;ll keep plugging away.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any examples of direct read &amp; write of nRF51822 registers?</title><link>https://devzone.nordicsemi.com/thread/33397?ContentTypeID=1</link><pubDate>Sun, 06 Sep 2015 02:14:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa3fde7f-1cda-453c-833c-63be698f71c9</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;What do you mean the macros aren&amp;#39;t accessible? They are all in nrf51.h and nrf51_bitfields.h and just about any one of the peripheral drivers has multiple examples of reads and writes in them. Look at the spi driver in your SDK, look at nrf_adc.c in the drivers_nrf/hal subdirectory.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any examples of direct read &amp; write of nRF51822 registers?</title><link>https://devzone.nordicsemi.com/thread/33402?ContentTypeID=1</link><pubDate>Sat, 05 Sep 2015 10:15:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fef9348-616c-4cdb-92ab-beaa064ff04c</guid><dc:creator>Doug_H</dc:creator><description>&lt;p&gt;The registers are mapped to pointers to structures in nrf51.h&lt;/p&gt;
&lt;p&gt;Be careful with SPI mapping. Use NRF_SPI0 or NRF_SPI1 NOT NRF_SPIM1&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t spi_conf_reg;

spi_conf_reg = NRF_SPI0&amp;gt;CONFIG; 
RTT_PRINTF(&amp;quot;SPI0 REG: %x\n&amp;quot;, spi_conf_reg);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>