<?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 MBDT LIN compile error in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-LIN-compile-error/m-p/1598429#M8025</link>
    <description>&lt;P&gt;I'm running into some unexpected errors when trying to use the MBDT LIN blocks with the S32K142.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The LIN master example compile without issue but when I try to use the LIN blocks into my own model I'm getting errors that both&amp;nbsp;&lt;SPAN&gt;LIN_XCVR_ENABLE_GPIO_PORT and&amp;nbsp;LIN_XCVR_ENABLE_MASK are undefined:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;error: 'LIN_XCVR_ENABLE_GPIO_PORT' undeclared (first use in this function) PINS_DRV_SetPinsDirection(LIN_XCVR_ENABLE_GPIO_PORT, LIN_XCVR_ENABLE_MASK);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I look at the C code that gets generated from the lin_master_s32k14x.slx example I see these #defines:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;34	#define LIN_XCVR_ENABLE_PIN            (9UL)
35	#define LIN_XCVR_ENABLE_MASK           (0x1u &amp;lt;&amp;lt; LIN_XCVR_ENABLE_PIN)
36	#define LIN_XCVR_ENABLE_GPIO_PORT      (PTE)&lt;/LI-CODE&gt;&lt;P&gt;These same #define statements are &lt;EM&gt;not&lt;/EM&gt; present in the C code that gets generated from my model that's using the same LIN blocks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A couple questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;What in the Simulink model for the example project is generating these #define statements?&amp;nbsp; There is nothing in the GUI for any of the blocks to specify a GPIO pin to use for LIN Transceiver Enable.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;My hardware does not need a LIN Transceiver Enable pin.&amp;nbsp; How can I get the code to compile without attempting to initialize a GPIO pin for this function?&amp;nbsp; Again, there is nothing in the Simulink blocks related to this at all (just the TX and RX pins, as I would expect).&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
    <pubDate>Mon, 13 Feb 2023 23:17:29 GMT</pubDate>
    <dc:creator>andyknitt</dc:creator>
    <dc:date>2023-02-13T23:17:29Z</dc:date>
    <item>
      <title>MBDT LIN compile error</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-LIN-compile-error/m-p/1598429#M8025</link>
      <description>&lt;P&gt;I'm running into some unexpected errors when trying to use the MBDT LIN blocks with the S32K142.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The LIN master example compile without issue but when I try to use the LIN blocks into my own model I'm getting errors that both&amp;nbsp;&lt;SPAN&gt;LIN_XCVR_ENABLE_GPIO_PORT and&amp;nbsp;LIN_XCVR_ENABLE_MASK are undefined:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;error: 'LIN_XCVR_ENABLE_GPIO_PORT' undeclared (first use in this function) PINS_DRV_SetPinsDirection(LIN_XCVR_ENABLE_GPIO_PORT, LIN_XCVR_ENABLE_MASK);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I look at the C code that gets generated from the lin_master_s32k14x.slx example I see these #defines:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;34	#define LIN_XCVR_ENABLE_PIN            (9UL)
35	#define LIN_XCVR_ENABLE_MASK           (0x1u &amp;lt;&amp;lt; LIN_XCVR_ENABLE_PIN)
36	#define LIN_XCVR_ENABLE_GPIO_PORT      (PTE)&lt;/LI-CODE&gt;&lt;P&gt;These same #define statements are &lt;EM&gt;not&lt;/EM&gt; present in the C code that gets generated from my model that's using the same LIN blocks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A couple questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;What in the Simulink model for the example project is generating these #define statements?&amp;nbsp; There is nothing in the GUI for any of the blocks to specify a GPIO pin to use for LIN Transceiver Enable.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;My hardware does not need a LIN Transceiver Enable pin.&amp;nbsp; How can I get the code to compile without attempting to initialize a GPIO pin for this function?&amp;nbsp; Again, there is nothing in the Simulink blocks related to this at all (just the TX and RX pins, as I would expect).&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 23:17:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-LIN-compile-error/m-p/1598429#M8025</guid>
      <dc:creator>andyknitt</dc:creator>
      <dc:date>2023-02-13T23:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: MBDT LIN compile error</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-LIN-compile-error/m-p/1601227#M8028</link>
      <description>&lt;P&gt;I was able to work around the compiler error by adding the missing #defines into the Custom Code section of the Simulink model configuration.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a bit of a hack though, and I'd still like to understand the answers to the two questions in the post above.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andyknitt_0-1676648708170.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/211407i9DB931D758A8FD52/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andyknitt_0-1676648708170.png" alt="andyknitt_0-1676648708170.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm now experiencing a different issue.&lt;/P&gt;&lt;P&gt;When acting as a LIN master, I can successfully send messages to and receive data from slaves if the slaves are all connected and working properly.&amp;nbsp; However, if I send a message header to get data from a slave that isn't present and the slave doesn't respond, the&amp;nbsp;LIN_ReceiveFrameData seems to be blocking and doesn't allow transmission of any additional headers via the LIN_Master_Send_Header block if it never receives any frame data from the slave.&amp;nbsp; Is there a way to address this?&amp;nbsp; I don't see any timeout values in any of the LIN blocks, nor do I see a timeout in the LIN events that can be generated by the LIN_ISR block.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 15:52:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-LIN-compile-error/m-p/1601227#M8028</guid>
      <dc:creator>andyknitt</dc:creator>
      <dc:date>2023-02-17T15:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: MBDT LIN compile error</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-LIN-compile-error/m-p/1602290#M8029</link>
      <description>&lt;P&gt;I think I've figured out what's causing the "blocking" behavior if a Slave never sends the data that the Master S32K1xxx is expecting.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The LIN receive Simulink block calls the&amp;nbsp;LIN_LPUART_DRV_RecvFrmData() function, which is technically non-blocking (LIN_LPUART_DRV_RecvFrmDataBlocking() is the blocking version), but it does set the linCurrentState-&amp;gt;isBusBusy&amp;nbsp;flag to true, which effectively prevents the other LIN blocks from using the bus.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andyknitt_0-1676937643827.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/211624iA4C19C9D39EB1441/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andyknitt_0-1676937643827.png" alt="andyknitt_0-1676937643827.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;LIN_LPUART_DRV_MasterSendHeader() function called by the&amp;nbsp;LIN_Master_Send_Header block checks to see if the&amp;nbsp;linCurrentState-&amp;gt;isBusBusy flag is true and if it is, returns without sending the header.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andyknitt_1-1676937656014.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/211625iD80A42A9EA885D4C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andyknitt_1-1676937656014.png" alt="andyknitt_1-1676937656014.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If the Master never completes receiving data from the Slave (slave goes offline, etc.), the&amp;nbsp;linCurrentState-&amp;gt;isBusBusy flag never gets reset and the Master can't send any more headers.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Allowing a bad slave to prevent further action by the Master is probably not a great idea.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I modified the lin_lpuart_driver.c file as shown below as a hacky workaround, but modifying the NXP driver source code files is not an ideal long-term solution.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andyknitt_2-1676937818607.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/211626i7D62A4BEEFF427BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andyknitt_2-1676937818607.png" alt="andyknitt_2-1676937818607.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;A better solution may be to add some checks of the linUserConfig-&amp;gt;nodeFunction (MASTER/SLAVE) flag in various places where it makes sense for a Master to do things regardless of slave behavior, but I haven't fully thought through where all of those checks would need to be.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'd appreciate any insight into other possible solutions or more "correct" workarounds for this issue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 00:08:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-LIN-compile-error/m-p/1602290#M8029</guid>
      <dc:creator>andyknitt</dc:creator>
      <dc:date>2023-02-21T00:08:52Z</dc:date>
    </item>
  </channel>
</rss>

