<?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: Hart Fault due to the type conversion from unigned long to foat on i.mxrt 1170 in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hart-Fault-due-to-the-type-conversion-from-unigned-long-to-foat/m-p/2326799#M36298</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/246904"&gt;@ricklei_bakerhughes&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have pasted your code in some demo like led_blinky , it works well with -O0 optimization option ,&amp;nbsp; Please kindly refer to the attachment for details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2026 07:36:11 GMT</pubDate>
    <dc:creator>Kan_Li</dc:creator>
    <dc:date>2026-03-05T07:36:11Z</dc:date>
    <item>
      <title>Hart Fault due to the type conversion from unigned long to foat on i.mxrt 1170</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hart-Fault-due-to-the-type-conversion-from-unigned-long-to-foat/m-p/2326670#M36291</link>
      <description>&lt;P&gt;I am porting some old code from MPC855T to i.mxrt 1170. The code uses unsigned long for value calculation. Before presenting the value on screen, it's converted to float type and use sprintf to generate the string.&lt;BR /&gt;The following is piece of my code:&lt;/P&gt;&lt;P&gt;typedef struct {&lt;BR /&gt;unsigned long ulValue;&lt;BR /&gt;} typeRegs;&lt;BR /&gt;typeRegs * ptrRegs = (typeRegs *)memory address;&lt;BR /&gt;float fValue = (float)(ptrRegs-&amp;gt;ulValue); // this line will trigger a hart fault error&lt;BR /&gt;unsigned long ulTemp = ptrRegs-&amp;gt;ulValue;&lt;BR /&gt;fValue = (float)ulTemp; // this line works well&lt;/P&gt;&lt;P&gt;I am using Keil, and the ArmClang compiler version is 6.16. I need to understand why I can't convert an unsigned long in point parameter to float directly.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2026 02:14:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hart-Fault-due-to-the-type-conversion-from-unigned-long-to-foat/m-p/2326670#M36291</guid>
      <dc:creator>ricklei_bakerhughes</dc:creator>
      <dc:date>2026-03-05T02:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Hart Fault due to the type conversion from unigned long to foat on i.mxrt 1170</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hart-Fault-due-to-the-type-conversion-from-unigned-long-to-foat/m-p/2326799#M36298</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/246904"&gt;@ricklei_bakerhughes&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have pasted your code in some demo like led_blinky , it works well with -O0 optimization option ,&amp;nbsp; Please kindly refer to the attachment for details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2026 07:36:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hart-Fault-due-to-the-type-conversion-from-unigned-long-to-foat/m-p/2326799#M36298</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2026-03-05T07:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Hart Fault due to the type conversion from unigned long to foat on i.mxrt 1170</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hart-Fault-due-to-the-type-conversion-from-unigned-long-to-foat/m-p/2328162#M36317</link>
      <description>&lt;P&gt;Yes, the exact code works well. But there is a small difference between the code and my implementation. I am not using a memory address directly. I am using an array of unsigned char to allocate the memory space. And this gave me a Hard Fault.&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I figured out the root cause finally. It's due to the alignment error. The conversion from unsigned long to float must be byte aligned. And it seems the array of unsigned char is not aligned with a float value. I changed array defintion to float type. Then it works.&lt;/P&gt;&lt;P&gt;I tried to add "__attribute__ ((aligned(4)))" after the structure defintion. But it didn't work too. I don't know the reason.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway this can be closed.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Rick&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2026 03:22:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hart-Fault-due-to-the-type-conversion-from-unigned-long-to-foat/m-p/2328162#M36317</guid>
      <dc:creator>ricklei_bakerhughes</dc:creator>
      <dc:date>2026-03-07T03:22:20Z</dc:date>
    </item>
  </channel>
</rss>

