<?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 of 52832 SPI interface</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57109/problem-of-52832-spi-interface</link><description>Hi, 
 I have a problem of 52832&amp;#39;s SPI interface. Please find following description: 
 1. My test code is come from &amp;quot;spi&amp;quot; example code, by modify the SPI ping setting (please find sdk_config.h) and NRF_DRV_SPI_DEFAULT_CONFIG in nrf_drv_spi.h, please find</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 02 Feb 2020 19:02:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57109/problem-of-52832-spi-interface" /><item><title>RE: Problem of 52832 SPI interface</title><link>https://devzone.nordicsemi.com/thread/232201?ContentTypeID=1</link><pubDate>Sun, 02 Feb 2020 19:02:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98585b57-9b57-45dd-a972-ea612eb8a2f0</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;There is a code example in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/11438/problems-implementing-workaround-to-get-nrf52-to-send-an-octet-one-byte-through-spi/43141#43141"&gt;this post&lt;/a&gt;. It is written for an older SDK version, but I do not think that the API of the drivers used have changed much in later SDKs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem of 52832 SPI interface</title><link>https://devzone.nordicsemi.com/thread/232184?ContentTypeID=1</link><pubDate>Sun, 02 Feb 2020 05:33:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35d19615-59b0-45e2-a736-0ec1f823e7b7</guid><dc:creator>chianglin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for your answer.&lt;/p&gt;
&lt;p&gt;I still don&amp;#39;t know how to fix this problem after I study &amp;quot;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_EngC%2FERR%2FnRF52832%2FEngineeringC%2Flatest%2Fanomaly_832_58.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_EngC%2FERR%2FnRF52832%2FEngineeringC%2Flatest%2Fanomaly_832_58.html&lt;/a&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Would you please give me an sample code then I can fix this problem?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;p&gt;Chianglin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem of 52832 SPI interface</title><link>https://devzone.nordicsemi.com/thread/231676?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 13:54:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfc64e50-65b6-4c5f-a06f-f28c2059ae81</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;also take a look at&amp;nbsp;&lt;a href="https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#/media/File:SPI_timing_diagram2.svg"&gt;this&lt;/a&gt;&amp;nbsp;picture - you have CPOL=1 that means active low level of SCK, you should change this in your LA settings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem of 52832 SPI interface</title><link>https://devzone.nordicsemi.com/thread/231667?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 13:32:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0e22fdb-e767-48f9-92d1-462018f213c6</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;seems you have catched&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_EngC%2FERR%2FnRF52832%2FEngineeringC%2Flatest%2Fanomaly_832_58.html"&gt;this&lt;/a&gt;&amp;nbsp;bug.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem of 52832 SPI interface</title><link>https://devzone.nordicsemi.com/thread/231581?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 09:51:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27166135-4ece-4e83-a64b-161501502da9</guid><dc:creator>chianglin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;a) My default SCK pin in sdk_config.h setting is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifndef SPI_SCK_PIN
#define SPI_SCK_PIN 14
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; And my initialize setting in main() is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.ss_pin   = SPI_SS_PIN;
    spi_config.miso_pin = SPI_MISO_PIN;
    spi_config.mosi_pin = SPI_MOSI_PIN;
    spi_config.sck_pin  = SPI_SCK_PIN;
    APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, spi_event_handler, NULL));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; NRF_DRV_SPI_DEFAULT_CONFIG is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRF_DRV_SPI_DEFAULT_CONFIG                           \
{                                                            \
    .sck_pin      = NRF_DRV_SPI_PIN_NOT_USED,                \
    .mosi_pin     = NRF_DRV_SPI_PIN_NOT_USED,                \
    .miso_pin     = NRF_DRV_SPI_PIN_NOT_USED,                \
    .ss_pin       = NRF_DRV_SPI_PIN_NOT_USED,                \
    .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY,         \
    .orc          = 0xFF,                                    \
    .frequency    = NRF_SPI_FREQ_500K,                     \
    .mode         = NRF_DRV_SPI_MODE_2,                      \
    .bit_order    = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST,         \
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; If I want to create following wave form, how can I modify my program?&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/SPI_5F00_1.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;b) I had modify my program by using your suggest method, please fine following program,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static uint8_t       m_tx_buf[1] = {&amp;#39;1&amp;#39;}

APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, 1, m_rx_buf, 1));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;but, I found following wave-form output in Logic-analyzer.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/SPI_5F00_2.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; The wave-form still not correct (output data and output length).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Would you please give me some suggestion?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem of 52832 SPI interface</title><link>https://devzone.nordicsemi.com/thread/231555?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 09:03:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09d341bb-690d-4ba4-927a-d37b3d99747d</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;a) are you sure that your default config is taken from the right file? Your SCK pin behaves as in mode 1 - data is shifted with leading edge, sampling is expected at trailing one.&lt;/p&gt;
&lt;p&gt;b) you&amp;#39;re initializing uint8_t[] array with a string. Most compilers will give you an error here, but if your compiler didn&amp;#39;t, it takes a sting as two bytes - including trailing zero character. The right way is:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;static uint8_t m_tx_buf[1]&amp;nbsp; = { &amp;#39;1&amp;#39; };&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>