<?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>Serial display of data using TWI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61529/serial-display-of-data-using-twi</link><description>Hi all, 
 
 i am using twi_scanner and twi_sensor as templates to get data from CCS811 Air Quality sensor with PCA10040 and SDK 15.3. But i cannot get the data printed in putty for example. 
 I believe the issue could be on my set_mode() function, in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 May 2020 07:58:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61529/serial-display-of-data-using-twi" /><item><title>RE: Serial display of data using TWI</title><link>https://devzone.nordicsemi.com/thread/251394?ContentTypeID=1</link><pubDate>Mon, 25 May 2020 07:58:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab1f79a4-22b4-429b-a44d-e3f936c5e991</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Where do you print &amp;quot;sample_data&amp;quot;, and when is read_data_sensor() called? Have you checked that the&amp;nbsp;NRF_DRV_TWI_EVT_DONE event has been generated before you read? If yes, then I suggest using the debugger to check what is stored in sample_data after a rx operation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial display of data using TWI</title><link>https://devzone.nordicsemi.com/thread/250909?ContentTypeID=1</link><pubDate>Wed, 20 May 2020 10:30:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a574d88-1ee7-4fc8-bf62-6ef5e50a0343</guid><dc:creator>Alanarf</dc:creator><description>&lt;p&gt;Hi Jared, thanks for reply.&lt;br /&gt;&lt;br /&gt;Yes, I am using the recommended settings.&lt;br /&gt;&lt;span&gt;NRF LOG outputs&amp;nbsp;are visible on putty, but not the data.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;TWI handle is called, but then nothing is shown on putty.&lt;/p&gt;
&lt;p&gt;&amp;lt;Note about the sensor&amp;gt;&lt;br /&gt;I need to set measurement mode on the chip, which i do in the set_mode() function by setting CCS811_REG_MEAS_MODE register to 1, this will set the sensor to measure values every second.&amp;nbsp;&lt;br /&gt;&amp;lt;...&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Anyway, I removed the lines 17 to 25 from the function set_mode(), and created a new function called read_data_sensor(), which prints the strange value of 253 on putty.&amp;nbsp; You can see the&amp;nbsp; code for&amp;nbsp;&lt;span&gt;read_data_sensor()&amp;nbsp; bellow&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void read_sensor_data()
{
    ret_code_t err_code;
	m_xfer_done = false;
	
	//Setting sensor reading register 
    uint8_t reg = CCS811_REG_RAW_DATA;
	
    err_code = nrf_drv_twi_tx(&amp;amp;m_twi, DEVICE_ID, &amp;amp;reg, sizeof(reg), false);
    APP_ERROR_CHECK(err_code);
	if (err_code == NRF_SUCCESS){ //	If the procedure was successful.
			NRF_LOG_INFO(&amp;quot;TX OK&amp;quot;);
		} 

 
    err_code = nrf_drv_twi_rx(&amp;amp;m_twi, DEVICE_ID, &amp;amp;sample_data, sizeof(sample_data));
	APP_ERROR_CHECK(err_code);
	nrf_delay_ms(200);
	
			
        if (err_code == NRF_SUCCESS){ //	If the procedure was successful.
			NRF_LOG_INFO(&amp;quot;Data received - reading data()&amp;quot;);
	        
	    } 
		
}
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;And well i am stuck here, just getting 253 on putty, as if the register is ignored somehow =\&lt;br /&gt;&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: Serial display of data using TWI</title><link>https://devzone.nordicsemi.com/thread/250894?ContentTypeID=1</link><pubDate>Wed, 20 May 2020 09:56:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7926fb6-0a73-4f3e-aaff-e5e5e9d1bb94</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Have you made sure that you&amp;#39;re using the recommended Putty settings as &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/twi_sensor_example.html?cp=7_1_4_6_45_0#twi_sensor_example_testing"&gt;described in the TWI examples&lt;/a&gt;? Is the NRF LOG output displayed? Have you made sure that the application haven&amp;#39;t asserted?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>