<?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>regarding spi communication nrf52840 with sx1276</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74836/regarding-spi-communication-nrf52840-with-sx1276</link><description>hello, 
 i am using nrf52840 dvk with sx1276 lora modules and trying to read my device address using spi i am just calling the below function in main 
 uint8_t spiCommandData[2]; uint8_t spiReadData[2]; 
 static unsigned char RFM_Read() { unsigned char</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 May 2021 09:55:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74836/regarding-spi-communication-nrf52840-with-sx1276" /><item><title>RE: regarding spi communication nrf52840 with sx1276</title><link>https://devzone.nordicsemi.com/thread/308692?ContentTypeID=1</link><pubDate>Fri, 07 May 2021 09:55:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e54852a6-773a-432c-8f3e-14cc39be86f9</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Normally, the SPI device will output data&amp;nbsp;&lt;em&gt;after&amp;nbsp;&lt;/em&gt;you have written the command/address, while the SPI peripheral in the nRF52840 will start filling the RX buffer at the same time you are writing data from the TX buffer. If you set the RX length to 2 as you have done in your code, the SPI will not read any bytes after the TX buffer output is completed, the RX buffer will be filled at the same time. If you want to read 2 bytes after TX is done, you need to increase the RX length to 4 bytes, and ignore the 2 first bytes in the RX buffer.&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>