<?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 with SPI data transfer with 2 channels (ADC peripheral)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47878/problem-with-spi-data-transfer-with-2-channels-adc-peripheral</link><description>Hi, 
 
 I was able to use SPI communication to read data from ADS1220 (one channel of a 3-channel ADC) and transmit it via NUS ble service to my NRF Toolbox app and RTT logger on my PC (each data transfer is 3 bytes). Currently this is using 1 input pin</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 May 2019 00:05:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47878/problem-with-spi-data-transfer-with-2-channels-adc-peripheral" /><item><title>RE: Problem with SPI data transfer with 2 channels (ADC peripheral)</title><link>https://devzone.nordicsemi.com/thread/189995?ContentTypeID=1</link><pubDate>Thu, 30 May 2019 00:05:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b2a27bc-939e-4210-8e9c-9060db2b89fe</guid><dc:creator>noob_with_ucontrollers</dc:creator><description>&lt;p&gt;So I put my ADC (ads1220 from TI) into Continuous Conversion Mode from single shot mode (I was using this mode before), and that enabled me to configure (write to ADC ) in real time.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;So yes, it&amp;#39;s a timing issue. Just in case anyone else ever needs it. Thank you everyone.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with SPI data transfer with 2 channels (ADC peripheral)</title><link>https://devzone.nordicsemi.com/thread/189992?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 22:53:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d8648d7-2dee-4674-ac2e-f7b44d012e45</guid><dc:creator>noob_with_ucontrollers</dc:creator><description>&lt;p&gt;I will look more into that. Thank you.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Has anyone ever tried initializing and using two SPI instances in one program to get data from two initialized SPIs in the same program? (both instances have separate spi_evt_handlers etc )&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with SPI data transfer with 2 channels (ADC peripheral)</title><link>https://devzone.nordicsemi.com/thread/189990?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 22:16:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a481509f-e76f-406f-8e4c-4a1ba4eaf65b</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Could it be a timing issue?&lt;/p&gt;
&lt;p&gt;Have you looked at the signals with a scope or analyser, and compared the &amp;quot;working&amp;quot; and &amp;quot;non-working&amp;quot; cases?&lt;/p&gt;
&lt;p&gt;And, as already suggested, have you checked with the manufacturer (TI?) whether this is the best way to be using their device? It sounds a little odd to be completely re-initialising just to use a different channel ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with SPI data transfer with 2 channels (ADC peripheral)</title><link>https://devzone.nordicsemi.com/thread/189987?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 22:04:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6fef1dd-da32-4642-9e84-3924196ca47b</guid><dc:creator>noob_with_ucontrollers</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;/a&gt;&amp;nbsp; Yes you are correct. I did fix this. Thank you for your response.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;However the problem does not seem to be with the way I am configuring/writing to ADC for initialization. When I configure ADC regs outside the main for () loop, the ADC data is fine and everything works great.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;When I paste the exact configuration/initializing code in the &lt;strong&gt;main for() loop&lt;/strong&gt; to re-config my ADC&lt;strong&gt; continuously&lt;/strong&gt; , that&amp;#39;s when I stop getting proper data from the ADC.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;What would you suggest I do in that case?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with SPI data transfer with 2 channels (ADC peripheral)</title><link>https://devzone.nordicsemi.com/thread/189955?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 15:14:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee337ee3-cda3-46a4-8850-50d80eefb443</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;I think the write command above is incorrect; the first byte requires write command 0x40 (as you have) but &lt;em&gt;also&lt;/em&gt; the starting register and number of registers-1. 0x40 only writes 1 register to starting register address 0.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;8.5.3.6 WREG (0100 rrnn)&lt;/em&gt;&lt;br /&gt;&lt;em&gt;The WREG command writes the number of bytes specified by nn (number of bytes to be written &amp;ndash; 1) to the&amp;nbsp;&lt;/em&gt;&lt;em&gt;device configuration register, starting at register address rr. The command is completed after nn + 1 bytes are&amp;nbsp;&lt;/em&gt;&lt;em&gt;clocked in after the WREG command byte. For example, the command to write two bytes (nn = 01) starting at&amp;nbsp;&lt;/em&gt;&lt;em&gt;configuration register 0 (rr = 00) is 0100 0001. The configuration registers are updated on the last SCLK falling&amp;nbsp;&lt;/em&gt;&lt;em&gt;edge.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t checked your intended register values, but to write to 4 registers from Register 0 change the first byte to 0x43:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    // Reg hex settings 
    m_tx_buf[0] = 0x40 | 0x00 | (4-1); // Write to register 0 for 4 registers
    m_tx_buf[1] = 0x82;
    m_tx_buf[2] = 0x10;
    m_tx_buf[3] = 0x06; 
    m_tx_buf[4] = 0x20; &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with SPI data transfer with 2 channels (ADC peripheral)</title><link>https://devzone.nordicsemi.com/thread/189914?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 13:57:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:863488cd-7298-4e25-9175-54f5d1b319d2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If the external ADC does not output correct data, you should check the timings in the datasheet or check with the manufacturer of the device how you should control it correctly. You have checked that the commands are output from the nRF?&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>