<?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: MPC5775E Flash Programming exception in MPC5xxx</title>
    <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1549016#M22296</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/206689"&gt;@latheef&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;you are right, in case of MPC5 devices, the flash operations are not launched from RAM. This is the case of SDK for S32K devices, here it is different. Sorry, I'm jumping between these devices a lot. &lt;BR /&gt;IVOR14 means that you are jumping to area which is not covered by MMU. My recommendation is to step the "start();" command in asm instructions and check the core registers to see where it jumps exactly (if it is expected address). &lt;BR /&gt;Because it obviously jumps to some wrong address, application is not executed at all, so IVPR is not updated by the application and this exception takes vector from the bootloader. &lt;BR /&gt;Regards,&lt;BR /&gt;Lukas&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2022 19:03:20 GMT</pubDate>
    <dc:creator>lukaszadrapa</dc:creator>
    <dc:date>2022-11-04T19:03:20Z</dc:date>
    <item>
      <title>MPC5775E Flash Programming exception</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1547038#M22275</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is continuation of the&amp;nbsp;&lt;A href="https://community.nxp.com/t5/MPC5xxx/Boot-Application-for-MPC5775E/m-p/1545181#M22251" target="_blank"&gt;Solved: Re: Boot Application for MPC5775E - NXP Community&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I have now my boot application allocated to the Block0 of 256K sectors.ie 800000 - 83FFFF.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="latheef_0-1667325374955.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/198781iBCD95AF05CD10C82/image-size/medium?v=v2&amp;amp;px=400" role="button" title="latheef_0-1667325374955.png" alt="latheef_0-1667325374955.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;latheef_0-1667325374955.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My application now starts from 840000.&lt;/P&gt;&lt;P&gt;I am using the S32DS processor expert and below code for&amp;nbsp; erasing 15 blocks as one block is where I am executing from&lt;/P&gt;&lt;P&gt;Unlock the sector -&amp;gt;&lt;/P&gt;&lt;P&gt;ret = FLASH_DRV_SetLock(C55_BLOCK_256K_FIRST, 0x8000FFFFU);&lt;/P&gt;&lt;P&gt;/* Erase block */&lt;/P&gt;&lt;P&gt;blockSelect.lowBlockSelect = 0x0U;&lt;BR /&gt;blockSelect.midBlockSelect = 0x0U;&lt;BR /&gt;blockSelect.highBlockSelect = 0x0U;&lt;BR /&gt;blockSelect.first256KBlockSelect = 0xFFFF0000U;&lt;BR /&gt;blockSelect.second256KBlockSelect = 0x0U;&lt;BR /&gt;ret = FLASH_DRV_Erase(ERS_OPT_MAIN_SPACE, &amp;amp;blockSelect);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The erase looks ok, but when I program the flash I get exception IVOR1&lt;/P&gt;&lt;P&gt;Code is below&lt;/P&gt;&lt;P&gt;ret = FLASH_DRV_Program(&amp;amp;pCtxData,0x00840000,size,from);&lt;/P&gt;&lt;P&gt;Exception as below, with Instruction fetch error bit set in the MCSR register.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="latheef_1-1667325779230.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/198782i129F7C06925EE360/image-size/medium?v=v2&amp;amp;px=400" role="button" title="latheef_1-1667325779230.png" alt="latheef_1-1667325779230.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;latheef_1-1667325779230.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="latheef_2-1667325787596.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/198783iF682A4AB68234096/image-size/medium?v=v2&amp;amp;px=400" role="button" title="latheef_2-1667325787596.png" alt="latheef_2-1667325787596.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;latheef_2-1667325787596.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/37795"&gt;@lukaszadrapa&lt;/a&gt;&amp;nbsp;please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 18:04:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1547038#M22275</guid>
      <dc:creator>latheef</dc:creator>
      <dc:date>2022-11-01T18:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5775E Flash Programming exception</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1547809#M22284</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/206689"&gt;@latheef&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;are interrupts disabled? The erase/program functions are launched from RAM in the drivers but if there's an interrupt accessing the flash, it can fail.&lt;/P&gt;
&lt;P&gt;Your bootloader and start of your application are all in partition 6, so I guess this is Read-While-Write problem.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lukaszadrapa_0-1667401913002.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/198938i244C79965EEDCA24/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lukaszadrapa_0-1667401913002.png" alt="lukaszadrapa_0-1667401913002.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;lukaszadrapa_0-1667401913002.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So, as a first step, I would like to disabled interrupts.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 15:12:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1547809#M22284</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2022-11-02T15:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5775E Flash Programming exception</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1548375#M22288</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/37795"&gt;@lukaszadrapa&lt;/a&gt;I checked the flash&amp;nbsp; driver code and it is not coded to be executed from the RAM. When run in Debug Ram mode it all work well.&lt;/P&gt;&lt;P&gt;I could see there is section .code_ram in the linker script, but not used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="latheef_0-1667473628701.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/199037iDEC4F7A68486A673/image-size/medium?v=v2&amp;amp;px=400" role="button" title="latheef_0-1667473628701.png" alt="latheef_0-1667473628701.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;latheef_0-1667473628701.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have to erase 15 App sectors and each erase takes 1 second each, but I need to handle the UDS session and send the can message in between to make the UDS tool happy. Do I need to load all the code (including the S32DS CAN Driver code ) to RAM when erasing/programming is going on? If so how do I do it?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 14:59:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1548375#M22288</guid>
      <dc:creator>latheef</dc:creator>
      <dc:date>2022-11-03T14:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5775E Flash Programming exception</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1548894#M22295</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/37795"&gt;@lukaszadrapa&lt;/a&gt;Thanks for your pointer, I have fixed the issue now by moving the Erase and Prog codes to RAM as below. Also some of my&amp;nbsp; functions too to make it work when the erase is in progress.&lt;/P&gt;&lt;P&gt;__attribute__ ((section(".code_ram"))) status_t FLASH_DRV_Program(flash_context_data_t * pCtxData,&lt;BR /&gt;uint32_t dest,&lt;BR /&gt;uint32_t size,&lt;BR /&gt;uint32_t source) __attribute__ ((longcall));&lt;/P&gt;&lt;P&gt;Now I am able to program and confirmed it by checking the CRC32 but executing the application is failing with IVOR14 and it is pointing to the exception table from boot&amp;nbsp; as shown below&lt;/P&gt;&lt;P&gt;start = (void (*)(void))(*(uint32_t *)(0x00840000+ 0x400));&lt;BR /&gt;start();&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="latheef_0-1667564646722.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/199197i20D33E64A209CDC2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="latheef_0-1667564646722.png" alt="latheef_0-1667564646722.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;latheef_0-1667564646722.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="latheef_1-1667564736658.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/199198i17E41E80C93EC4A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="latheef_1-1667564736658.png" alt="latheef_1-1667564736658.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;latheef_1-1667564736658.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Could you please let me know why I getting exception IVOR14 wuth SRR0 pointing to a weird address?&lt;/P&gt;&lt;P&gt;2) Why is the exception table from boot invoked when I am excecuting the App?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 12:27:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1548894#M22295</guid>
      <dc:creator>latheef</dc:creator>
      <dc:date>2022-11-04T12:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5775E Flash Programming exception</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1549016#M22296</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/206689"&gt;@latheef&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;you are right, in case of MPC5 devices, the flash operations are not launched from RAM. This is the case of SDK for S32K devices, here it is different. Sorry, I'm jumping between these devices a lot. &lt;BR /&gt;IVOR14 means that you are jumping to area which is not covered by MMU. My recommendation is to step the "start();" command in asm instructions and check the core registers to see where it jumps exactly (if it is expected address). &lt;BR /&gt;Because it obviously jumps to some wrong address, application is not executed at all, so IVPR is not updated by the application and this exception takes vector from the bootloader. &lt;BR /&gt;Regards,&lt;BR /&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 19:03:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1549016#M22296</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2022-11-04T19:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5775E Flash Programming exception</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1549215#M22299</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Below is the correct address to execute the App and now its ok.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;start = (void (*)(void))(*(uint32_t *)(0x00840000+ 0x4));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;start();&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 09:42:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1549215#M22299</guid>
      <dc:creator>latheef</dc:creator>
      <dc:date>2022-11-06T09:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5775E Flash Programming exception</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1659970#M23732</link>
      <description>&lt;P&gt;This topic helps us a lot, and is exactly what we were trying to develop.&lt;/P&gt;&lt;P&gt;A bootloader at same address and application too.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 12:55:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5775E-Flash-Programming-exception/m-p/1659970#M23732</guid>
      <dc:creator>claudioe</dc:creator>
      <dc:date>2023-05-30T12:55:49Z</dc:date>
    </item>
  </channel>
</rss>

