<?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: How to pack message for FCAN_Send / unpack message for FCAN_Receive in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1653884#M8236</link>
    <description>&lt;P&gt;UPDATE:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to get 'CAN Pack' to work, but I'm not having any luck with 'CAN Unpack'.&lt;/P&gt;&lt;P&gt;To get 'CAN Pack' to work,&amp;nbsp;I set the output as a bus...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_0-1684503766194.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223991i79E67BC41267F65E/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_0-1684503766194.png" alt="johngreenjets_0-1684503766194.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The bus elements are shown below...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_1-1684503941760.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223993i1DB815735411CCE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_1-1684503941760.png" alt="johngreenjets_1-1684503941760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case I selected the bus elements Data, Length and ID to use with the FCAN_Send block.&lt;/P&gt;&lt;P&gt;I tried creating the same bus for 'CAN Unpack', but this did not work...&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="johngreenjets_3-1684504322692.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223998i1A78BA7B17D884BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_3-1684504322692.png" alt="johngreenjets_3-1684504322692.png" /&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 13:52:28 GMT</pubDate>
    <dc:creator>johngreenjets</dc:creator>
    <dc:date>2023-05-19T13:52:28Z</dc:date>
    <item>
      <title>How to pack message for FCAN_Send / unpack message for FCAN_Receive</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1653862#M8235</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;CAN packing&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;At the moment I am having to manually pack CAN messages using bit shifts, masks, mux etc in order to construct 8 bytes of data to transmit a CAN message.&amp;nbsp; An example of one such message is shown below...&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="johngreenjets_0-1684499366144.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223982i0CFB3900428DD082/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_0-1684499366144.png" alt="johngreenjets_0-1684499366144.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, this is very tedious especially when there are lots of CAN messages to pack.&lt;/P&gt;&lt;P&gt;I came across the embedded coder block 'CAN pack' which imports the CAN database, but unfortunately I cannot get this to work.&lt;/P&gt;&lt;P&gt;There is a data type mismatch because the&amp;nbsp;'CAN Pack' output is not a structure...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_1-1684499782245.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223984i43B55870C31AE336/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_1-1684499782245.png" alt="johngreenjets_1-1684499782245.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 'CAN pack' block does not seem to output structures...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_2-1684499952227.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223985iBC183A3366C50064/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_2-1684499952227.png" alt="johngreenjets_2-1684499952227.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Should this 'CAN pack' block work with the&amp;nbsp;'FCAN_Send' block and if so, how ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not, is there another way of packing the CAN messages (preferably by importing a CAN database) ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;CAN unpacking&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I haven't tried unpacking signals from the&amp;nbsp;'FCAN_Receive' block yet, so far I have only unpacked the 8 raw bytes of data as shown below...&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="johngreenjets_3-1684500311364.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223987i36604B29C8708CCE/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_3-1684500311364.png" alt="johngreenjets_3-1684500311364.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For testing purposes I have made byte 1 control a digital output (LED).&lt;/P&gt;&lt;P&gt;How can I extract the signals from the 8 bytes of raw data, without having to manually implement the unpacking using bit shifts, masks, mux etc&lt;/P&gt;&lt;P&gt;I tried the&amp;nbsp;embedded coder block 'CAN unpack' which imports the CAN database, but unfortunately I cannot get this to work.&lt;/P&gt;&lt;P&gt;There is a data type mismatch because the&amp;nbsp;'CAN unpack' input does not allow structures...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_4-1684501055288.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223988i7784D58D9AA585A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_4-1684501055288.png" alt="johngreenjets_4-1684501055288.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Should this 'CAN unpack' block work with the&amp;nbsp;'FCAN_Receive' block and if so, how ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not, is there another way of unpacking the CAN messages (preferably by importing a CAN database) ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 13:04:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1653862#M8235</guid>
      <dc:creator>johngreenjets</dc:creator>
      <dc:date>2023-05-19T13:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to pack message for FCAN_Send / unpack message for FCAN_Receive</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1653884#M8236</link>
      <description>&lt;P&gt;UPDATE:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to get 'CAN Pack' to work, but I'm not having any luck with 'CAN Unpack'.&lt;/P&gt;&lt;P&gt;To get 'CAN Pack' to work,&amp;nbsp;I set the output as a bus...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_0-1684503766194.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223991i79E67BC41267F65E/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_0-1684503766194.png" alt="johngreenjets_0-1684503766194.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The bus elements are shown below...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_1-1684503941760.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223993i1DB815735411CCE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_1-1684503941760.png" alt="johngreenjets_1-1684503941760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case I selected the bus elements Data, Length and ID to use with the FCAN_Send block.&lt;/P&gt;&lt;P&gt;I tried creating the same bus for 'CAN Unpack', but this did not work...&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="johngreenjets_3-1684504322692.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/223998i1A78BA7B17D884BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_3-1684504322692.png" alt="johngreenjets_3-1684504322692.png" /&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 13:52:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1653884#M8236</guid>
      <dc:creator>johngreenjets</dc:creator>
      <dc:date>2023-05-19T13:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to pack message for FCAN_Send / unpack message for FCAN_Receive</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1655579#M8241</link>
      <description>&lt;P&gt;UPDATE:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to get 'CAN Unpack' to work as follows:&lt;/P&gt;&lt;P&gt;1. Create the datatype 'CAN_MESSAGE_BUS' by running the command 'canMessageBusType' at the MATLAB prompt.&amp;nbsp; To see the structure of the datatype, run 'CAN_MESSAGE_BUS.Elements'...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_0-1684832781179.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/224420iFD6B850DA7E69044/image-size/medium?v=v2&amp;amp;px=400" role="button" title="johngreenjets_0-1684832781179.png" alt="johngreenjets_0-1684832781179.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. Create a bus and set the output data type to 'CAN_MESSAGE_BUS'.&amp;nbsp; The inputs to the bus are as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Extended&lt;UL&gt;&lt;LI&gt;datatype uint8&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Length&amp;nbsp;&lt;UL&gt;&lt;LI&gt;datatype uint8&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Remote&amp;nbsp;&lt;UL&gt;&lt;LI&gt;datatype uint8&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Error&lt;UL&gt;&lt;LI&gt;datatype uint8&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;ID&lt;UL&gt;&lt;LI&gt;datatype uint32&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Timestamp&lt;UL&gt;&lt;LI&gt;datatype double&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Data&amp;nbsp;&lt;UL&gt;&lt;LI&gt;datatype uint8(8)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&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="johngreenjets_1-1684833145728.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/224424iE909B5417EAB7099/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_1-1684833145728.png" alt="johngreenjets_1-1684833145728.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3. The following outputs from the NXP Rx Complete block are used as the inputs to the 'CAN Unpack' block...&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ID&lt;/LI&gt;&lt;LI&gt;Data&lt;/LI&gt;&lt;LI&gt;Length&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johngreenjets_2-1684833597344.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/224430i2DD4DDC5BB50A1DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="johngreenjets_2-1684833597344.png" alt="johngreenjets_2-1684833597344.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 09:22:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1655579#M8241</guid>
      <dc:creator>johngreenjets</dc:creator>
      <dc:date>2023-05-23T09:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to pack message for FCAN_Send / unpack message for FCAN_Receive</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1879098#M9159</link>
      <description>&lt;P&gt;Simply awesome John to document your work for the benifit of the community . I am also stuck on this issue , well check on your suggested solution.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 16:12:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-pack-message-for-FCAN-Send-unpack-message-for-FCAN/m-p/1879098#M9159</guid>
      <dc:creator>Vasappanavara</dc:creator>
      <dc:date>2024-05-31T16:12:44Z</dc:date>
    </item>
  </channel>
</rss>

