<?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>Dev Academy Lesson 6 Exercise 2 – nrfx ADC is non-blocking but does not wait for conversion to complete</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118949/dev-academy-lesson-6-exercise-2-nrfx-adc-is-non-blocking-but-does-not-wait-for-conversion-to-complete</link><description>Working through the dev academy exercise, it appears that the sample code does not wait for the conversion to complete before reading out the sample: 
 
 
 
 https://github.com/NordicDeveloperAcademy/ncs-inter/blob/main/v2.6.2-v2.5.2/l6/l6_e2_sol/src</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Feb 2025 13:30:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118949/dev-academy-lesson-6-exercise-2-nrfx-adc-is-non-blocking-but-does-not-wait-for-conversion-to-complete" /><item><title>RE: Dev Academy Lesson 6 Exercise 2 – nrfx ADC is non-blocking but does not wait for conversion to complete</title><link>https://devzone.nordicsemi.com/thread/523283?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 13:30:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:987b8479-1b9a-4546-8f98-a787c1a1f2f1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The team has added a note about SAADC calibration in the course now:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1739799032160v1.png" alt=" " /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks again for your feedback.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dev Academy Lesson 6 Exercise 2 – nrfx ADC is non-blocking but does not wait for conversion to complete</title><link>https://devzone.nordicsemi.com/thread/523089?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2025 15:13:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8445a49f-43ae-41f9-b135-6d9496fc9195</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for the feedback. I will relay this to the team responsible for this course. I also think it is worth mentioning about the calibration. The blocking part appears to be covered already in the updated course:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1739545942060v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1739545903189v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dev Academy Lesson 6 Exercise 2 – nrfx ADC is non-blocking but does not wait for conversion to complete</title><link>https://devzone.nordicsemi.com/thread/522947?ContentTypeID=1</link><pubDate>Thu, 13 Feb 2025 22:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0198d06a-a1ca-4ac8-b890-7577028e4b93</guid><dc:creator>chris22222</dc:creator><description>&lt;p&gt;I figured this out.&amp;nbsp; I found NULL was passed as the event handler to this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief Function for setting the SAADC driver in the simple mode.
 *
 * The simple mode allows obtaining a single sample from each requested channel.
 * The conversion can be done in a blocking or non-blocking manner.
 * Sampling is initiated by calling @ref nrfx_saadc_mode_trigger() once.
 *
 * @param[in] channel_mask  Bitmask of channels to be used in the simple mode.
 * @param[in] resolution    Resolution configuration.
 * @param[in] oversampling  Oversampling configuration.
 * @param[in] event_handler Event handler provided by the user. In case of providing NULL,
 *                          the conversion will be performed in the blocking manner.
 *
 * @retval NRFX_SUCCESS             Initialization was successful.
 * @retval NRFX_ERROR_BUSY          There is a conversion or calibration ongoing.
 * @retval NRFX_ERROR_INVALID_PARAM Attempt to activate channel that is not configured.
 */
nrfx_err_t nrfx_saadc_simple_mode_set(uint32_t                   channel_mask,
                                      nrf_saadc_resolution_t     resolution,
                                      nrf_saadc_oversample_t     oversampling,
                                      nrfx_saadc_event_handler_t event_handler);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I wish this was more clearly written out.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also the offset discrepancy was caused by not calling&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;nrfx_saadc_offset_calibrate() prior to starting the conversion in the sample.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>