<?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: FreeMaster Pipe Example in FreeMASTER</title>
    <link>https://community.nxp.com/t5/FreeMASTER/FreeMaster-Pipe-Example/m-p/1480561#M1055</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/181745"&gt;@baiRB&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;There is an example application available in FreeMASTER Communication driver folder.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;First you need to find this folder in one of the following locations:&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;C:\NXP\FreeMASTER_Serial_Communication_Driver_V2.0&lt;/STRONG&gt;, or&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;C:\NXP\{&lt;EM&gt;S32DS.x.y&lt;/EM&gt;}\S32DS\software\FreeMASTER_Serial_Communication_Driver_V2_0&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;S32DS.x.y&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;is your Design Studio version.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Next, go to&amp;nbsp;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;\examples\SCI_driver_examples\Common\freemaster_example.c&lt;/STRONG&gt;&lt;/EM&gt; and serach for&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;FMSTR_PipeOpen&amp;nbsp;&lt;/STRONG&gt;function calls.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;On a high level you use&amp;nbsp;&lt;STRONG&gt;FMSTR_PipeOpen&lt;/STRONG&gt; to create a Pipe with unique ID, assign pipe message handler and assign read and write buffers ex:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;FMSTR_HPIPE hpipe;
static unsigned char pipe1_rxb[10];
static unsigned char pipe1_txb[100];
hpipe = FMSTR_PipeOpen(1, my_pipe_handler,
        (FMSTR_ADDR)pipe1_rxb, sizeof(pipe1_rxb),
        (FMSTR_ADDR)pipe1_txb, sizeof(pipe1_txb));&lt;/LI-CODE&gt;&lt;P&gt;and inside your pipe handler you read incoming data, process it and return an output:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static void my_pipe_handler(FMSTR_HPIPE hpipe)
{
    static const char* names[10] =
    {
            "zero", "one", "two", "three", "four",
            "five", "six", "seven", "eight", "nine"
    };

    static char buff[4];
    char* n;
    char c;

    /* This simple handler translates the digits into number names.
     * Other characters are just echoed back.  */
    while(FMSTR_PipeRead(hpipe, (FMSTR_ADDR)buff, 1, 0))
    {
        c = buff[0];

        if(c &amp;gt;= '0' &amp;amp;&amp;amp; c &amp;lt;= '9')
        {
            /* A tiny strlen */
            n = (char*) names[c-'0'];
            FMSTR_PipeWrite(hpipe, (FMSTR_ADDR)n, my_strlen(n), 0);
        }
        else
        {
            /* Echo */
            FMSTR_PipeWrite(hpipe, (FMSTR_ADDR)buff, 1, 0);
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;this is a default example that reads digits from the host and returns their numeric representation (1&lt;SPAN&gt;→&lt;/SPAN&gt;one, 2&lt;SPAN&gt;→two etc.).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;One last detail - do not forget to add corresponding configuration to freemaster_cfg.h&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*****************************************************************************
* Pipes as data streaming over FreeMASTER protocol
******************************************************************************/

#define FMSTR_USE_PIPES        3   /* Enable/Disable pipes */
#define FMSTR_MAX_PIPES_COUNT  3   /* 3 pipes for demo purposes */&lt;/LI-CODE&gt;&lt;P&gt;Hope it helps,&lt;BR /&gt;Iulian&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jun 2022 11:24:46 GMT</pubDate>
    <dc:creator>iulian_stan</dc:creator>
    <dc:date>2022-06-27T11:24:46Z</dc:date>
    <item>
      <title>FreeMaster Pipe Example</title>
      <link>https://community.nxp.com/t5/FreeMASTER/FreeMaster-Pipe-Example/m-p/1480036#M1054</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm using FreeMaster to be my runtime debuging tool, I need a function: the target can put out some log(string type) when I debug the target. so I read the FreeMaster User Manual . PIPE Maybe can be done ,but I don't know how to use this function,can give me an example?&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm using the S32k1 &lt;SPAN&gt;series . please&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 05:16:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/FreeMASTER/FreeMaster-Pipe-Example/m-p/1480036#M1054</guid>
      <dc:creator>baiRB</dc:creator>
      <dc:date>2022-06-25T05:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: FreeMaster Pipe Example</title>
      <link>https://community.nxp.com/t5/FreeMASTER/FreeMaster-Pipe-Example/m-p/1480561#M1055</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/181745"&gt;@baiRB&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;There is an example application available in FreeMASTER Communication driver folder.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;First you need to find this folder in one of the following locations:&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;C:\NXP\FreeMASTER_Serial_Communication_Driver_V2.0&lt;/STRONG&gt;, or&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;C:\NXP\{&lt;EM&gt;S32DS.x.y&lt;/EM&gt;}\S32DS\software\FreeMASTER_Serial_Communication_Driver_V2_0&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;S32DS.x.y&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;is your Design Studio version.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Next, go to&amp;nbsp;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;\examples\SCI_driver_examples\Common\freemaster_example.c&lt;/STRONG&gt;&lt;/EM&gt; and serach for&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;FMSTR_PipeOpen&amp;nbsp;&lt;/STRONG&gt;function calls.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;On a high level you use&amp;nbsp;&lt;STRONG&gt;FMSTR_PipeOpen&lt;/STRONG&gt; to create a Pipe with unique ID, assign pipe message handler and assign read and write buffers ex:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;FMSTR_HPIPE hpipe;
static unsigned char pipe1_rxb[10];
static unsigned char pipe1_txb[100];
hpipe = FMSTR_PipeOpen(1, my_pipe_handler,
        (FMSTR_ADDR)pipe1_rxb, sizeof(pipe1_rxb),
        (FMSTR_ADDR)pipe1_txb, sizeof(pipe1_txb));&lt;/LI-CODE&gt;&lt;P&gt;and inside your pipe handler you read incoming data, process it and return an output:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static void my_pipe_handler(FMSTR_HPIPE hpipe)
{
    static const char* names[10] =
    {
            "zero", "one", "two", "three", "four",
            "five", "six", "seven", "eight", "nine"
    };

    static char buff[4];
    char* n;
    char c;

    /* This simple handler translates the digits into number names.
     * Other characters are just echoed back.  */
    while(FMSTR_PipeRead(hpipe, (FMSTR_ADDR)buff, 1, 0))
    {
        c = buff[0];

        if(c &amp;gt;= '0' &amp;amp;&amp;amp; c &amp;lt;= '9')
        {
            /* A tiny strlen */
            n = (char*) names[c-'0'];
            FMSTR_PipeWrite(hpipe, (FMSTR_ADDR)n, my_strlen(n), 0);
        }
        else
        {
            /* Echo */
            FMSTR_PipeWrite(hpipe, (FMSTR_ADDR)buff, 1, 0);
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;this is a default example that reads digits from the host and returns their numeric representation (1&lt;SPAN&gt;→&lt;/SPAN&gt;one, 2&lt;SPAN&gt;→two etc.).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;One last detail - do not forget to add corresponding configuration to freemaster_cfg.h&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*****************************************************************************
* Pipes as data streaming over FreeMASTER protocol
******************************************************************************/

#define FMSTR_USE_PIPES        3   /* Enable/Disable pipes */
#define FMSTR_MAX_PIPES_COUNT  3   /* 3 pipes for demo purposes */&lt;/LI-CODE&gt;&lt;P&gt;Hope it helps,&lt;BR /&gt;Iulian&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 11:24:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/FreeMASTER/FreeMaster-Pipe-Example/m-p/1480561#M1055</guid>
      <dc:creator>iulian_stan</dc:creator>
      <dc:date>2022-06-27T11:24:46Z</dc:date>
    </item>
  </channel>
</rss>

