<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Reserved bits in LPC1317  in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526000#M8633</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Wed Jul 17 03:41:10 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Some of registers says that user should not write 1 to this bit &amp;amp; reading this bit is undefined.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But there are registers like "PDRUNCFG", which says that user should only write 1 for some of its bits. But user manual doesn't say that reading bit is undefined. So does that mean reading this bit is defined always &amp;amp; will return '1'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So which one is correct way of writing to register, suppose I have turn on ADc module:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(1UL&amp;lt;&amp;lt;4);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Disable Power down bit to the ADC block. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. uint32_t temp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; temp = LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp; 0x000005FF;&amp;nbsp;&amp;nbsp; /* mask out reserved bits */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; temp = temp &amp;amp; (~(1UL &amp;lt;&amp;lt; 4))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* turn on ADC module bit */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG&amp;nbsp; = temp | 0x0000E800;&amp;nbsp; /* set bits which need to be high always */&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:59:29 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:59:29Z</dc:date>
    <item>
      <title>Reserved bits in LPC1317</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526000#M8633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Wed Jul 17 03:41:10 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Some of registers says that user should not write 1 to this bit &amp;amp; reading this bit is undefined.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But there are registers like "PDRUNCFG", which says that user should only write 1 for some of its bits. But user manual doesn't say that reading bit is undefined. So does that mean reading this bit is defined always &amp;amp; will return '1'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So which one is correct way of writing to register, suppose I have turn on ADc module:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(1UL&amp;lt;&amp;lt;4);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Disable Power down bit to the ADC block. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. uint32_t temp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; temp = LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp; 0x000005FF;&amp;nbsp;&amp;nbsp; /* mask out reserved bits */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; temp = temp &amp;amp; (~(1UL &amp;lt;&amp;lt; 4))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* turn on ADC module bit */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG&amp;nbsp; = temp | 0x0000E800;&amp;nbsp; /* set bits which need to be high always */&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:59:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526000#M8633</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reserved bits in LPC1317</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526001#M8634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wellsk on Thu Jul 18 12:04:00 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You will have to honor the states the user manual indicates, so the #2 option is your better choice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For some bits, you'll need to always write a '1' regardless of read value. And others, you'll need to write the read value back.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Generally, if a bit says reserved, I wouldn't trust its value to be 0 or 1 unless the UM specifically says it returns 0 or 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For a register like PDRUNCFG and related sleep registers, you'll need to be careful altering bits so they stay in the states the UM designates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like the following code should allow you to enable and disable specific bits while maintaining the correct UM states.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;/* PDRUNCFG register mask */
#if defined(CHIP_LPC1347)
#define PDRUNCFGUSEMASK 0x0000E800
#else
#define PDRUNCFGUSEMASK 0x0000F800
#endif
#define PDRUNCFGMASKTMP 0x000005FF

/* Power down one or more blocks or peripherals */
void Chip_SYSCTL_PowerDown(uint32_t powerdownmask)
{
uint32_t pdrun;

pdrun = LPC_SYSCTL-&amp;gt;PDRUNCFG &amp;amp; PDRUNCFGMASKTMP;
pdrun |= (powerdownmask &amp;amp; PDRUNCFGMASKTMP);

LPC_SYSCTL-&amp;gt;PDRUNCFG = (pdrun | PDRUNCFGUSEMASK);
}

/* Power up one or more blocks or peripherals */
void Chip_SYSCTL_PowerUp(uint32_t powerupmask)
{
uint32_t pdrun;

pdrun = LPC_SYSCTL-&amp;gt;PDRUNCFG &amp;amp; PDRUNCFGMASKTMP;
pdrun &amp;amp;= ~(powerupmask &amp;amp; PDRUNCFGMASKTMP);

LPC_SYSCTL-&amp;gt;PDRUNCFG = (pdrun | PDRUNCFGUSEMASK);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can get more complete functions specific to these (SYSCON/SYSCTL) registers in the CHIP_13xx sysctl_13xx.h/c file in LPCOpen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:59:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526001#M8634</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reserved bits in LPC1317</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526002#M8635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Thu Jul 18 21:00:19 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for ur reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1 .Now consider a P0.4 &amp;amp; P0.5 iocon registers. Bit 7 denotes analog mode in pins having analog function, writing 0 to bit 7 activates analog mode. But in p0.4 &amp;amp; p0.5 iocon there is no analog mode &amp;amp; these bits are reserved so when I write zero to this bit then pin no more behave like i2c pin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to work it as I2c I have to write 1 to this pin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to write like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_4 = 0x00000081;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* pin now works fine */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But if I mask out reserved bits &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_4 = (LPC_IOCON-&amp;gt;PIO0_4 &amp;amp; 0x00000307) | BIT_1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* pin don't behave as I2c pin */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you give some insight what exactly to do with reserved bits&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:59:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526002#M8635</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reserved bits in LPC1317</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526003#M8636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by DF9DQ on Fri Jul 19 06:02:52 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't confirm your findings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I write 0x001 (standard/fast I²C) or 0x0201 (FM+) into the IOCON register for PIO0_4 and PIO0_5, the I²C communication works perfectly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:59:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526003#M8636</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reserved bits in LPC1317</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526004#M8637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cfbsoftware on Fri Jul 19 16:35:07 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What is BIT_1 defined as? If it is 2 as I would expect then it wouldn't work as bits 1 and 2 are reserved. You need to OR the value 1 (BIT_0?)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:59:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526004#M8637</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reserved bits in LPC1317</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526005#M8638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Sun Jul 21 22:42:44 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;my mistake I wrote bit1 , its actually BIT0,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so on writing P0.,4 iocon register 0x01 it don't work as I2c pin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:59:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526005#M8638</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reserved bits in LPC1317</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526006#M8639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cfbsoftware on Mon Jul 22 01:22:57 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You have to make sure bits 1, 2, 8 and 9 are cleared if you want I2C. Using the 'SET' data type feature of the Oberon programming language I write it like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; VAR&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; s: SET;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; SYSTEM.GET(MCU.IOCONPIO04, s);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; SYSTEM.PUT(MCU.IOCONPIO04, s - {1, 2, 8, 9} + {0});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i.e. I get the existing value and then clear bits 1, 2, 8 and 9 and set bit 0 before writing it back again. It looks to me as though you have your bit mask inverted compared to what it should be. I haven't tested it but I believe the equivalent in C is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_4 = (LPC_IOCON-&amp;gt;PIO0_4 &amp;amp; 0xFFFFFCF9) | BIT_0&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:59:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Reserved-bits-in-LPC1317/m-p/526006#M8639</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:59:33Z</dc:date>
    </item>
  </channel>
</rss>

