<?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 Problems integrating lpuart example code with FreeRTOS in S32K</title>
    <link>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448208#M15090</link>
    <description>&lt;P&gt;I'm using the S32K148 AVB with S32DS 3.4 and FreeRTOS. Starting with the bundle freertos demo, I'm able to build, load to the EVB and run the blinking LED. Now, I'm trying to add lpuart support to get console input and output. I've added the lpuart1 component and configured the pins to use PC6 and PC7. In rtos.c, I added the rxCallback() function direct from the lpuart example main.c code. In&amp;nbsp;prvSetupHardware(), I added:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;   LPUART_DRV_Init(INST_LPUART_LPUART_1, &amp;amp;lpUartState1, &amp;amp;lpUartInitConfig1);
   LPUART_DRV_InstallRxCallback(INST_LPUART_LPUART_1, rxCallback, NULL);&lt;/LI-CODE&gt;&lt;P&gt;In rtos_start(), after the prvSetupHardware() call, I added:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    LPUART_DRV_SendDataBlocking(INST_LPUART_LPUART_1, (uint8_t *)welcomeMsg, strlen(welcomeMsg), TIMEOUT);&lt;/LI-CODE&gt;&lt;P&gt;When I run it, it faults out with a bus fault error. Specifically, it says:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;Number of threads 1 (Scheduler not yet running)&lt;BR /&gt;&amp;nbsp; BusFault: An imprecise (asynchronous) data access error has occurred.&lt;BR /&gt;&amp;nbsp; HardFault: A fault has been escalated to a hard fault.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;with the debugger stopped at&amp;nbsp;DefaultISR.&lt;/P&gt;&lt;P&gt;I have stepped into that function, all the way down to&amp;nbsp;OSIF_SemaWait() in osif_freertos.c, which eventually calls&amp;nbsp;xTaskCheckForTimeOut() which executes this block of code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#if ( INCLUDE_xTaskAbortDelay == 1 )
    if( pxCurrentTCB-&amp;gt;ucDelayAborted != ( uint8_t ) pdFALSE )
    {
        /* The delay was aborted, which is not the same as a time out,
         * but has the same result. */
        pxCurrentTCB-&amp;gt;ucDelayAborted = pdFALSE;
        xReturn = pdTRUE;    &amp;lt;&amp;lt;&amp;lt;&amp;lt;--------
}
else
#endif&lt;/LI-CODE&gt;&lt;P&gt;As soon as the arrowed line is executed the abort occurs.&lt;/P&gt;&lt;P&gt;Does anyone have any clues what might be going on?&amp;nbsp; I've spent many hours on this and am stuck.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Apr 2022 20:38:06 GMT</pubDate>
    <dc:creator>billr</dc:creator>
    <dc:date>2022-04-24T20:38:06Z</dc:date>
    <item>
      <title>Problems integrating lpuart example code with FreeRTOS</title>
      <link>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448208#M15090</link>
      <description>&lt;P&gt;I'm using the S32K148 AVB with S32DS 3.4 and FreeRTOS. Starting with the bundle freertos demo, I'm able to build, load to the EVB and run the blinking LED. Now, I'm trying to add lpuart support to get console input and output. I've added the lpuart1 component and configured the pins to use PC6 and PC7. In rtos.c, I added the rxCallback() function direct from the lpuart example main.c code. In&amp;nbsp;prvSetupHardware(), I added:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;   LPUART_DRV_Init(INST_LPUART_LPUART_1, &amp;amp;lpUartState1, &amp;amp;lpUartInitConfig1);
   LPUART_DRV_InstallRxCallback(INST_LPUART_LPUART_1, rxCallback, NULL);&lt;/LI-CODE&gt;&lt;P&gt;In rtos_start(), after the prvSetupHardware() call, I added:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    LPUART_DRV_SendDataBlocking(INST_LPUART_LPUART_1, (uint8_t *)welcomeMsg, strlen(welcomeMsg), TIMEOUT);&lt;/LI-CODE&gt;&lt;P&gt;When I run it, it faults out with a bus fault error. Specifically, it says:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;Number of threads 1 (Scheduler not yet running)&lt;BR /&gt;&amp;nbsp; BusFault: An imprecise (asynchronous) data access error has occurred.&lt;BR /&gt;&amp;nbsp; HardFault: A fault has been escalated to a hard fault.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;with the debugger stopped at&amp;nbsp;DefaultISR.&lt;/P&gt;&lt;P&gt;I have stepped into that function, all the way down to&amp;nbsp;OSIF_SemaWait() in osif_freertos.c, which eventually calls&amp;nbsp;xTaskCheckForTimeOut() which executes this block of code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#if ( INCLUDE_xTaskAbortDelay == 1 )
    if( pxCurrentTCB-&amp;gt;ucDelayAborted != ( uint8_t ) pdFALSE )
    {
        /* The delay was aborted, which is not the same as a time out,
         * but has the same result. */
        pxCurrentTCB-&amp;gt;ucDelayAborted = pdFALSE;
        xReturn = pdTRUE;    &amp;lt;&amp;lt;&amp;lt;&amp;lt;--------
}
else
#endif&lt;/LI-CODE&gt;&lt;P&gt;As soon as the arrowed line is executed the abort occurs.&lt;/P&gt;&lt;P&gt;Does anyone have any clues what might be going on?&amp;nbsp; I've spent many hours on this and am stuck.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Apr 2022 20:38:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448208#M15090</guid>
      <dc:creator>billr</dc:creator>
      <dc:date>2022-04-24T20:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problems integrating lpuart example code with FreeRTOS</title>
      <link>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448461#M15104</link>
      <description>&lt;P&gt;Hi Bill,&lt;/P&gt;
&lt;P&gt;if a module uses OS services (like mentioned OSIF), it is mandatory to call its init function after starting the scheduler.&lt;/P&gt;
&lt;P&gt;I can remember this discussion, you can take a look:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.freertos.org/FreeRTOS_Support_Forum_Archive/March_2017/freertos_What_is_normal_method_for_running_initialization_code_in_FreerTOS_92042073j.html" target="_blank"&gt;https://www.freertos.org/FreeRTOS_Support_Forum_Archive/March_2017/freertos_What_is_normal_method_for_running_initialization_code_in_FreerTOS_92042073j.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 10:08:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448461#M15104</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2022-04-25T10:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problems integrating lpuart example code with FreeRTOS</title>
      <link>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448597#M15114</link>
      <description>&lt;P&gt;Thanks, Lukas! I'll give that a try and see if it solves my problems.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 14:11:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448597#M15114</guid>
      <dc:creator>billr</dc:creator>
      <dc:date>2022-04-25T14:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problems integrating lpuart example code with FreeRTOS</title>
      <link>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448887#M15119</link>
      <description>&lt;P&gt;So I tried moving the serial port config into the beginning of&amp;nbsp;prvQueueReceiveTask() of the freertos demo, which will get called after the scheduler runs. This is better, in that the app doesn't abort anymore, but now it's stuck in&amp;nbsp;LPUART_DRV_SendDataBlocking(), specifically into the OSWait call, it seems, with nothing coming out on the console. I'm doing the exact same UART initialization as in the lpuart example (which does work). Is there extra work in FreeRTOS I need to do to enable the interrupts, as that's kind of what it looks like from an outside view?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: I changed the call to&amp;nbsp;LPUART_DRV_SendDataPolling() and it didn't hang and returned 0, so it does appear there's an interrupt issue of some sort. At least I can move forward now by using the polling version until I can figure out why the interrupts are not enabled.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 04:11:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Problems-integrating-lpuart-example-code-with-FreeRTOS/m-p/1448887#M15119</guid>
      <dc:creator>billr</dc:creator>
      <dc:date>2022-04-26T04:11:53Z</dc:date>
    </item>
  </channel>
</rss>

