<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87426/how-to-create-an-instance-of-rpc-remote-procedural-call-using-the-nrf52840</link><description>Hello, 
 I&amp;#39;m using SDK 17.0.2 with S113, v7.2.0 on the NRF52840. We currently have an instance of CLI running in our executive loop, and it works fine. We&amp;#39;d also like to implement RPC as well for calling functions from a remote processor. 
 
 This is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Jul 2022 09:25:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87426/how-to-create-an-instance-of-rpc-remote-procedural-call-using-the-nrf52840" /><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/378031?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 09:25:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4eedff32-9247-47b8-aff1-b7d8ad498b92</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Does your call to&amp;nbsp;&lt;span&gt;app_uart_put() return any error codes?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Where are you calling this from? Is it called from interrupt context?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/376525?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2022 05:24:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:202df1a9-6a3b-4ca0-8598-9b1e764111b5</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;Interesting issue that I&amp;#39;m seeing. Okay, so app_uart_get() is able to receive bytes over the RX line from a requesting app, however, app_uart_put() cannot send any data back in response. We have confirmed this by logic analyzer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is my code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int8_t transportSend( const uint16_t bufferSize, uint8_t *pBuffer )
{
    if ( pBuffer == NULL )
    {
        NRF_LOG_INFO(&amp;quot;NULL?&amp;quot;);
        return TRANSPORT_ERROR;
    }
    
    uint32_t status = NRF_SUCCESS;

    status = app_uart_put( START_BYTE );

    if (status != NRF_SUCCESS)
    {
        NRF_LOG_INFO(&amp;quot;Failure in %s() @line %d&amp;quot;, __FUNCTION__, __LINE__);
        return status;
    }

    for ( uint16_t i = 0; i &amp;lt; bufferSize; i++ )
    {
        NRF_LOG_INFO(&amp;quot;pBuffer[%d] = %d&amp;quot;, i, pBuffer[i]);
        // UART is spaming 0xFF so it has to be escaped
        if ( ( pBuffer[i] == START_BYTE ) ||
             ( pBuffer[i] == STOP_BYTE ) ||
             ( pBuffer[i] == ESCAPE_BYTE ) ||
             ( pBuffer[i] == 0xFF ) )
        {
            status = app_uart_put( ESCAPE_BYTE );
            if (status != NRF_SUCCESS)
            {
                NRF_LOG_INFO(&amp;quot;Failure in %s() @line %d&amp;quot;, __FUNCTION__, __LINE__);
                return status;
            }

            status = app_uart_put( escapeByte( pBuffer[i] ) );
            if (status != NRF_SUCCESS)
            {
                NRF_LOG_INFO(&amp;quot;Failure in %s() @line %d&amp;quot;, __FUNCTION__, __LINE__);
                return status;
            }
        }
        else
        {
            status = app_uart_put( pBuffer[i] );
            if (status != NRF_SUCCESS)
            {
                NRF_LOG_INFO(&amp;quot;Failure in %s() @line %d&amp;quot;, __FUNCTION__, __LINE__);
                return status;
            }
        }
    } // end of for-loop

    status = app_uart_put( STOP_BYTE );
    if (status != NRF_SUCCESS)
    {
        NRF_LOG_INFO(&amp;quot;Failure in %s() @line %d&amp;quot;, __FUNCTION__, __LINE__);
        return status;
    }

    return TRANSPORT_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Am I using app_uart_put() incorrectly? Also, do functions like&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;nrf_pwr_mgmt_run()&lt;br /&gt;&lt;br /&gt;&lt;span&gt; UART functionality?&lt;/span&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/370742?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 15:15:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05792a89-c0d8-45cb-9ea7-79ee4adf29c0</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If the CLI UART backend is enabled, you will need to disable this or not start the CLI at all when using the UART instance for anything else. If you are using different UART instances (0 and 1) for the two libraries, you do not need to disable the CLI.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/370525?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 18:57:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a701dac9-45c6-4e66-9503-df30b093d06d</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;Thank you for confirming...using CLI over UART was at the root of my problem. I&amp;#39;m now creating an instance of standard UART in order to send and receive byte-packed data structs. Do I need to stop my CLI process when using my standard instance of UART or can they co-exist together?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
// Spawn an instance of UART
    static bool uart_instance_activated = false;

    if (!uart_instance_activated)
    {
        uart_instance_activated = true;
        uint32_t err_code = NRF_SUCCESS;
        const app_uart_comm_params_t comm_params =
        {
            UART_RX_PIN,
            UART_TX_PIN,
            UART_RTS_PIN_NUMBER,
            UART_CTS_PIN_NUMBER,
            UART_HWFC,
            false,
            NRF_UART_BAUDRATE_115200
        };

        APP_UART_FIFO_INIT(&amp;amp;comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                      uart_error_handle,
                APP_IRQ_PRIORITY_LOWEST,
                              err_code);

        APP_ERROR_CHECK(err_code); &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/370358?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 08:29:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba76f315-5772-4557-836b-82468e5ed578</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The CLI library uses strcmp() to check for matching commands. If the commands are not in string format (with a \0 string terminator), this will likely fail.&lt;/p&gt;
&lt;p&gt;The UART peripheral/transport can support any byte-data, but you need to handle the received data correctly in the application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/370300?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 20:53:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35e9b56e-9807-449e-a297-733ea45f8992</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;I think I see the issue here. I&amp;#39;m using a CLI over UART transport layer. Can CLU over UART support commands that are non-strings? For instance, byte-packed Structs as commands.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/366485?ContentTypeID=1</link><pubDate>Thu, 05 May 2022 13:21:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66efd485-a6ee-4295-810d-68d75b0310d2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Can you explain in more detail what you mean by &amp;quot;&lt;span&gt;system simply gets lost and is unresponsive&amp;quot;? You should be able to see where the code is stuck with a debugger. If you can provide a minimal example and instructions to reproduce this behavior, we may be able to help debug it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you have a softdevice enabled when doing the stepping through code? Stepping with the softdevice enabled will usually cause asserts, as the debugger blocks the softdevice to handle timing-critical interrupts/tasks.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/366326?ContentTypeID=1</link><pubDate>Wed, 04 May 2022 19:48:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb6d9352-0cf6-42b7-8c21-2d84e70bdb22</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;Retarget in sdk_config.h has been implemented and __getchar() is now compiling. However, I&amp;#39;m seeing this problem when I step through the code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/44397/cannot-retarget-getchar-read-getch"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/44397/cannot-retarget-getchar-read-getch&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This system simply gets lost and is unresponsive. Is there an inherit SDK bug or bug fix that is suggested?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/365918?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 09:16:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c35f3f2-97ac-424d-8eda-2283ca0343ad</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;There is an implementation for __getChar() in the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__retarget.html"&gt;stdio retarget layer&lt;/a&gt; in the SDK (components\libraries\uart\retarget.c):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#elif defined(__GNUC__) &amp;amp;&amp;amp; defined(__SES_ARM)

int __getchar(FILE * p_file)
{
    uint8_t input;
    while (app_uart_get(&amp;amp;input) == NRF_ERROR_NOT_FOUND)
    {
        // No implementation needed.
    }
    return input;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m assuming that the call to&amp;nbsp;&lt;span&gt;SEGGER_RTT_WaitKey() that you are seeing is from the&amp;nbsp;SEGGER_RTT_Syscalls_SES.c file:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/********************************************************************* 
*
*       __getchar()
*
*  Function description
*    Wait for and get a character via RTT.
*/
int __getchar() {
  return SEGGER_RTT_WaitKey();
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you include and enable the UART retarget layer in your sdk_config.h file, the __getChar implementation in&amp;nbsp;SEGGER_RTT_Syscalls_SES.c should be excluded by the &amp;quot;#if !defined(RETARGET_ENABLED) || RETARGET_ENABLED == 0&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;// &amp;lt;q&amp;gt; RETARGET_ENABLED  - retarget - Retargeting stdio functions
 

#ifndef RETARGET_ENABLED
#define RETARGET_ENABLED 1
#endif&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/365889?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 07:39:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:438caa75-3377-4b5a-a99f-f9e67ba33cc4</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;I think I see the issue here. Viewing the call stack, my code eventually calls &amp;quot;getchar()&amp;quot;, which calls:&lt;/p&gt;
&lt;p&gt;__getChar();&lt;/p&gt;
&lt;p&gt;which calls&lt;/p&gt;
&lt;p&gt;SEGGER_RTT_WaitKey(); // here in lies the problem.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m trying to pull a byte from UART, and not RTT. Is there a way to retarget getChar() to pull a byte from UART? I&amp;#39;m using SES v5.68.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Create an Instance of RPC (Remote Procedural Call) using the NRF52840</title><link>https://devzone.nordicsemi.com/thread/365566?ContentTypeID=1</link><pubDate>Fri, 29 Apr 2022 11:31:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7407f390-877c-441a-a57a-df8b6cc38ae2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As far as I know, we do not have any RPC libraries in nRF5 SDK. Have you added any libraries yourself, or where do you expect this support to come from?&lt;/p&gt;
&lt;p&gt;If you can describe your use-case, requirements and setup in more details, we may be able to provide some suggestions.&lt;/p&gt;
&lt;p&gt;We do have a &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrfxlib/nrf_rpc/README.html"&gt;RPC library in nRF Connect SDK&lt;/a&gt;, intended for the nRF5340, but this is not supported in the old nRF5 SDK.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>