<?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 INIT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51103/spi-init</link><description>HI, 
 i have initialised spi, getting errors. 
 
 
 regards, 
 jagadeesh</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Oct 2019 10:18:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51103/spi-init" /><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/213161?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2019 10:18:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5db99d24-c3cc-4550-a29a-f06118a66c3e</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ah, I see. Originally you said that this didn&amp;#39;t help.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I assume there was some other connectivity issue that made it look like commenting out the nrf_gpio_ call didn&amp;#39;t work?&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t really matter if it works, I am just curious ;)&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/213087?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2019 05:13:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54eafc88-7bb1-41fa-b48b-461cb0e9ab3d</guid><dc:creator>jagadeesh surneni</dc:creator><description>&lt;p&gt;hi ,&lt;/p&gt;
&lt;p&gt;thank you so much for your help.&lt;/p&gt;
&lt;p&gt;my problem is solved after commenting the nrf_gpio......now its working fine.&lt;/p&gt;
&lt;p&gt;best regards,&lt;/p&gt;
&lt;p&gt;jagadeesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/212835?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2019 13:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b0d8477-5766-422c-a7d9-f937c333f537</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Jagadeesh&lt;/p&gt;
&lt;p&gt;Sorry for not getting back to you sooner, I have been out on travel for a while.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you still having issues with this?&lt;/p&gt;
&lt;p&gt;If you had some progress since last we spoke maybe you can give me an update on where you currently stand?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/209383?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2019 10:45:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92125744-a37e-4198-ae41-f40a38c973f8</guid><dc:creator>jagadeesh surneni</dc:creator><description>&lt;p&gt;after commenting nrf_gpio.....before initializing spi, still not getting clock. miso line is always low.i think no need to configure from the MCU.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.mouser.com/ds/2/268/21950D-51463.pdf"&gt;https://www.mouser.com/ds/2/268/21950D-51463.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;jagadeesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/205441?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2019 06:46:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad6f56e4-7a93-4cef-8c4f-3a2727b24fdc</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;What happens if you comment out the calls to nrf_gpio_xxx before you initialize the SPI?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you still not get any clock on the SCK line?&lt;/p&gt;
&lt;p&gt;If the MISO line never goes low, doesn&amp;#39;t that mean that the sensor is not responding?&lt;/p&gt;
&lt;p&gt;Is the sensor supposed to start running automatically, or does it have to be configured from the MCU?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/205167?ContentTypeID=1</link><pubDate>Wed, 21 Aug 2019 05:30:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45395679-94f4-4224-90ea-b19225dce143</guid><dc:creator>jagadeesh surneni</dc:creator><description>&lt;p&gt;hi,&lt;/p&gt;
&lt;p&gt;miso line is always high.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_sense_input(MISO,NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);&lt;br /&gt; nrf_gpio_cfg(SPI_SCK_PIN,NRF_GPIO_PIN_DIR_OUTPUT,NRF_GPIO_PIN_INPUT_CONNECT ,NRF_GPIO_PIN_NOPULL , &lt;br /&gt; NRF_GPIO_PIN_H0H1, NRF_GPIO_PIN_SENSE_HIGH );&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg(SPI_MISO_PIN,NRF_GPIO_PIN_DIR_INPUT,NRF_GPIO_PIN_INPUT_CONNECT ,NRF_GPIO_PIN_NOPULL , &lt;br /&gt; NRF_GPIO_PIN_H0H1, NRF_GPIO_PIN_SENSE_HIGH );&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg(SPI_SS_PIN,NRF_GPIO_PIN_DIR_OUTPUT,NRF_GPIO_PIN_INPUT_CONNECT ,NRF_GPIO_PIN_NOPULL , &lt;br /&gt; NRF_GPIO_PIN_H0H1, NRF_GPIO_PIN_SENSE_HIGH );&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;void spi_init(void)&lt;br /&gt;{&lt;/p&gt;
&lt;p&gt;nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;&lt;br /&gt; spi_config.ss_pin = SPI_SS_PIN;&lt;br /&gt; spi_config.miso_pin = SPI_MISO_PIN;&lt;br /&gt; spi_config.sck_pin = SPI_SCK_PIN;&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config,NULL, NULL));&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#define NRF_DRV_SPI_DEFAULT_CONFIG \&lt;br /&gt;{ \&lt;br /&gt; .sck_pin = NRF_DRV_SPI_PIN_NOT_USED, \&lt;br /&gt; .mosi_pin = NRF_DRV_SPI_PIN_NOT_USED, \&lt;br /&gt; .miso_pin = NRF_DRV_SPI_PIN_NOT_USED, \&lt;br /&gt; .ss_pin = NRF_DRV_SPI_PIN_NOT_USED, \&lt;br /&gt; .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY, \&lt;br /&gt; .orc = 0xFF, \&lt;br /&gt; .frequency = SPI_FREQUENCY_FREQUENCY_K250, \&lt;br /&gt; .mode = NRF_DRV_SPI_MODE_3, \&lt;br /&gt; .bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST, \&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;// &amp;lt;o&amp;gt; SPI_SCK_PIN - Pin number&lt;br /&gt; &lt;br /&gt;#ifndef SPI_SCK_PIN&lt;br /&gt;#define SPI_SCK_PIN 26&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;// &amp;lt;o&amp;gt; SPI_MISO_PIN - Pin number&lt;br /&gt; &lt;br /&gt;#ifndef SPI_MISO_PIN&lt;br /&gt;#define SPI_MISO_PIN 30&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;// &amp;lt;o&amp;gt; SPI_SS_PIN - Pin number&lt;br /&gt; &lt;br /&gt;#ifndef SPI_SS_PIN&lt;br /&gt;#define SPI_SS_PIN 31&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;this is my spi initialization. i am not getting clock.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;jagadeesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/205163?ContentTypeID=1</link><pubDate>Wed, 21 Aug 2019 05:12:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43199c9b-20c6-4f0c-9be9-9005f3480c86</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you confirmed with the scope that the MISO line is set low by the sensor?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/204986?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2019 10:31:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cba8374c-ec21-4f4b-bee1-006f502dc2a3</guid><dc:creator>jagadeesh surneni</dc:creator><description>&lt;p&gt;hi ovrebeek,&lt;/p&gt;
&lt;p&gt;yes i probed the lines with scope. i wrote a switch case in the below function where in first case chip select will be cleared and jumps to case 2 ,in case miso pin is sensed ,if miso pin is high it jumps to case3 ,in case3 miso pin is sensed if it is low , the 0x00 will be transferred and four bytes of data will be received.&lt;/p&gt;
&lt;p&gt;i have debugged the it is not jumping to the case2 .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;void temp_spi(void)&lt;br /&gt;{&lt;br /&gt;float adcv_volt_f;&lt;br /&gt;long temp = 0;&lt;br /&gt;uint8_t ti;&lt;br /&gt;uint8_t Tdata[4];&lt;br /&gt;uint32_t num;&lt;/p&gt;
&lt;p&gt;uint8_t m_tx_rx_buf1[] = {((uint8_t)0x00)};&lt;br /&gt;uint8_t m_tx_rx_buf2[] = {((uint8_t)0x00)};&lt;br /&gt;uint8_t m_tx_rx_buf3[] = {((uint8_t)0x00)};&lt;/p&gt;
&lt;p&gt;uint8_t m_rx_buf1[1]; &lt;br /&gt;uint8_t m_rx_buf2[1];&lt;br /&gt;uint8_t m_rx_buf3[1];&lt;br /&gt;uint16_t m_length_rx = 1;&lt;/p&gt;
&lt;p&gt;uint8_t PIN_SENSE1[1],PIN_SENSE2[1]; &lt;br /&gt; &lt;br /&gt;adc_sts_flag=1;&lt;br /&gt; switch(adc_sts_flag)&lt;br /&gt; {&lt;br /&gt; case 1: &lt;br /&gt; nrf_gpio_pin_clear(cs_low);&lt;br /&gt; adc_sts_flag = 2;&lt;br /&gt; ble_nus_data_send(&amp;amp;m_nus, &amp;amp;CASE1[0], &amp;amp;CL, m_conn_handle);&lt;/p&gt;
&lt;p&gt;break;&lt;/p&gt;
&lt;p&gt;case 2: &lt;br /&gt; nrf_gpio_cfg_sense_input(MISO,NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH); &lt;br /&gt; if(nrf_gpio_pin_read(MISO) == 1)&lt;br /&gt; {PIN_SENSE1[0]=&amp;#39;1&amp;#39;;}&lt;br /&gt; else&lt;br /&gt; {PIN_SENSE1[0]=&amp;#39;0&amp;#39;;}&lt;br /&gt; ble_nus_data_send(&amp;amp;m_nus, &amp;amp;PIN_SENSE1[0],&amp;amp;m_length_rx, m_conn_handle);&lt;br /&gt; if(nrf_gpio_pin_read(MISO) == 1)&lt;br /&gt; {&lt;br /&gt; adc_sts_flag = 3;&lt;br /&gt; ble_nus_data_send(&amp;amp;m_nus, &amp;amp;CASE2[0], &amp;amp;CL, m_conn_handle);&lt;br /&gt; }&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case 3: &lt;br /&gt; nrf_gpio_cfg_sense_input(MISO,NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH); &lt;br /&gt; if(nrf_gpio_pin_read(MISO) == 0)&lt;br /&gt; {&lt;br /&gt; ble_nus_data_send(&amp;amp;m_nus, &amp;amp;CASE3[0], &amp;amp;CL, m_conn_handle);&lt;/p&gt;
&lt;p&gt;Tdata[3]=0;&lt;br /&gt; nrf_drv_spi_transfer(&amp;amp;spi, m_tx_rx_buf1, m_length_rx, &amp;amp;Tdata[2] , m_length_rx);&lt;br /&gt; nrf_drv_spi_transfer(&amp;amp;spi, m_tx_rx_buf1, m_length_rx, &amp;amp;Tdata[1] , m_length_rx);&lt;br /&gt; nrf_drv_spi_transfer(&amp;amp;spi, m_tx_rx_buf1, m_length_rx, &amp;amp;Tdata[0] , m_length_rx);&lt;br /&gt; num = ((Tdata[0] &amp;lt;&amp;lt; 24)|(Tdata[1] &amp;lt;&amp;lt; 16)|(Tdata[2] &amp;lt;&amp;lt; 8)|(Tdata[3]));&lt;br /&gt; /*adc.byte_cnt[3] = 0;&lt;br /&gt; adc.byte_cnt[2] = m_rx_buf1;&lt;br /&gt; adc.byte_cnt[1] = m_rx_buf2;&lt;br /&gt; adc.byte_cnt[0] = m_rx_buf3;*/&lt;br /&gt; adc_sts_flag = 4;&lt;br /&gt; nrf_gpio_pin_set(cs_low); &lt;br /&gt; }&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case 4:&lt;/p&gt;
&lt;p&gt;ble_nus_data_send(&amp;amp;m_nus, &amp;amp;CASE4[0], &amp;amp;CL, m_conn_handle);&lt;br /&gt; ti = (mav_sample_indx-1)&amp;amp;(MAV_SAMPLE_WINDOW_MASK);&lt;br /&gt; //temp = mav_samples[ti]-adc.full_cnt;&lt;br /&gt; temp = mav_samples[ti] - num;&lt;/p&gt;
&lt;p&gt;//mav_samples[mav_sample_indx] = adc.full_cnt;&lt;br /&gt; mav_samples[mav_sample_indx] = num;&lt;br /&gt; if(mav_sample_indx&amp;gt;=MAV_SAMPLE_WINDOW_MASK)mav_sample_ready = true;&lt;br /&gt; mav_sample_indx = (mav_sample_indx+1)&amp;amp;(MAV_SAMPLE_WINDOW_MASK);&lt;br /&gt; if(mav_sample_ready==false)break;&lt;/p&gt;
&lt;p&gt;//avg samples &lt;br /&gt; temp = 0;&lt;br /&gt; for(uint8_t i=0;i&amp;lt;MAV_SAMPLE_WINDOW_SIZE;i++)&lt;br /&gt; {&lt;br /&gt; temp = (unsigned long)(temp + mav_samples[i]);&lt;br /&gt; }&lt;br /&gt; temp/= MAV_SAMPLE_WINDOW_SIZE;&lt;/p&gt;
&lt;p&gt;adcv_volt_f = ((6800*(float)temp/(2097152-temp))-100)/0.385;//calculate&lt;/p&gt;
&lt;p&gt;/*//unit conversion&lt;br /&gt; eMBRegHoldingCB(&amp;amp;temp_buf[0], UNIT_ADD, 1, MB_REG_READ);&lt;br /&gt; switch(temp_buf[1])&lt;br /&gt; {&lt;br /&gt; case &amp;#39;F&amp;#39;:&lt;br /&gt; adcv_volt_f = (adcv_volt_f * 1.8) + 32;&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case &amp;#39;K&amp;#39;:&lt;br /&gt; adcv_volt_f = adcv_volt_f + 273;&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case &amp;#39;C&amp;#39;:&lt;br /&gt; default:&lt;br /&gt; break;&lt;br /&gt; }*/&lt;/p&gt;
&lt;p&gt;//avg&lt;br /&gt; mav_temperature[mav_temperature_indx] = adcv_volt_f;&lt;br /&gt; if(mav_temperature_indx&amp;gt;=MAV_TEMPER_WINDOW_MASK)mav_temperature_ready = true;&lt;br /&gt; mav_temperature_indx = (mav_temperature_indx+1)&amp;amp;(MAV_TEMPER_WINDOW_MASK);&lt;br /&gt; if(mav_temperature_ready==false)break;&lt;/p&gt;
&lt;p&gt;//avg temperature &lt;br /&gt; adcv_volt_f = 0;&lt;br /&gt; for(uint8_t i=0;i&amp;lt;MAV_TEMPER_WINDOW_SIZE;i++)&lt;br /&gt; {&lt;br /&gt; adcv_volt_f += mav_temperature[i]; &lt;br /&gt; }&lt;br /&gt; adcv_volt_f = adcv_volt_f/MAV_TEMPER_WINDOW_SIZE;&lt;br /&gt; RTD_TEMPERATURE = adcv_volt_f;&lt;br /&gt; //process_resolution(adcv_volt_f);&lt;/p&gt;
&lt;p&gt;adc_sts_flag = 0xFF;&lt;br /&gt; adc_read_tim_out_cnt = 0;&lt;/p&gt;
&lt;p&gt;break;&lt;/p&gt;
&lt;p&gt;default:&lt;br /&gt; adc_sts_flag = 1;&lt;br /&gt; break; &lt;br /&gt;} &lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;jagadeesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/204795?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2019 13:34:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43276f56-2752-4c74-a2ba-273745eb267f</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Have you checked with the debugger if the&amp;nbsp;nrf_drv_spi_transfer(..) call is ever reached in the code?&lt;/p&gt;
&lt;p&gt;How did you notice that the clock is not generating? Are you probing the lines with a scope?&lt;/p&gt;
&lt;p&gt;I would recommend trying to get the temperature sensor working in a more simple example. Once you have this example working and the sensor is responding properly you can put the sensor code into a small library that you can then include in the BLE example.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI INIT</title><link>https://devzone.nordicsemi.com/thread/204695?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2019 10:08:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ec98715-45d0-4581-ad8a-5bfe1f8569f9</guid><dc:creator>jagadeesh surneni</dc:creator><description>&lt;p&gt;hi,&lt;/p&gt;
&lt;p&gt;The above error is sloved. a spi based temperature sensor is connected to ble. for this sensor we have only miso pin here for sensor.&amp;nbsp; if miso pin is low then we can read the data from sensor. i am not able to read the data from the sensor. please check my code if there is any wrong initialization. i am using ble peripheral code.also found that clock is not generating.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;jagadeesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>