<?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>nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116418/nrf52833-saadc-issue</link><description>I have a photodiode, and under indoor lighting conditions, the reading on the oscilloscope is about 150mV. When I connect it to an Arduino Uno or Adafruit nRF52840 Sense, I can get a reading close to 150mV. 
 However, when I connect it to the nRF52840</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Nov 2024 08:34:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116418/nrf52833-saadc-issue" /><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510843?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2024 08:34:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4277cd7-004c-40fb-84fa-4371b9c47d39</guid><dc:creator>Ziyao Zhou</dc:creator><description>&lt;p&gt;Thank you Einar, I think I found the issue. Only when I connect to AIN 2 and AIN3 there is some issue. And I realized that&amp;#39;s because UART!&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/pastedimage1731918809594v1.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/pastedimage1731918859207v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Thank you again for your support&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510834?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2024 07:56:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ed750ae-43a7-4489-b31e-31f62636bb75</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am not sure what is causing this, so we need to look a bit futher:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Can you try to print the raw int value you get and not only the number after you convert to float and do multiplication and division?&lt;/li&gt;
&lt;li&gt;Can you show how you ahve connected it to the SoC in hardware (a simple schematic or similar)?&lt;/li&gt;
&lt;li&gt;Can you double check and let me know which pin it is connected to? (Could it be that it is not connected to the right pin so that you are measuring a floating input)?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510790?ContentTypeID=1</link><pubDate>Sat, 16 Nov 2024 08:20:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1836b73b-8600-4430-8f88-8cdcb6ca0f8b</guid><dc:creator>Ziyao Zhou</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I have tried the calibration code but still got the same result. Some interesting observation is that when I connected GND to the AIN pin, the readout will still be negative number and being unstable. Could you please give me some advice?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510749?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2024 15:09:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4082e37e-68b7-418f-bbad-8f56297521ae</guid><dc:creator>Ziyao Zhou</dc:creator><description>&lt;p&gt;thank you so much for your information! I will try it as soon as possible: )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510747?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2024 15:06:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfc81388-bd48-466c-8abe-ca59208c13b8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see. In that case, which voltage to you read with the ADC? I see you are not performing offset calibration, which could be relevatn (though 150 mV is a lot in this regard). But I suggest you implement that first, using &lt;code&gt;nrf_drv_saadc_calibrate_offset()&lt;/code&gt;. You can see an example of that &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/39454/calibrating-saadc-on-nrf52832/152901"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510742?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2024 14:57:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c13437a-4d9f-4bb8-bea0-388ca0912291</guid><dc:creator>Ziyao Zhou</dc:creator><description>&lt;p&gt;Yes, exactly! The ADC works correctly in a high-light environment and can return the correct voltage value to me (consistent with the voltage read by the oscilloscope). However, in a dim environment, the oscilloscope reads 150mv and the ADC reads a negative number.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510727?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2024 14:19:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c76651b-f1ee-4aaa-9fc2-727ce72c68d5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you. How have you connected the 150 mV signal to the nRF? Which pin is it connected to? I see you have configured AIN3 in the code, which on the nRF52833 is the same pin as&amp;nbsp;P0.05. Is that the pin you are using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510717?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2024 14:07:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7bc6040-268f-4e69-b455-2c793a43e58c</guid><dc:creator>Ziyao Zhou</dc:creator><description>&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;Thanks for your prompt reply! Below is my ADC code:&amp;nbsp;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;#define SAMPLES_IN_BUFFER 1&lt;br /&gt;volatile uint8_t state = 1;&lt;/p&gt;
&lt;p&gt;static const nrf_drv_timer_t m_timer = NRF_DRV_TIMER_INSTANCE(4);&lt;br /&gt;static nrf_saadc_value_t m_buffer_pool[2][SAMPLES_IN_BUFFER];&lt;br /&gt;static nrf_ppi_channel_t m_ppi_channel;&lt;br /&gt;static uint32_t m_adc_evt_counter;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;void timer_handler(nrf_timer_event_t event_type, void * p_context)&lt;br /&gt;{&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;void saadc_sampling_event_init(void)&lt;br /&gt;{&lt;br /&gt; ret_code_t err_code;&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_ppi_init();&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;&lt;br /&gt; timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;&lt;br /&gt; err_code = nrf_drv_timer_init(&amp;amp;m_timer, &amp;amp;timer_cfg, timer_handler);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;/* setup m_timer for compare event every 400ms */&lt;br /&gt; uint32_t ticks = nrf_drv_timer_ms_to_ticks(&amp;amp;m_timer, 1);&lt;br /&gt; nrf_drv_timer_extended_compare(&amp;amp;m_timer,&lt;br /&gt; NRF_TIMER_CC_CHANNEL0,&lt;br /&gt; ticks,&lt;br /&gt; NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,&lt;br /&gt; false);&lt;br /&gt; nrf_drv_timer_enable(&amp;amp;m_timer);&lt;/p&gt;
&lt;p&gt;uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&amp;amp;m_timer,&lt;br /&gt; NRF_TIMER_CC_CHANNEL0);&lt;br /&gt; uint32_t saadc_sample_task_addr = nrf_drv_saadc_sample_task_get();&lt;/p&gt;
&lt;p&gt;/* setup ppi channel so that timer compare event is triggering sample task in SAADC */&lt;br /&gt; err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_ppi_channel_assign(m_ppi_channel,&lt;br /&gt; timer_compare_event_addr,&lt;br /&gt; saadc_sample_task_addr);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;void saadc_sampling_event_enable(void)&lt;br /&gt;{&lt;br /&gt; ret_code_t err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);&lt;/p&gt;
&lt;p&gt;APP_ERROR_CHECK(err_code);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;void saadc_callback(nrf_drv_saadc_evt_t const * p_event)&lt;br /&gt;{&lt;br /&gt; if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)&lt;br /&gt; {&lt;br /&gt; ret_code_t err_code;&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, SAMPLES_IN_BUFFER);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;int i;&lt;br /&gt; //NRF_LOG_INFO(&amp;quot;ADC event number: %d&amp;quot;, (int)m_adc_evt_counter);&lt;/p&gt;
&lt;p&gt;for (i = 0; i &amp;lt; SAMPLES_IN_BUFFER; i++)&lt;br /&gt; {&lt;br /&gt;&lt;br /&gt; NRF_LOG_INFO(&amp;quot;RADIATION Voltage: &amp;quot; NRF_LOG_FLOAT_MARKER &amp;quot; mV&amp;quot;, NRF_LOG_FLOAT((p_event-&amp;gt;data.done.p_buffer[i] * 3.6f * 1000) / 16384));&lt;/p&gt;
&lt;p&gt;}&lt;br /&gt; //m_adc_evt_counter++;&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;void saadc_init(void)&lt;br /&gt;{&lt;br /&gt; ret_code_t err_code;&lt;br /&gt; nrf_saadc_channel_config_t channel_config =&lt;br /&gt; NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN3);&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_saadc_init(NULL, saadc_callback);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_saadc_channel_init(0, &amp;amp;channel_config);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0], SAMPLES_IN_BUFFER);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1], SAMPLES_IN_BUFFER);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;I am using saadc sample code to get the ADC readout and print it out. All the set up is as follows:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#define NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P) \&lt;br /&gt;{ \&lt;br /&gt; .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \&lt;br /&gt; .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \&lt;br /&gt; .gain = NRF_SAADC_GAIN1_6, \&lt;br /&gt; .reference = NRF_SAADC_REFERENCE_INTERNAL, \&lt;br /&gt; .acq_time = NRF_SAADC_ACQTIME_3US, \&lt;br /&gt; .mode = NRF_SAADC_MODE_SINGLE_ENDED, \&lt;br /&gt; .burst = NRF_SAADC_BURST_DISABLED, \&lt;br /&gt; .pin_p = (nrf_saadc_input_t)(PIN_P), \&lt;br /&gt; .pin_n = NRF_SAADC_INPUT_DISABLED \&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;#define NRFX_SAADC_DEFAULT_CONFIG \&lt;br /&gt;{ \&lt;br /&gt; .resolution = &amp;nbsp;14 bit&amp;nbsp;\&lt;br /&gt; .oversample = disable&lt;br /&gt; .interrupt_priority =&amp;nbsp;6&lt;br /&gt; .low_power_mode =0&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;I am very confused that when I connect a phtodiode with 150mv to the ADC, the readout will be negative number. When I give a strong light on the diode it will go up to 300mv, and then I can get the correct data from ADC with 300mv.&amp;nbsp;It seems that the ADC has a threshold above which it will start &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52833 SAADC issue</title><link>https://devzone.nordicsemi.com/thread/510683?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2024 12:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70091991-4fef-4af6-a24b-691a6a8a80b9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In order to provide advice I need to know more about how you are measuring. Can you share the ADV related code so that I see what you are doing? Also, what is the hardware setup, and what is the actual voltage you are measuring (is it 150 mV or something else)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>