<?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>Problem facing with RSSI value in nRF51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17051/problem-facing-with-rssi-value-in-nrf51822</link><description>Hi, 
 I am new to nRF microcontroller and communication . currently, I am working on nRF51822 microcontroller. I am able to communicate between two nRF51822 microcontrollers(without any protocol stack). 
 I want to measure RSSI value. I got RSSI new</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Feb 2019 16:14:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17051/problem-facing-with-rssi-value-in-nrf51822" /><item><title>RE: Problem facing with RSSI value in nRF51822</title><link>https://devzone.nordicsemi.com/thread/170703?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 16:14:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c23c776-d484-40c5-a8e2-aa53589def97</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;sachin.singh,&lt;/p&gt;
&lt;p&gt;This thread is 2 years old, please use the post&amp;nbsp;you created &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/43588/reading-rssi-values-radio-test-example"&gt;here&lt;/a&gt;&amp;nbsp;instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem facing with RSSI value in nRF51822</title><link>https://devzone.nordicsemi.com/thread/170486?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 06:07:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b4a68eb-52c8-4d4f-98f2-33f1d0835d29</guid><dc:creator>sachin.singh</dc:creator><description>&lt;p&gt;Hi Krvb &amp;amp; Sigurd,&lt;/p&gt;
&lt;p&gt;I am developing one of the code for the application for the custom board.&lt;/p&gt;
&lt;p&gt;In which I need to develop the code for the receiving signal RSSI value of the selected channel for board testing.&lt;/p&gt;
&lt;p&gt;I was just gone through your code and tried to understand the code thoroughly, what I understand that we are getting the RSSI value right ?? but for which channel ??&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can we define the channel or select the channel on which we need to the get RSSI on the particular channel (channel entered by user).&lt;/p&gt;
&lt;p&gt;I need to pass the channel and read the RSSI value for the same channel. Is there any modification in above code through which I can add or pass the channel and receive the RSSI value.&lt;/p&gt;
&lt;p&gt;Looking forward for kind support and valuable responses ...&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem facing with RSSI value in nRF51822</title><link>https://devzone.nordicsemi.com/thread/65394?ContentTypeID=1</link><pubDate>Fri, 14 Oct 2016 13:00:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9e64b83-db91-4fac-bb04-9840f2785ae6</guid><dc:creator>kvrb</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;It is working properly. Thank you for your help.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s very informative support.&lt;/p&gt;
&lt;p&gt;Thank you once again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem facing with RSSI value in nRF51822</title><link>https://devzone.nordicsemi.com/thread/65395?ContentTypeID=1</link><pubDate>Fri, 14 Oct 2016 12:19:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10b8734b-6048-47bc-b54a-1be5ab2bf49b</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;You will need to start the RSSI in &lt;code&gt;while (NRF_RADIO-&amp;gt;EVENTS_END == 0U)&lt;/code&gt;, and then read the RRSI in &lt;code&gt;if(NRF_RADIO-&amp;gt;CRCSTATUS == 1U)&lt;/code&gt; in read_packet().&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/**@brief Function for reading packet.
 */
uint32_t read_packet()
{
    uint32_t result = 0;
    uint8_t rssi_sample;
    
    NRF_RADIO-&amp;gt;EVENTS_READY = 0U;
    // Enable radio and wait for ready
    NRF_RADIO-&amp;gt;TASKS_RXEN = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_READY == 0U)
    {
        // wait
    }
    
    NRF_RADIO-&amp;gt;EVENTS_END = 0U;
    // Start listening and wait for address received event
    
    NRF_RADIO-&amp;gt;TASKS_START = 1U;
        
    // Wait for end of packet or buttons state changed
    
    while (NRF_RADIO-&amp;gt;EVENTS_END == 0U)
    {
        NRF_RADIO-&amp;gt;TASKS_RSSISTART = 1;
        // wait
    }

    if (NRF_RADIO-&amp;gt;CRCSTATUS == 1U)
    {
        result = packet;
        rssi_sample = NRF_RADIO-&amp;gt;RSSISAMPLE;
        NRF_RADIO-&amp;gt;TASKS_RSSISTOP = 1;
    }
    
    //NRF_LOG_INFO(&amp;quot;rssi is: %d\r\n&amp;quot;, (unsigned int)rssi_sample);
    printf(&amp;quot;rssi is: %d\r\n&amp;quot;, (unsigned int)rssi_sample);
    
    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0U;
    // Disable radio
    NRF_RADIO-&amp;gt;TASKS_DISABLE = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_DISABLED == 0U)
    {
        // wait
    }
    return result;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem facing with RSSI value in nRF51822</title><link>https://devzone.nordicsemi.com/thread/65392?ContentTypeID=1</link><pubDate>Fri, 14 Oct 2016 10:47:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00a879ef-6f26-4022-9e12-0183c9f50851</guid><dc:creator>kvrb</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;I try the same function in my code.&lt;/p&gt;
&lt;p&gt;I am getting constant value 46 every time.&lt;/p&gt;
&lt;p&gt;This is my code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;radio_config.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf_error.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;

#define APP_TIMER_PRESCALER      0                     /**&amp;lt; Value of the RTC1 PRESCALER register. */
#define APP_TIMER_OP_QUEUE_SIZE  2                     /**&amp;lt; Size of timer operation queues. */

#define UART_TX_BUF_SIZE 256                           /**&amp;lt; UART TX buffer size. */
#define UART_RX_BUF_SIZE 1                             /**&amp;lt; UART RX buffer size. */

static uint32_t                   packet;              /**&amp;lt; Packet to transmit. */

void uart_error_handle(app_uart_evt_t * p_event)
{
   // No implementation needed.
}

/**@brief Function for initialization oscillators.
 */
void clock_initialization()
{
    /* Start 16 MHz crystal oscillator */
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART    = 1;

    /* Wait for the external oscillator to start up */
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0)
    {
        // Do nothing.
    }

    /* Start low frequency crystal oscillator for app_timer(used by bsp)*/
    NRF_CLOCK-&amp;gt;LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART    = 1;

    while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
}


/**@brief Function for reading packet.
 */
uint32_t read_packet()
{
    uint32_t result = 0;

    NRF_RADIO-&amp;gt;EVENTS_READY = 0U;
    // Enable radio and wait for ready
    NRF_RADIO-&amp;gt;TASKS_RXEN = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_READY == 0U)
    {
        // wait
    }
    NRF_RADIO-&amp;gt;EVENTS_END = 0U;
    // Start listening and wait for address received event
    NRF_RADIO-&amp;gt;TASKS_START = 1U;

    // Wait for end of packet or buttons state changed
    while (NRF_RADIO-&amp;gt;EVENTS_END == 0U)
    {
        // wait
    }

    if (NRF_RADIO-&amp;gt;CRCSTATUS == 1U)
    {
        result = packet;
    }
    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0U;
    // Disable radio
    NRF_RADIO-&amp;gt;TASKS_DISABLE = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_DISABLED == 0U)
    {
        // wait
    }
    return result;
}

uint8_t radio_rssi_get (void) {

uint8_t sample;
NRF_RADIO-&amp;gt;TASKS_RSSISTART = 1;
while (NRF_RADIO-&amp;gt;EVENTS_RSSIEND == 0){}
NRF_RADIO-&amp;gt;EVENTS_RSSIEND = 0;
sample = NRF_RADIO-&amp;gt;RSSISAMPLE;
NRF_RADIO-&amp;gt;TASKS_RSSISTOP = 1;
return sample;

}


/**
 * @brief Function for application main entry.
 * @return 0. int return type required by ANSI/ISO standard.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;
	//nrf_gpio_cfg_output(23); // Making LED port pin to output
	uint8_t rssi = 0; 

    clock_initialization();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    const app_uart_comm_params_t comm_params =  
    {
        RX_PIN_NUMBER, 
        TX_PIN_NUMBER, 
        RTS_PIN_NUMBER, 
        CTS_PIN_NUMBER, 
        APP_UART_FLOW_CONTROL_DISABLED, 
        false, 
        UART_BAUDRATE_BAUDRATE_Baud115200
    };   
    APP_UART_FIFO_INIT(&amp;amp;comm_params, 
                       UART_RX_BUF_SIZE, 
                       UART_TX_BUF_SIZE, 
                       uart_error_handle, 
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

    // Set radio configuration parameters
    radio_configure();
    NRF_RADIO-&amp;gt;PACKETPTR = (uint32_t)&amp;amp;packet;

    err_code = bsp_indication_text_set(BSP_INDICATE_USER_STATE_OFF, &amp;quot;Wait for first packet\n\r&amp;quot;);
    APP_ERROR_CHECK(err_code);

    while (true)
    {
		uint32_t received = read_packet();
		
        nrf_delay_ms(500);
        printf(&amp;quot;The contents of the package is %u\n\r&amp;quot;, (unsigned int)received);
		
		rssi = radio_rssi_get();
		 printf(&amp;quot;RSSI = %d\n\r&amp;quot;, rssi);
		
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem facing with RSSI value in nRF51822</title><link>https://devzone.nordicsemi.com/thread/65393?ContentTypeID=1</link><pubDate>Fri, 14 Oct 2016 07:55:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d18cde0-d6aa-4343-b848-0e19e221583c</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Try to use this code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t radio_rssi_get (void){
	
uint8_t sample;
NRF_RADIO-&amp;gt;TASKS_RSSISTART = 1;
while (NRF_RADIO-&amp;gt;EVENTS_RSSIEND == 0){}
NRF_RADIO-&amp;gt;EVENTS_RSSIEND = 0;
sample = NRF_RADIO-&amp;gt;RSSISAMPLE;
NRF_RADIO-&amp;gt;TASKS_RSSISTOP = 1;
return sample;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>