<?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>nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57793/nrf52832-saadc-issues-wrong-values</link><description>Hello, I&amp;#39;m developing SAADC on nRF52832. 
 While developing, I have problems now. 
 
 I applied sine wave on ADC input. 
 And the result is displayed on the figure that I attached. 
 It has kind of &amp;#39;spikes&amp;#39;. (I checked using oscilloscope and saw that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Mar 2020 07:14:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57793/nrf52832-saadc-issues-wrong-values" /><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/239441?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 07:14:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eaef0137-92f7-45dc-9b5f-d18f15d99a32</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Wow, I found answer...&lt;/p&gt;
&lt;p&gt;As you said, algorithm of central side had problem.&lt;/p&gt;
&lt;p&gt;Thank you for advice!!! Your advice helped me to find out the problem and solution&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/239193?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 16:27:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f5334d5-3900-4965-addf-b095b7c1ab02</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I think the problem here is on the central side. For instance it&amp;#39;s weird that the data is always peak up when curve is falling, and peak down when curve is rising. There is nothing in BLE transfer that can cause this. It&amp;#39;s some&amp;nbsp;computation and/or display&amp;nbsp;library that cause or display the data wrong I think. Maybe you can multiple all sample data on the central side with *0.5, and see how that affect the graph. Maybe you can also try to split the notifications into 3 packets and see how that affect the problem.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/239136?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 13:45:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f848d962-67ea-4344-9b17-a686c0c21af0</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define SAMPLES_IN_BUFFER 123
#define NO_OF_SAADC_BUFFER 2
static uint8_t adc_ble_notify_size = SAMPLES_IN_BUFFER * sizeof(uint16_t);

void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{
	if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
	{
		ret_code_t err_code;
		buffer_number ^= 0x02; //XOR
		saadc_event_callback = true;
		err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, SAMPLES_IN_BUFFER);
		APP_ERROR_CHECK(err_code);
		}
}

uint32_t ble_fs_send_adc_data(uint16_t conn_handle, ble_fs_t * p_fs, uint8_t *  p_data, uint16_t length)
{
    ble_gatts_hvx_params_t params;
    uint16_t len = length;
    //p_fs-&amp;gt;bytes_sent += len;
    memset(&amp;amp;params, 0, sizeof(params));
    params.type   = BLE_GATT_HVX_NOTIFICATION;
    params.handle = p_fs-&amp;gt;adc_char_handles.value_handle;
    params.p_data = p_data;
    params.p_len  = &amp;amp;len;
    return sd_ble_gatts_hvx(conn_handle, &amp;amp;params);
}

Below is part of main function.
for (;;)
	{
		if (saadc_event_callback) {
			ble_fs_send_adc_data(m_conn_handle, &amp;amp;m_ble_fs, &amp;amp;(adc_buffer.m_buffer_ble[buffer_number * adc_ble_notify_size]), adc_ble_notify_size);
			ble_fs_send_adc_data(m_conn_handle, &amp;amp;m_ble_fs, &amp;amp;(adc_buffer.m_buffer_ble[(buffer_number * adc_ble_notify_size) + (adc_ble_notify_size)]), adc_ble_notify_size);
			saadc_event_callback = false;
		}
		idle_state_handle();
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;These codes are part of my BLE.&lt;/p&gt;
&lt;p&gt;I put 10/12-bit values in 16bit arrays and send them.&lt;/p&gt;
&lt;p&gt;Thank you so much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/239073?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 11:12:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86d76849-151e-4782-a58a-869c94720dfb</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;So how are you transmitting those 10/12-bit values? E.g. are you bit shifting them to fit several sample values into an array, or do each 10/12-bit value use 16bit (2byte) on-air?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/238705?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 07:01:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c45cdb3-583e-4d9c-a1d9-446b0c8b1525</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Sorry for late reply.&lt;/p&gt;
&lt;p&gt;Yes, I checked ADC through UART, and they were perfect.&lt;/p&gt;
&lt;p&gt;So I guess BLE has a problem, but I don&amp;#39;t know why.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I found that it has error when ADC values are around multiple of 256.&lt;/p&gt;
&lt;p&gt;For example, 256, 512, 768...&lt;/p&gt;
&lt;p&gt;So while 10-bit resolution and 12-bit resolution have errors, 8-bit resolution is ok.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/235177?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2020 12:36:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97fd22ee-70a5-4dea-8c26-8ee47efbd54d</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Have you tried to output the data on UART? E.g. NRF_LOG_INFO(&amp;quot;%d&amp;quot;,measurement_value);&lt;/p&gt;
&lt;p&gt;This could help debug if the problem is the measurement or later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/235033?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2020 02:01:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48a04990-558d-47f2-a8d1-775e58278e29</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;I saw that at 8-bit resolution and 12-bit resolution, there were no spikes like this.&lt;/p&gt;
&lt;p&gt;Can anyone recommend where should I look at?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/235028?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2020 00:40:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bb16f1c-9ed5-4b32-bcdb-8328c5d8252b</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Thanks for suggestion. I&amp;#39;ll try that one.&lt;/p&gt;
&lt;div style="left:-10px;position:absolute;top:6px;" id="gtx-trans"&gt;
&lt;div class="gtx-trans-icon"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234923?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 13:08:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14a99948-103c-476c-8ed2-b1b767113c31</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Not exactly at 256 or 512, but around those points.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234917?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 12:57:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d505e58-1d62-4307-ab9e-5af7a78b6f1c</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Is that just me or are those spikes at exactly values for 256 and 512? That would suggest a software problem in buffer or value handling.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234906?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 12:39:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72de6de1-d463-4e54-a033-d5c756fb00e1</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;My suggestion for debugging it to not enable BLE, but output the SAADC samples over UART or RTT to check if it&amp;#39;s related to the radio in any way. The next suggestion is to look at the usage for the SAADC, and if you may be periodically calibrating the SAADC. Also do check if there may be any ripple on VDD on an oscilloscope.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234902?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 12:35:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e3b53c4-3dbc-4f53-9039-6aaf19a83e05</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;VDD is constant 3.1V, applied by external DC supply.&lt;/p&gt;
&lt;p&gt;Distance between the spikes in time is different for every waves. If I apply high frequency sine waves, time interval is short and for low frequency sine waves, time interval is long.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234894?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 12:23:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cfc4706-b359-4827-8068-e200e637d398</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;How does VDD look like? What is the distance between the spikes in time?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234871?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 11:24:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:862dd394-73c7-4003-8e4b-e55cda98e8b9</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Yes, I did nothing.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using DK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234825?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 09:27:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb2ad2e9-8883-435d-903c-a6e7efcd145b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;You are sure you are not doing any processing of the SAADC? E.g. that you average several samples before they are sent?&lt;/p&gt;
&lt;p&gt;What hardware is used here? DK?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234820?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 09:10:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:552a7f54-86f0-4412-bb23-420cb1948d49</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Thanks for advice.&lt;/p&gt;
&lt;p&gt;I tried several conditions, and found that those errors are not evoked periodically.&lt;/p&gt;
&lt;p&gt;However, I found that that occured at specific range of voltage: around &amp;#39;0.9V, 1.8V, and 2.7V&amp;#39; (I tested from 0.1V to 2.9V, with Sine wave).&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using internal reference with gain of 1/6.&lt;/p&gt;
&lt;p&gt;ADC activates every 12 us, and I also checked for much bigger duration.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I also changed acquisition time: from 3 us to 10 us. Input resistance of ADC is smaller than the one that indicated in datasheet.&lt;/p&gt;
&lt;p&gt;But it always happens like this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234810?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 08:32:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16e52526-29a5-429a-9582-06234df21856</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Assuming you wrote the firmware, then you should be able to&amp;nbsp;adjust the connection interval to see if that impact the interval of the issue and/or check if the code is periodically executing an SAADC calibration at the interval seen. That may narrow down the cause.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234767?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 00:33:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b4c1075-ea95-4fac-986d-121f312b1ae8</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;I&amp;#39;m sending those data to phone by BLE&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC issues (wrong values)</title><link>https://devzone.nordicsemi.com/thread/234673?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2020 14:15:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ec4b5bb-8baa-446a-a1ff-ad7dbeb52f69</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Do the spikes depend on BLE activity or SAADC calibration?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>