<?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 Discovred an error in Chip_IAP_ReadUID() function (from LPCOpen) in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Discovred-an-error-in-Chip-IAP-ReadUID-function-from-LPCOpen/m-p/568765#M17780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cgroen on Thu Jan 14 06:23:30 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Discovered a "small" bug in the Chip_IAP_ReadUID() function&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(with severe corruption of data....)&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;
/* Read the unique ID */
uint32_t Chip_IAP_ReadUID(uint32_t* uid)
{
uint32_t command[5], result[5];
uint32_t i;

command[0] = IAP_READ_UID_CMD;
iap_entry(command, result);

for (i=0; i&amp;lt;4; i++)
&lt;STRONG&gt;[color=#f00]//*(uid+i) = result[i+1]; // Not good !!![/color]&lt;/STRONG&gt;
&lt;STRONG&gt;[color=#6c0]*((unsigned char*)uid+i) = result[i+1]; // Quick and dirty solution that works...[/color]&lt;/STRONG&gt;

return result[0];
}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:08:24 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:08:24Z</dc:date>
    <item>
      <title>Discovred an error in Chip_IAP_ReadUID() function (from LPCOpen)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Discovred-an-error-in-Chip-IAP-ReadUID-function-from-LPCOpen/m-p/568765#M17780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cgroen on Thu Jan 14 06:23:30 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Discovered a "small" bug in the Chip_IAP_ReadUID() function&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(with severe corruption of data....)&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;
/* Read the unique ID */
uint32_t Chip_IAP_ReadUID(uint32_t* uid)
{
uint32_t command[5], result[5];
uint32_t i;

command[0] = IAP_READ_UID_CMD;
iap_entry(command, result);

for (i=0; i&amp;lt;4; i++)
&lt;STRONG&gt;[color=#f00]//*(uid+i) = result[i+1]; // Not good !!![/color]&lt;/STRONG&gt;
&lt;STRONG&gt;[color=#6c0]*((unsigned char*)uid+i) = result[i+1]; // Quick and dirty solution that works...[/color]&lt;/STRONG&gt;

return result[0];
}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:08:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Discovred-an-error-in-Chip-IAP-ReadUID-function-from-LPCOpen/m-p/568765#M17780</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Discovred an error in Chip_IAP_ReadUID() function (from LPCOpen)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Discovred-an-error-in-Chip-IAP-ReadUID-function-from-LPCOpen/m-p/568766#M17781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MarcVonWindscooting on Tue Feb 16 14:07:13 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry: No.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe, the true bug of this function is the type of &lt;/SPAN&gt;&lt;STRONG&gt;uid&lt;/STRONG&gt;&lt;SPAN&gt; which pretends to point to a 32-bit value, but actually is a &lt;/SPAN&gt;&lt;STRONG&gt;uint32_t uid[4]&lt;/STRONG&gt;&lt;SPAN&gt; and had better be a structure or union. The result is 128bits, but the API fooled you into believing it's 32bit only!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next flaw: does command have to be a &lt;/SPAN&gt;&lt;STRONG&gt;uint32_t[5]&lt;/STRONG&gt;&lt;SPAN&gt; and a &lt;/SPAN&gt;&lt;STRONG&gt;uint32_t[1]&lt;/STRONG&gt;&lt;SPAN&gt; is really not sufficient??&amp;nbsp; ;-) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One function, two reasons to stop looking at 'typical' embedded programmers' code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:08:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Discovred-an-error-in-Chip-IAP-ReadUID-function-from-LPCOpen/m-p/568766#M17781</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Discovred an error in Chip_IAP_ReadUID() function (from LPCOpen)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Discovred-an-error-in-Chip-IAP-ReadUID-function-from-LPCOpen/m-p/568767#M17782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cgroen on Wed Feb 17 00:32:35 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you are absolutely right!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I had my mind fixed on the id being an 32 bit value (from other families of CPUs) and was fooled into believing this by the returntype of the Chip_IAP_ReadUID().&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have changed the parameter in my code to a uint32_t xxx[4] instead!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the heads-up!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(and I agree, it would have been better to use a struct etc as parameter to show whats going on)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:08:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Discovred-an-error-in-Chip-IAP-ReadUID-function-from-LPCOpen/m-p/568767#M17782</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:08:26Z</dc:date>
    </item>
  </channel>
</rss>

