<?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 read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14382/how-to-read-adxl362-register-values-in-nrf52</link><description>I am using SPI0 of nrf52.Following is the code: 
 main.c</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Jun 2016 12:49:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14382/how-to-read-adxl362-register-values-in-nrf52" /><item><title>RE: How to read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/thread/54915?ContentTypeID=1</link><pubDate>Tue, 14 Jun 2016 12:49:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6be755db-e435-40e3-8942-945ec3acec1b</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;That&amp;#39;s good! I&amp;#39;m glad you made it work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/thread/54914?ContentTypeID=1</link><pubDate>Tue, 14 Jun 2016 11:52:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fddb54c9-39a2-4cc9-9014-2fc2b7da533b</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi Martin,
Yes you are right.Actually I was not waiting for flag &amp;quot;m_transfer_completed&amp;quot; to generate.That is when &amp;quot;m_transfer_completed=true&amp;quot; then only I can send next byte to the ADXL362 register. As per your comment I have modified my code and now I can communicate (Read as well as Write) with ADXL362.Thanks for your comment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/thread/54913?ContentTypeID=1</link><pubDate>Tue, 14 Jun 2016 10:39:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1ca25cc-1d90-4339-b3e7-e395d1f099ae</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I don&amp;#39;t see the &lt;code&gt;write()&lt;/code&gt; function you have in your code. Also in your &lt;code&gt;read()&lt;/code&gt; function you start a transfer with &lt;code&gt;nrf_drv_spi_transfer()&lt;/code&gt; and then already in the next line you try to read the rx buffer. At this point the SPI will not yet have completed the transfer and hence, you will not be able to read new data. You need to wait until the SPI interrupt handler is called with a message saying the transfer is complete. Or you can initiate the SPI driver in blocking mode. Then &lt;code&gt;nrf_drv_spi_transfer()&lt;/code&gt; will not return before the transfer is done and it is safe to read the data in the next line. You can use blocking mode by writing &lt;code&gt;nrf_drv_spi_init(p_instance, &amp;amp;config, NULL);&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/thread/54912?ContentTypeID=1</link><pubDate>Fri, 10 Jun 2016 18:19:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e8e7500-9891-41a4-95ac-0b9da6f6901f</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;But I am facing Problem in writing the values into the ADXL362 registers using SPI_master code of nrf52. I am using UART for displaying register values on terminal.This is my main function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
  {
     // Setup bsp module.
     bsp_configuration();
    LEDS_CONFIGURE(LEDS_MASK);
LEDS_OFF(LEDS_MASK);
uint32_t err_code;
	

	const app_uart_comm_params_t comm_params =
  {
      RX_PIN_NUMBER,
      TX_PIN_NUMBER,
      RTS_PIN_NUMBER,
      CTS_PIN_NUMBER,
      APP_UART_FLOW_CONTROL_ENABLED,
      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);
		
	
for (;;)
{
			
    #if (SPI0_ENABLED == 1) 
    if (m_transfer_completed)
    {
      m_transfer_completed = false;	
				switch_state();
				nrf_delay_ms(DELAY_MS);
															
    }
    #endif // (SPI0_ENABLED == 1) 
			
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;I am writing the values in ADXL362 registers using following function.When I write value in particular register individually one at time and then read it back then it working.But when when I perform write operation for all register simultaneously an then read any one of them then it giving me  zero value.Following is the code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  static void switch_state(void)
{
nrf_drv_spi_t const * p_instance;
	nrf_drv_spi_config_t const * p_config;

switch (m_spi_master_ex_state)
{
    #if (SPI0_ENABLED == 1)
    case TEST_STATE_SPI0_LSB:
        p_instance = &amp;amp;m_spi_master_0;
        spi_master_init(p_instance, true);
        break;

    case TEST_STATE_SPI0_MSB:
        p_instance = &amp;amp;m_spi_master_0;
        spi_master_init(p_instance, false);
        break;
    #endif // (SPI0_ENABLED == 1)

    default:
        return;
}
	
	
	write(p_instance, 0x25,0x03);
	nrf_delay_ms(DELAY_MS);
	write(p_instance, 0x23,0x58);
	nrf_delay_ms(DELAY_MS);
		
	read(p_instance, 0x23);

		
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#endif // (SPI0_ENABLED == 1)
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/thread/54911?ContentTypeID=1</link><pubDate>Fri, 10 Jun 2016 18:10:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f8e47d4-177c-41ee-8c8b-f40953ecf987</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi, I am able to read the register value of ADXL362 accelerometer into nrf52 with slight modification with previous code.Modifications are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void read(nrf_drv_spi_t const * p_instance, uint8_t reg){
	m_tx_data_spi[0] = 0x0B;
	m_tx_data_spi[1] = reg;
	m_tx_data_spi[2] = 0x00;
//	m_rx_data_spi[2] = 0;
	uint32_t err_code = nrf_drv_spi_transfer(p_instance,
    m_tx_data_spi, 3, m_rx_data_spi, 3);

print(m_rx_data_spi[2]);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    void print(unsigned char p)
  {
           static char buff[4]={0};
	sprintf(buff,&amp;quot;%x&amp;quot;,p);
	app_uart_put(buff[0]);
	app_uart_put(buff[1]);
	app_uart_put(0x0A);
	app_uart_put(0x0D);
nrf_delay_ms(DELAY_MS*10);
 }
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/thread/54910?ContentTypeID=1</link><pubDate>Fri, 10 Jun 2016 11:47:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7357baed-fe95-47ed-9a8d-a5e26fa280f9</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Can you please try to tidy up your code? Remove all the code that is not necessary and show us how exactly you are initiating the SPI and how you do read and write operations.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read ADXL362 register values in nrf52?</title><link>https://devzone.nordicsemi.com/thread/54909?ContentTypeID=1</link><pubDate>Wed, 08 Jun 2016 14:16:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3390d1c4-7b23-4bb8-9191-31f5f7ec86d3</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;That code just looks like a small modification of the spi_master example in SDK 0.9.2? If you want our help you will need to describe your problem in more detail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>