<?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>How the ASYNC read API work in ADC with sample code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83913/how-the-async-read-api-work-in-adc-with-sample-code</link><description>What is the difference between the Async Read ApI and the Normal Read API of the ADC ?How the ASYNC read API work ,can anybody explain with sample code. Specially thirds argument of API 
 
 struct k_poll_signal * async ) what exactly we need to set in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Jan 2022 15:10:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83913/how-the-async-read-api-work-in-adc-with-sample-code" /><item><title>RE: How the ASYNC read API work in ADC with sample code</title><link>https://devzone.nordicsemi.com/thread/349599?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 15:10:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e03764d0-c379-4683-b175-19731b6426d3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&lt;/p&gt;
[quote user=""]What is the difference between the Async Read ApI and the Normal Read API of the ADC ?[/quote]
&lt;p&gt;The difference between the two is whether or not the sampling will happen asynchronously or not.&lt;br /&gt;In essence, this means that completion of the sampling will be signaled with a polling event, you can read more about this in&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/other/polling.html"&gt;the polling API&lt;/a&gt;&amp;nbsp;documentation.&lt;br /&gt;If you look into the adc_nrfx_saadc.c driver, you could see how&amp;nbsp;the CONFIG_ADC_ASYNC kconfig option changes the sampling procedure.&lt;/p&gt;
[quote user=""]&lt;p&gt;Specially thirds argument of API&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;k_poll_signal&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;async&lt;/span&gt;&lt;span&gt;) what exactly we need to set in this?&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;[/quote]
&lt;p&gt;You will need to provide a&amp;nbsp;&lt;span&gt;k_poll_signal which is &lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/other/polling.html#c.K_POLL_EVENT_INITIALIZER"&gt;tied to a poll event&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;You could see how this could be done in &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.0-ncs1/tests/drivers/adc/adc_api/src/test_adc.c#L494"&gt;the test_task_asynchronous_call&lt;/a&gt;&amp;nbsp;function of the zephyr driver test.&lt;/p&gt;
[quote user=""]Can we configure the multiple channel for the ADC Async read&amp;nbsp;[/quote]
&lt;p&gt;Yes, if multiple channels are enabled then the SAADC will enter scan mode and sample each enabled channel sequentially when a sampling is triggered.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>