<?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 Re: Problem with macros in mk22f51212.h from SDK in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-macros-in-mk22f51212-h-from-SDK/m-p/795695#M48437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. I knew I was missing something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Sep 2018 13:02:19 GMT</pubDate>
    <dc:creator>Keith4DSmith</dc:creator>
    <dc:date>2018-09-07T13:02:19Z</dc:date>
    <item>
      <title>Problem with macros in mk22f51212.h from SDK</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-macros-in-mk22f51212-h-from-SDK/m-p/795693#M48435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attached is my copy of mk22f51212.h from the Kinetis SDK for K22F Freedom board, v2.3.1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Structures defining various base register types, such as SIM_Type or&amp;nbsp;&amp;nbsp;RTC_Type, etc. are properly defined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macros that are used to extract bit fields from these structures seem to be wrong.&lt;/P&gt;&lt;P&gt;The intent appears to be to&amp;nbsp;move the bit field in the low order bits of uint32_t variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the shift operator &amp;lt;&amp;lt; should be &amp;gt;&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something? Is there some big endian/little endian issue I don't understand?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;#define SIM_SOPT1_RAMSIZE_MASK (0xF000U)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;#define SIM_SOPT1_RAMSIZE_SHIFT (12U)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;#define SIM_SOPT1_RAMSIZE(x) (((uint32_t)(((uint32_t)(x)) &amp;lt;&amp;lt; SIM_SOPT1_RAMSIZE_SHIFT)) &amp;amp; SIM_SOPT1_RAMSIZE_MASK)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;===================================================================&lt;/P&gt;&lt;P&gt;#include "MK22F51212.h"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;SIM_Type *pSIM = (SIM_Type*)SIM_BASE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;uint32_t ram_size = SIM_SOPT1_RAMSIZE(pSIM-&amp;gt;SOPT1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;============================================================================&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;ram_size returns zero as the bit field&amp;nbsp;is shifted the wrong direction.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Sep 2018 17:12:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-macros-in-mk22f51212-h-from-SDK/m-p/795693#M48435</guid>
      <dc:creator>Keith4DSmith</dc:creator>
      <dc:date>2018-09-05T17:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with macros in mk22f51212.h from SDK</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-macros-in-mk22f51212-h-from-SDK/m-p/795694#M48436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; &lt;A _jive_internal="true" data-content-finding="Community" data-userid="40376" data-username="Keith4DSmith" href="https://community.nxp.com/people/Keith4DSmith"&gt;Keith&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro is used to write a value into a register. Not for reading.&lt;/P&gt;&lt;P&gt;For example, if the ram size is 512.&lt;/P&gt;&lt;P&gt;Then with macro&amp;nbsp; SIM_SOPT1_RAMSIZE, you can set the&amp;nbsp; relative bit field to 512.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2018 06:35:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-macros-in-mk22f51212-h-from-SDK/m-p/795694#M48436</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2018-09-06T06:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with macros in mk22f51212.h from SDK</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-macros-in-mk22f51212-h-from-SDK/m-p/795695#M48437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. I knew I was missing something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2018 13:02:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-macros-in-mk22f51212-h-from-SDK/m-p/795695#M48437</guid>
      <dc:creator>Keith4DSmith</dc:creator>
      <dc:date>2018-09-07T13:02:19Z</dc:date>
    </item>
  </channel>
</rss>

