<?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>SPI communication problems</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71964/spi-communication-problems</link><description>Why does my serial port open affect SPI communication</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Mar 2021 10:28:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71964/spi-communication-problems" /><item><title>RE: SPI communication problems</title><link>https://devzone.nordicsemi.com/thread/297733?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 10:28:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf1fc2be-e4ae-4fdc-bdea-d72f7feb1e13</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Your uart communication is sending one byte at the time. this means a lot of cpu processing at priority APP_IRQ_PRIORITY_LOWEST. What priority are you using for SPI? I am guessing it has the same priority so it is first come, first serve. You could try to increase the priority of spi, but that means UART throughput might be affected.&lt;/p&gt;
&lt;p&gt;Maybe a better way is to use bigger buffers in both cases, so you have less cpu interaction all over. Maybe consider using libuarte instead of app_uart.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problems</title><link>https://devzone.nordicsemi.com/thread/297437?ContentTypeID=1</link><pubDate>Wed, 03 Mar 2021 10:09:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fcd4ebe-42f3-41f8-8694-0b904aade9b6</guid><dc:creator>shy13728</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void UART_Init(void)
{

uint32_t err_code;

	   
    const app_uart_comm_params_t comm_params =
      {
          RX_PIN_NUMBER,
          TX_PIN_NUMBER,
          RTS_PIN_NUMBER,
          CTS_PIN_NUMBER,
          UART_HWFC,
          false,
#if defined (UART_PRESENT)
          NRF_UART_BAUDRATE_115200
#else
          NRF_UARTE_BAUDRATE_115200
#endif
      };
     
    APP_UART_FIFO_INIT(&amp;amp;comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_error_handle, 
                         APP_IRQ_PRIORITY_LOWEST,
                         err_code);

    APP_ERROR_CHECK(err_code);
}
void UART_WriteData(uint8_t *pData, uint8_t dataLen)
{
	uint8_t i;
	for(i = 0; i &amp;lt; dataLen; i++)
	{
		app_uart_put(pData[i]);
	}
}
 &lt;/pre&gt;This is my serial initialization function, as well as the serial send function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problems</title><link>https://devzone.nordicsemi.com/thread/297430?ContentTypeID=1</link><pubDate>Wed, 03 Mar 2021 09:58:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f80e87f-e607-4d14-b53f-77755a63f4b2</guid><dc:creator>shy13728</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void hal_spi_init(void)//This is my SPI initialization code
{
 
    nrf_gpio_cfg_output(AEF_START);
    nrf_gpio_pin_set(AEF_START);
    nrf_gpio_cfg_output(AEF_RESET);
    nrf_gpio_pin_set(AEF_RESET);

    nrf_gpio_cfg_input(AEF_RDRDY,  NRF_GPIO_PIN_PULLDOWN);

    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
//     spi_config.ss_pin   = BOARD_SPI0_CSN_IO;
    spi_config.miso_pin = BOARD_SPI0_MISO_IO;
    spi_config.mosi_pin = BOARD_SPI0_MOSI_IO;
    spi_config.sck_pin  = BOARD_SPI0_CLK_IO;
    APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, spi_event_handler, NULL));
	
    nrf_gpio_cfg_output(BOARD_SPI0_CSN_IO);
    nrf_gpio_pin_set(BOARD_SPI0_CSN_IO);
}



uint8_t SpiFlash_ReadOneByte(void)
{
   
    spi_xfer_done = false;

    nrf_drv_spi_transfer(&amp;amp;spi, 0x00, 1, spi_rx_buf, 1);

    while(!spi_xfer_done)
        ;
	 
    return (spi_rx_buf[0]);
}
 
void SpiFlash_WriteOneByte(uint8_t Dat)
{
    

    spi_tx_buf[0] = Dat;
    spi_xfer_done = false;
    nrf_drv_spi_transfer(&amp;amp;spi,spi_tx_buf, 1, spi_tx_buf, 1 );
    while(!spi_xfer_done)
        ;
}&lt;/pre&gt;This is my SPI initialization code and SPI write read function, which is done according to the example of sdk15.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problems</title><link>https://devzone.nordicsemi.com/thread/297426?ContentTypeID=1</link><pubDate>Wed, 03 Mar 2021 09:47:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df3a4618-6679-4995-897d-1f116af2507c</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;Could you post your code so it&amp;#39;s possible to see what it is you are doing?&lt;/p&gt;
&lt;p&gt;Please note that we have example code for SPI in our SDK that you can use as reference:&lt;br /&gt;&lt;span&gt;&lt;a title="SPI Master Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/spi_master_example.html?cp=7_1_4_6_37"&gt;SPI Master Example&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a title="nrfx SPI Master Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/nrfx_spim_example.html?cp=7_1_4_6_38"&gt;nrfx SPI Master Example&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problems</title><link>https://devzone.nordicsemi.com/thread/296129?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 00:56:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e332b13-63cb-4b7b-ac5f-a3eaed3bac49</guid><dc:creator>shy13728</dc:creator><description>&lt;div class="trans-left"&gt;
&lt;div class="trans-input-wrap"&gt;
&lt;div class="input-wrap" dir="ltr"&gt;
&lt;div class="textarea-wrap without-textarea-bg"&gt;&lt;/div&gt;
&lt;div class="input-operate"&gt;&lt;a class="operate-btn op-sound data-hover-tip" href="https://fanyi.baidu.com/?aldtype=16047###"&gt;&lt;span class="icon-sound"&gt;&lt;/span&gt;&lt;/a&gt;
&lt;div class="op-favor-container"&gt;&lt;span class="icon-favo"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="trans-right"&gt;
&lt;div class="output-wrap small-font"&gt;
&lt;div class="output-mod ordinary-wrap"&gt;
&lt;div class="output-bd" dir="ltr"&gt;
&lt;p class="ordinary-output target-output clearfix"&gt;&lt;span&gt;Hello!&lt;/span&gt;&lt;span class=""&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Now I mainly do the drive control of SPI to ADC chip, but when I open the serial port to see the data, SPI communication has a problem, there is no write value&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problems</title><link>https://devzone.nordicsemi.com/thread/296026?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 13:08:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84cfbb14-4fb1-46ed-8c23-1a68668935e8</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you elaborate a little on what it is you are doing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>