<?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>rssi vial serial communication</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30608/rssi-vial-serial-communication</link><description>Hi All, 
 1.One master BLE has to connect to Slave BLE, then both device should read other RSSI and sent the data through UART.sending the RSSI should be every 200 millisec or setted time. 
 
 please suggest how to achieve this . We have urgent demo to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Feb 2018 09:46:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30608/rssi-vial-serial-communication" /><item><title>RE: rssi vial serial communication</title><link>https://devzone.nordicsemi.com/thread/121365?ContentTypeID=1</link><pubDate>Tue, 20 Feb 2018 09:46:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b256ab7-4291-49f2-8b87-71b7d5a0892f</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I suggest basing this on the ble_app_uart (slave) and ble_app_uart_c (master) examples in the SDK, and use two nRF52832 DK for the demo. I recommened using the latest SDK version 14.2 for this.&lt;/p&gt;
&lt;p&gt;Changes that need to be done one ble_app_uart(slave):&lt;/p&gt;
&lt;p&gt;In function&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;ble_evt_handler()&lt;/em&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;under the event&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;BLE_GAP_EVT_CONNECTED&lt;/em&gt;, start the rssi reporting when the connection is established, with&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;sd_ble_gap_rssi_start(m_conn_handle,1,1);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Define, and implement the rssi app timer used to print the RSSI value:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;APP_TIMER_DEF(m_rssi_timer_id);                         
#define RSSI_MEAS_INTERVAL         APP_TIMER_TICKS(200)                

static void rssi_timeout_handler(void * p_context)
{
    UNUSED_PARAMETER(p_context);
    int8_t p_rssi;
    if(m_conn_handle != BLE_CONN_HANDLE_INVALID)
    {
       if(sd_ble_gap_rssi_get(m_conn_handle,&amp;amp;p_rssi) == NRF_SUCCESS)
        {

        printf(&amp;quot;RSSI = %d\r\n&amp;quot;,p_rssi);

        }
    }

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In main(), make sure that you create and start the rssi app timer, with&amp;nbsp;&lt;/span&gt;&lt;em&gt;app_timer_create()&lt;/em&gt;&lt;span&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;em&gt;app_timer_start()&lt;/em&gt;&lt;span&gt;. The main() should then look like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
    uint32_t err_code;
    bool     erase_bonds;

    // Initialize.
    err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);
    err_code = app_timer_create(&amp;amp;m_rssi_timer_id,
                                APP_TIMER_MODE_REPEATED,
                                rssi_timeout_handler);
    err_code = app_timer_start(m_rssi_timer_id, RSSI_MEAS_INTERVAL, NULL);
    APP_ERROR_CHECK(err_code);

    uart_init();
    log_init();

    buttons_leds_init(&amp;amp;erase_bonds);
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();

    printf(&amp;quot;\r\nUART Start!\r\n&amp;quot;);
    NRF_LOG_INFO(&amp;quot;UART Start!&amp;quot;);
    err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);

    // Enter main loop.
    for (;;)
    {
        UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
        power_manage();
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Use the same&amp;nbsp;method with ble_app_uart_c.&lt;/p&gt;
&lt;p&gt;The RSSI values will be printed over UART. If you have connected the DKs to the PC, open a terminal, such as&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://www.compuphase.com/software_termite.htm"&gt;Termite&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;to view the RSSI values. I have attached the main.c files I used when testing this for both slave and master. I used SDK 14.2 for this.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-1de6414e6c0e4960a98c88149b8ca133/main_5F00_slave.c"&gt;devzone.nordicsemi.com/.../main_5F00_slave.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-1de6414e6c0e4960a98c88149b8ca133/main_5F00_central.c"&gt;devzone.nordicsemi.com/.../main_5F00_central.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>