<?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>nrf52- SPI read/MISO with bit offset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114331/nrf52--spi-read-miso-with-bit-offset</link><description>Hi 
 I am using nRF52832 , SDK17, S132, reading a device ID which should be 0x67, I am reading 0x33, than 0x80 ,so it seems to be that the MISO window is getting offseted * 
 * as 0x67 is 110011 1 and 0x33,0x80 is 110011 ,1000000 
 
 There is another</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Aug 2024 22:18:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114331/nrf52--spi-read-miso-with-bit-offset" /><item><title>RE: nrf52- SPI read/MISO with bit offset</title><link>https://devzone.nordicsemi.com/thread/500490?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2024 22:18:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b99e789e-40ac-40c9-b966-c89d137b3e94</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;If not doing so, set /CS, SCK and MOSI to high-drive H0H1 after any default port pin settings. Easier to see issues if &amp;#39;scope with SPI frequency set to 8MHz.&lt;/p&gt;
&lt;p&gt;Think the&amp;nbsp;&lt;span&gt;ICM-42670-P&lt;/span&gt; uses Mode 2 and soggy clock and wrong mode setting may also be an issue; worth trying both H0H1 and Mode 2.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1724970701141v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1724970415650v2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52- SPI read/MISO with bit offset</title><link>https://devzone.nordicsemi.com/thread/500487?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2024 21:40:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1de131fa-de9f-48bd-8fcd-cfbcb872a0cf</guid><dc:creator>Ron</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thanks for the quick reply,&lt;/p&gt;
&lt;p&gt;I omitted those definitions, I used mode 0, this is what I have done&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.sck_pin  = PIN_SPI_SCK;
    spi_config.miso_pin = PIN_SPI_MISO;
    spi_config.mosi_pin = PIN_SPI_MOSI;
    spi_config.ss_pin   = PIN_SPI_IMU_CS;
	spi_config.mode   	= NRF_DRV_SPI_MODE_0;
    err_code = nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, NULL, NULL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Trying mode 3 I get no response at all from the device,&lt;/p&gt;
&lt;p&gt;it is&amp;nbsp;ICM-42670-P&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://invensense.tdk.com/products/motion-tracking/6-axis/icm-42670-p/"&gt;https://invensense.tdk.com/products/motion-tracking/6-axis/icm-42670-p/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52- SPI read/MISO with bit offset</title><link>https://devzone.nordicsemi.com/thread/500482?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2024 19:37:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c838838-2ae3-464c-9293-d35c0a82a790</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Slightly confusing, settings vs &amp;#39;scope image. Suggest changing the SPI Mode to 0 or 3 and see if that works as it doesn&amp;#39;t look like Mode 0 is actually being used especially as pins are all set to NRF_DRV_SPI_PIN_NOT_USED; MISO data is maybe being sampled on the rising edge of the clock with the settings you have, and from the display it shows data should be sampled on the falling edge of the clock.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;Try
    .mode         = NRF_DRV_SPI_MODE_0,                      \
or
    .mode         = NRF_DRV_SPI_MODE_3,                      \&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>