<?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>PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93363/ppi-delay-due-to-interrupt-disable</link><description>Hello, I implemented the function to receive an external 62.5KHz clock as an interrupt and repeat the process at a very regular time using PPI. However, sometimes PPI processing is delayed(No interrupt received) as shown in the following figure. What</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 29 Nov 2022 08:36:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93363/ppi-delay-due-to-interrupt-disable" /><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/398024?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2022 08:36:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57608852-7e88-4bf1-a696-478d5f0a4dda</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello SunBae Yim,&lt;/p&gt;
[quote user="ParanBada0"]ADC sampling using the PPI function. Where is the source code for that part?[/quote]
&lt;p&gt;If you just would like to see how to trigger SAADC sampling through PPI then you could &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/nrf_dev_saadc_example.html"&gt;take a look at the SAADC example in the SDK&lt;/a&gt;.&lt;br /&gt;You could also see &lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples"&gt;some examples of common SAADC usage in this repository&lt;/a&gt;.&lt;/p&gt;
[quote user="ParanBada0"]Is it done inside the soft device?[/quote]
&lt;p&gt;No - &lt;a href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/sd_resource_reqs/ppi.html"&gt;the SoftDevice does use some PPI channels&lt;/a&gt;, but your application can use the channels that are not being used by the SoftDevice for whatever you would like.&lt;/p&gt;
[quote user="ParanBada0"]Or does it not work on the hardware inside the MCU?[/quote]
&lt;p&gt;I am not sure that I understand this question, could you elaborate?&lt;/p&gt;
[quote user="ParanBada0"]For example, if the SAADC buffer size is 100, ADC sampling is executed 100 times and the value is stored in this RAM buffer.&lt;br /&gt;Whenever ADC sampling is performed 100 times, I want to control the GPIO port in that part of the source code as follows.[/quote]
&lt;p&gt;To achieve this you could set the GPIO as part of the DONE handling - just keep in mind that the processing of the DONE event could be postponed if there is a higher priority interrupt being processed at the time where it is generated, so the GPIO will then not show &lt;em&gt;exactly&lt;/em&gt; when the 100 samples have completed.&lt;br /&gt;If you want the GPIO to accurately reflect when the 100 samples have been collected you would have to set up a PPI channel between the GPIO and the SAADC DONE event - in this case, it would toggle immediately when the DONE event is generated.&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><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/397380?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2022 11:12:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:530c26fc-88f1-4859-bfdb-09e2d0462cb1</guid><dc:creator>ParanBada</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;ADC sampling using the PPI function. Where is the source code for that part?&lt;br /&gt;Is it done inside the soft device? Or does it not work on the hardware inside the MCU?&lt;/p&gt;
&lt;p&gt;I want to check the code that works when performing ADC sampling through PPI.&lt;br /&gt;For example, if the SAADC buffer size is 100, ADC sampling is executed 100 times and the value is stored in this RAM buffer.&lt;br /&gt;Whenever ADC sampling is performed 100 times, I want to control the GPIO port in that part of the source code as follows.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if FEATURE_FOR_SCOPE
nrf_gpio_pin_set(ADC_CLK_18);
nrf_gpio_pin_clear(ADC_CLK_18);
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then I want to check 100 ADC samplings through a logic analyzer.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;SunBae Yim.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/396570?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2022 08:46:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7495b34-49c1-4d1b-846d-3f374a3b3940</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again, SunBae Yim&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="ParanBada0"]Your advice to increase the SAADC buffer size is good.[/quote]
&lt;p&gt;I am glad to hear you say so! :)&lt;/p&gt;
[quote user="ParanBada0"]&lt;p&gt;Is there any documentation to refer to the SAADC buffer max size?&lt;/p&gt;
&lt;p&gt;I want to set the SAADC Buffer size to 4127. Is it possible?&lt;/p&gt;[/quote]
&lt;p&gt;The SAADC uses EasyDMA and so the provided buffer must be in RAM.&lt;br /&gt;Additionally, the maximum value of the MAXCNT register is 2^14 -1, and so that is the maximal buffer size for a single buffer.&lt;br /&gt;You can read more about this in &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html#saadc_easydma"&gt;the SAADC EasyDMA documentation&lt;/a&gt;.&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><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/396522?ContentTypeID=1</link><pubDate>Sun, 20 Nov 2022 14:46:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff6c6722-13af-427f-8fc7-03d801927fb0</guid><dc:creator>ParanBada</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Your advice to increase the SAADC buffer size is good.&lt;br /&gt;How many SAADC buffers can I increase?&lt;br /&gt;Is there any documentation to refer to the SAADC buffer max size?&lt;/p&gt;
&lt;p&gt;I want to set the SAADC Buffer size to 4127. Is it possible?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;SunBae Yim.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/396049?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 15:27:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd9bdb5a-3ab1-4916-9558-dc2d3880bd0f</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again, SunBae Yim&lt;/p&gt;
[quote user="ParanBada0"]Why is there a delay when the ADC only samples through the PPI?[/quote]
&lt;p&gt;Thank you for sharing the source code used for the measuring.&lt;br /&gt;The GPIO is being set by the CPU when it goes to process the SAADC DONE event, which is not necessarily immediately after the SAADC has performed a sampling. The CPU could be busy handling a higher level interrupt, such as any SoftDevice activity, and thus the processing of the DONE event could be delayed. This is likely what is happening in your measurements.&lt;br /&gt;&lt;br /&gt;If you want the GPIO to accurately portray when the DONE event occurs you should instead have a PPI channel connect the DONE event and a GPIO toggle task. This way, you will see that the DONE event is actually generated as soon as the sampling finishes, which should be &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html#unique_1699153141"&gt;[t_CONV + t_ACQ]&lt;/a&gt; after the 62.5 kHz pulse.&lt;br /&gt;&lt;br /&gt;Additionally, I also note that you are using a SAADC buffer size of 1, which means that the CPU needs to intervene for every sample to provide the next buffer to use by the ADC. Instead, I would recommend increasing the SAADC buffer to a higher number, so that you only need to do processing every so often, instead of after each sampling.&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><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/396005?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 13:56:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08d08189-edb1-494b-a322-eee42cb8a94c</guid><dc:creator>ParanBada</dc:creator><description>&lt;p&gt;I set SIM_IRQ_NO to 16 in the code.&lt;br /&gt;The register value is saved in the RAM Buffer pd_voltage_buff while performing ADC sampling 16 times.&lt;br /&gt;I am only doing the same ADC sampling. But why would the delay happen?&lt;/p&gt;
&lt;p&gt;After 16 samplings are completed, the value is changed to voltage, LOG is displayed, and the value is transmitted through BLE.&lt;/p&gt;
&lt;p&gt;Why is there a delay when the ADC only samples through the PPI?&lt;br /&gt;please help me.&lt;/p&gt;
&lt;p&gt;Best Regards.&lt;/p&gt;
&lt;p&gt;SunBae Yim.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/396000?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 13:44:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:224af771-1c0f-47ea-9b39-6193776310e7</guid><dc:creator>ParanBada</dc:creator><description>&lt;p&gt;Here is my source code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*******************************************************************************
 * @file	meas_pd_voltage_simple.c
 * @author	
 * @version	V1.0.0
 * @date	2022-09-05
 * @brief   
 ******************************************************************************/

#include &amp;quot;sdk_common.h&amp;quot;
			
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_drv_saadc.h&amp;quot;
#include &amp;quot;nrfx_gpiote.h&amp;quot;
#include &amp;quot;nrf_drv_gpiote.h&amp;quot;
#include &amp;quot;nrf_drv_ppi.h&amp;quot;
#include &amp;quot;nrf_drv_timer.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;ada2200_spi.h&amp;quot;
#include &amp;quot;battery_saadc.h&amp;quot;
#include &amp;quot;ble_nus.h&amp;quot;
#include &amp;quot;meas_pd_voltage_simple.h&amp;quot;
#include &amp;quot;main.h&amp;quot;

#define PD_REF_VOLTAGE_IN_MILLIVOLTS   		600.0f                                     /**&amp;lt; Reference voltage (in milli volts) used by ADC while doing conversion. */
#define PD_PRE_SCALING_COMPENSATION    		6.0f                                       /**&amp;lt; The ADC is configured to use VDD with 1/3 prescaling as input. And hence the result of conversion is to be multiplied by 3 to get the actual value of the battery voltage.*/
#define PD_ADC_RES_10BITS             		1024.0f                                    /**&amp;lt; Maximum digital value for 10-bit ADC conversion. */

/**@brief Macro to convert the result of ADC conversion in millivolts.
 *
 * @param[in]  ADC_VALUE   ADC result.
 *
 * @retval     Result converted to millivolts.
 */
#define PD_VOUT_IN_MILLI_VOLTS(ADC_VALUE)\
				(((((ADC_VALUE) * PD_REF_VOLTAGE_IN_MILLIVOLTS) / PD_ADC_RES_10BITS) * PD_PRE_SCALING_COMPENSATION)*2)

#define SIM_SAMPLES_IN_BUFFER 		1

static nrf_saadc_value_t pd_adc_buf[2][SIM_SAMPLES_IN_BUFFER];
bool  pd_adc_simple_start	= false;
bool  pd_adc_simple_end		= false;

#define PD_ADC_CNT			8
uint8_t SIM_IRQ_NO 			= 8;

float pd_voltage_buff[35]; /* For Cycle-8, Cycle-16, Cycle-24, Cycle-32 */ 
uint8_t	pd_voltage_buff_idx = 0;

static nrf_ppi_channel_t	m_ppi_channel;

extern char		ble_tx_buffer[BLE_NUS_MAX_DATA_LEN];


void simple_ppi_init(void)
{
    ret_code_t err_code;

    err_code = nrf_drv_ppi_init();
    APP_ERROR_CHECK(err_code);

    uint32_t gpiote_event_addr = nrf_drv_gpiote_in_event_addr_get(ADA2200_SYNCO_PIN);	
    uint32_t saadc_sample_task_addr   = nrf_drv_saadc_sample_task_get();

    /* setup ppi channel so that timer compare event is triggering sample task in SAADC */
    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_ppi_channel_assign(m_ppi_channel,
                                          gpiote_event_addr,
                                          saadc_sample_task_addr);
    APP_ERROR_CHECK(err_code);
}


void simple_ppi_uninit(void)
{
    ret_code_t err_code;

    err_code = nrf_drv_ppi_uninit();
    APP_ERROR_CHECK(err_code);
}


void simple_sampling_event_enable(void)
{
    ret_code_t err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
    APP_ERROR_CHECK(err_code);
}


void simple_sampling_event_disable(void)
{
	ret_code_t err_code = nrf_drv_ppi_channel_disable(m_ppi_channel);
	APP_ERROR_CHECK(err_code);
}


/**@brief Function for handling the ADC interrupt.
 *
 * @details  This function will fetch the conversion result from the ADC, convert the value into
 *           percentage and send it to peer.
 */
static void simple_voltage_handler(nrf_drv_saadc_evt_t const * p_event)	/* PD Voltage reading */
{
	
	float pd_voltage_sum = 0.0f;

    if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
    {	
#if FEATURE_FOR_SCOPE    
		nrf_gpio_pin_set(ADC_CLK_18);
		nrf_gpio_pin_clear(ADC_CLK_18);
#endif	
	
        ret_code_t err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, SIM_SAMPLES_IN_BUFFER);
		APP_ERROR_CHECK(err_code);

		pd_voltage_buff[pd_voltage_buff_idx] = p_event-&amp;gt;data.done.p_buffer[0];
		pd_voltage_buff_idx++;

		if(pd_voltage_buff_idx == SIM_IRQ_NO) {
			pd_adc_simple_end = true;
			pd_adc_simple_start = false;

			simple_mesurement_stop();

			pd_voltage_sum = 0;

			for(uint8_t i = 0; i &amp;lt; SIM_IRQ_NO; i++) {
				
				pd_voltage_buff[i] = PD_VOUT_IN_MILLI_VOLTS(pd_voltage_buff[i]);
				pd_voltage_buff[i] = pd_voltage_buff[i] * -1;
				pd_voltage_sum += pd_voltage_buff[i];
			}

			for(uint8_t i = 0; i &amp;lt; SIM_IRQ_NO; i++) {
				printf(&amp;quot; %f &amp;quot;, pd_voltage_buff[i]);
			}

			printf(&amp;quot;\r\nTh%f\r\n\r\n&amp;quot;, pd_voltage_sum);
			sprintf(ble_tx_buffer, &amp;quot;Th%f\r\n&amp;quot;, pd_voltage_sum);
			data_tx_handler(ble_tx_buffer);
		}
    }
}


void simple_adc_init(void)
{
	static nrfx_saadc_config_t default_config;
	default_config.resolution 			= (nrf_saadc_resolution_t)NRFX_SAADC_CONFIG_RESOLUTION;	/* Resolution is 10bits */
	default_config.oversample 			= (nrf_saadc_oversample_t)NRFX_SAADC_CONFIG_OVERSAMPLE;	/* Over Sampling Disabled */
	default_config.interrupt_priority 	= NRFX_SAADC_CONFIG_IRQ_PRIORITY;						/* Interrupt Priority is 0(Highest) */
	default_config.low_power_mode 		= NRFX_SAADC_CONFIG_LP_MODE;							/* Low Power Mode is Disabled */

	static nrf_saadc_channel_config_t config;
	config.resistor_p 	= NRF_SAADC_RESISTOR_DISABLED;
	config.resistor_n 	= NRF_SAADC_RESISTOR_DISABLED;
	config.gain			= NRF_SAADC_GAIN1_6;
	config.reference	= NRF_SAADC_REFERENCE_INTERNAL;
	config.acq_time		= NRF_SAADC_ACQTIME_3US;
	config.mode			= NRF_SAADC_MODE_DIFFERENTIAL;
	config.burst		= NRF_SAADC_BURST_DISABLED;
	config.pin_p		= (nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN0);
	config.pin_n		= (nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN1);
	
	ret_code_t err_code = nrf_drv_saadc_init(&amp;amp;default_config, simple_voltage_handler);
	APP_ERROR_CHECK(err_code);

	err_code = nrf_drv_saadc_channel_init(0, &amp;amp;config);
	APP_ERROR_CHECK(err_code);

	err_code = nrf_drv_saadc_buffer_convert(pd_adc_buf[0], SIM_SAMPLES_IN_BUFFER);
	APP_ERROR_CHECK(err_code);

//	err_code = nrf_drv_saadc_buffer_convert(pd_adc_buf[1], SIM_SAMPLES_IN_BUFFER);
//	APP_ERROR_CHECK(err_code);
}


void simple_adc_uninit(void)
{
	nrf_drv_saadc_uninit();
	nrf_drv_saadc_channel_uninit(0);
}


void simple_irq_init(void){
    ret_code_t err_code;

	/* Initialize int pin */
	if (!nrfx_gpiote_is_init())
	{
	  err_code = nrfx_gpiote_init();
	  APP_ERROR_CHECK(err_code);
	}

    nrfx_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
    in_config.pull = NRF_GPIO_PIN_PULLDOWN;

    err_code = nrfx_gpiote_in_init(ADA2200_SYNCO_PIN, &amp;amp;in_config, NULL);
    APP_ERROR_CHECK(err_code);

    nrfx_gpiote_in_event_enable(ADA2200_SYNCO_PIN, true);
}


void simple_irq_uninit(void){

	nrfx_gpiote_in_event_disable(ADA2200_SYNCO_PIN);
	nrfx_gpiote_in_uninit(ADA2200_SYNCO_PIN);
}


void simple_mesurement_start(void){

	battery_timer_stop();

	simple_irq_init();
	simple_adc_init();
	simple_ppi_init();

	simple_sampling_event_enable();
}


void simple_mesurement_stop(void){

	battery_timer_start();

	simple_sampling_event_disable();
	simple_adc_uninit();
	simple_ppi_uninit();
	simple_irq_uninit();
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Looking at simple_voltage_handler() in my source code, I make GPIO High-&amp;gt;Low as follows.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if FEATURE_FOR_SCOPE
nrf_gpio_pin_set(ADC_CLK_18);
nrf_gpio_pin_clear(ADC_CLK_18);
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This code represents a green clock. And the lag appears.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/395978?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 12:55:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcf58deb-104d-4893-ae73-bed78a102624</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;I am glad to hear that you improved the sampling through PPI! :)&amp;nbsp;&lt;/p&gt;
[quote user="ParanBada0"]However, ADC sampling may be delayed as shown by the arrow in the figure.[/quote]
&lt;p&gt;What exactly are the green lines set by? What are you scoping here, and where exactly is the setup for this in your code?&lt;br /&gt;It seems to me that the green lines are not exactly aligned with the 62.5 kHz input, and so I suspect that the delay here is not an actual delay of the sampling, but rather a delay on the processing of the tasks/events on the measuring side.&lt;br /&gt;Since PPI is used to trigger the sampling then the SAMPLE task will be triggered immediately by the triggering event.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/395949?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 10:53:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2159909f-8090-4468-9f49-84f46b4002db</guid><dc:creator>ParanBada</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I improved the ADC sampling using PPI technique. It performs ADC sampling in synchronization with an external 62.5KHz clock.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:314px;max-width:534px;" alt=" " height="314" src="https://devzone.nordicsemi.com/resized-image/__size/1068x628/__key/communityserver-discussions-components-files/4/ppi3.png" width="534" /&gt;&lt;br /&gt;However, ADC sampling may be delayed as shown by the arrow in the figure.&lt;br /&gt;Why is there such a delay? What is the solution?&lt;br /&gt;This is a very important and urgent issue.&lt;br /&gt;I would appreciate it if you could help me.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;SunBae Yim.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/395820?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2022 14:22:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bc7a34c-0663-4b7b-a45c-d6bbc5227f31</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello SunBae Yim,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&lt;br /&gt;&lt;br /&gt;Briefly looking through the provided code it looks alright to me,&amp;nbsp;&lt;br /&gt;is there anything specifically you would like for me to take a look at in the code? Is there anything that is not working as expected?&lt;br /&gt;&lt;br /&gt;Two minor comment:&lt;br /&gt;&lt;br /&gt;- it seems that you&amp;nbsp;do not check the error the returned error code from&amp;nbsp;nrf_drv_saadc_buffer_convert, which I would recommend that you do.&lt;br /&gt;&lt;br /&gt;- you have a lot of clutter in the code; magic numbers and commented out code lines. To increase maintainability I would recommend that you replace the magic numbers with appropriate defines, and that you move the scrap code into a separate file if you feel like you might need it again later.&lt;/p&gt;
[quote user="ParanBada0"]Is it correct to use this formula? Or should the formula be changed?[/quote]
&lt;p&gt;Yes, this is correct.&lt;br /&gt;The formula can be derived from &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html#saadc_digital_output"&gt;the Digital Output section in the SAADC documentation&lt;/a&gt;.&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><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/394901?ContentTypeID=1</link><pubDate>Wed, 09 Nov 2022 12:08:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc775bf6-27cf-4de0-8560-79bc848ecbcf</guid><dc:creator>ParanBada</dc:creator><description>&lt;p&gt;My source code is here;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*******************************************************************************
 * @file	
 * @author	
 * @version	V1.0.0
 * @date	2022-09-05
 * @brief   
 ******************************************************************************/

#include &amp;quot;sdk_common.h&amp;quot;
			
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_drv_saadc.h&amp;quot;
#include &amp;quot;nrfx_gpiote.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;nrf_drv_timer.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_drv_ppi.h&amp;quot;
#include &amp;quot;ada2200_spi.h&amp;quot;
#include &amp;quot;ble_nus.h&amp;quot;
#include &amp;quot;fstorage.h&amp;quot;
#include &amp;quot;measurements.h&amp;quot;
#include &amp;quot;meas_pd_voltage_full.h&amp;quot;
#include &amp;quot;mcp4725_i2c.h&amp;quot;
#include &amp;quot;ad5272_i2c.h&amp;quot;
#include &amp;quot;main_timer.h&amp;quot;
#include &amp;quot;battery_saadc.h&amp;quot;
#include &amp;quot;main.h&amp;quot;

#define FULL_REF_VOLTAGE_IN_MILLIVOLTS   	600.0f                                     /**&amp;lt; Reference voltage (in milli volts) used by ADC while doing conversion. */
#define FULL_PRE_SCALING_COMPENSATION    	6.0f                                       /**&amp;lt; The ADC is configured to use VDD with 1/3 prescaling as input. And hence the result of conversion is to be multiplied by 3 to get the actual value of the battery voltage.*/
#define FULL_ADC_RES_10BITS             	1024.0f                                    /**&amp;lt; Maximum digital value for 10-bit ADC conversion. */

/**@brief Macro to convert the result of ADC conversion in millivolts.
 *
 * @param[in]  ADC_VALUE   ADC result.
 *
 * @retval     Result converted to millivolts.
 */
#define FULL_VOUT_IN_MILLI_VOLTS(ADC_VALUE)\
				((((ADC_VALUE) * FULL_REF_VOLTAGE_IN_MILLIVOLTS) / FULL_ADC_RES_10BITS) * FULL_PRE_SCALING_COMPENSATION)

#define FULL_SAMPLES_IN_BUFFER 		1
static nrf_saadc_value_t pd_full_adc_buf[2][FULL_SAMPLES_IN_BUFFER];
bool  pd_adc_full_start	= false;


uint8_t led_full_list[6];
uint8_t pd_full_list[12];

uint8_t led_full_list_a[6]	= {1,2,3,4,5,6};
uint8_t pd_full_list_a[12]	= {5,6,7,8,9,10,15,16,17,18,19,20};

uint8_t led_full_list_b[6]	= {7,8,9,10,11,12};
uint8_t pd_full_list_b[12]	= {6,5,4,3,2,1,16,15,14,13,12,11};

uint8_t led_full_list_c[6]	= {13,14,15,16,17,18};
uint8_t pd_full_list_c[12]	= {15,16,17,18,19,20,5,6,7,8,9,10};

uint8_t led_full_list_d[6]	= {19,20,21,22,23,24};
uint8_t pd_full_list_d[12]	= {16,15,14,13,12,11,6,5,4,3,2,1};


static uint16_t FULL_DELAY_CLK = 0;
static bool full_main_delay = false;
static bool full_main_testing = false;
#define full_main_clock_delay(delay_cnt) 	full_main_delay = true;\
										full_main_testing = false;\
										FULL_DELAY_CLK = delay_cnt;

#define FULL_CYCLE_CNT 			32	/* Dummy=16, Cycle_Max_Cnt=32*/
/* ----------------  +  --------                         */
/*       Dummy 16       Cycle = 8                        */
/*                                                       */
/* ----------------  +  ----------------                 */
/*       Dummy 16       Cycle = 16                       */
/*                                                       */
/* ----------------  +  ------------------------         */
/*       Dummy 16       Cycle = 24                       */
/*                                                       */
/* ----------------  +  -------------------------------- */
/*       Dummy 16       Cycle = 32                       */
/*                                                       */

#define FULL_CYCLE_SEND_CNT 	12

static float	full_cycle_buff[FULL_CYCLE_CNT] = {0,};
static float	full_cycle_send_buff[FULL_CYCLE_SEND_CNT] = {0,};

uint8_t	FULL_IRQ_NO			= 7;
#define FULL_PD_NO			11
#define FULL_LED_NO			5

static int16_t 	buf_seq		= 0;
static int16_t 	irq_no 		= 0;
static int8_t 	pd_no 		= 0;
static int8_t 	led_no 		= 0;

extern bool pd_adc_full_a_start; 
extern bool pd_adc_full_a_end; 

extern bool pd_adc_full_b_start; 
extern bool pd_adc_full_b_end; 

extern bool pd_adc_full_c_start; 
extern bool pd_adc_full_c_end; 

extern bool pd_adc_full_d_start;
extern bool pd_adc_full_d_end; 


static nrf_ppi_channel_t	m_ppi_channel;

extern char		ble_tx_buffer[BLE_NUS_MAX_DATA_LEN];


void full_ppi_init(void)
{
    ret_code_t err_code;

    err_code = nrf_drv_ppi_init();
    APP_ERROR_CHECK(err_code);

    uint32_t gpiote_event_addr = nrf_drv_gpiote_in_event_addr_get(ADA2200_SYNCO_PIN);	
    uint32_t saadc_sample_task_addr   = nrf_drv_saadc_sample_task_get();

    /* setup ppi channel so that timer compare event is triggering sample task in SAADC */
    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_ppi_channel_assign(m_ppi_channel,
                                          gpiote_event_addr,
                                          saadc_sample_task_addr);
    APP_ERROR_CHECK(err_code);
}


void full_ppi_uninit(void)
{
    ret_code_t err_code;

    err_code = nrf_drv_ppi_uninit();
    APP_ERROR_CHECK(err_code);
}


void full_sampling_event_enable(void)
{
    ret_code_t err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
    APP_ERROR_CHECK(err_code);
}


void full_sampling_event_disable(void)
{
	ret_code_t err_code = nrf_drv_ppi_channel_disable(m_ppi_channel);
	APP_ERROR_CHECK(err_code);
}


/**@brief Function for handling the ADC interrupt.
 *
 * @details  This function will fetch the conversion result from the ADC, convert the value into
 *           percentage and send it to peer.
 */
static inline void full_main_meas_process(void)
{
	static float sum = 0.0f;

	if(irq_no &amp;lt; FULL_IRQ_NO) {
		irq_no++;
	} else if(irq_no &amp;gt;= FULL_IRQ_NO) {

		///////////////////////////////////////////				/* Calculation Cycle-8, Cycle-16, Cycle-24, Cycle-32 */
		for(uint8_t i = 0; i &amp;lt;= FULL_IRQ_NO; i++) {
			sum += full_cycle_buff[i];
		}

		full_cycle_send_buff[buf_seq] = sum;
//#if FEATURE_PRINTF
//		printf(&amp;quot;\r\n===============\r\n&amp;quot;);
//		printf(&amp;quot;sum = %f\r\nfull_cycle_send_buff=\r\n&amp;quot;, sum);
//
//		for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_SEND_CNT; i++) {
//			printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_send_buff[i]);
//		}
//		printf(&amp;quot;===============\r\n\r\n&amp;quot;);
//#endif

		sum = 0;

		for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_CNT; i++) {
			full_cycle_buff[i] = 0.0f;
		}

		buf_seq++;
		irq_no = 0;
		
		///////////////////////////////////////////				/* PD Changed */
		if(pd_no &amp;lt; FULL_PD_NO) {
			
			pd_no++;
#if FEATURE_PRINTF
			printf(&amp;quot;\r\nPD changed(a) to %d ---------------------------\r\n\r\n&amp;quot;, pd_no);
#endif

			led_pd_matching_value_set(led_full_list[led_no], pd_full_list[pd_no]); /* MCP4725 DAC setting and PD on */
			full_main_clock_delay(m_config.pd_delay_us/16);

		} else if(pd_no &amp;gt;= FULL_PD_NO) {
			pd_no = 0;
			buf_seq = 0;

			printf(&amp;quot;Tj%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n&amp;quot;, led_full_list[led_no], full_cycle_send_buff[0], full_cycle_send_buff[1], full_cycle_send_buff[2], full_cycle_send_buff[3], full_cycle_send_buff[4], full_cycle_send_buff[5], full_cycle_send_buff[6], full_cycle_send_buff[7], full_cycle_send_buff[8], full_cycle_send_buff[9], full_cycle_send_buff[10], full_cycle_send_buff[11]);
			sprintf(ble_tx_buffer, &amp;quot;Tj%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n&amp;quot;, led_full_list[led_no], full_cycle_send_buff[0], full_cycle_send_buff[1], full_cycle_send_buff[2], full_cycle_send_buff[3], full_cycle_send_buff[4], full_cycle_send_buff[5], full_cycle_send_buff[6], full_cycle_send_buff[7], full_cycle_send_buff[8], full_cycle_send_buff[9], full_cycle_send_buff[10], full_cycle_send_buff[11]);
			data_tx_handler(ble_tx_buffer);
			
#if FEATURE_PRINTF
			printf(&amp;quot;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; SEND 12 data &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;\r\n&amp;quot;);
			printf(&amp;quot;PD changed(b) to %d ---------------------------\r\n&amp;quot;, pd_no);
#endif
			for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_SEND_CNT; i++) {
				full_cycle_send_buff[i] = 0.0f;
			}

			/////////////////////////////////////////////
			led_pd_matching_value_set(led_full_list[led_no], pd_full_list[pd_no]); /* MCP4725 DAC setting and PD on */
//			full_main_clock_delay(m_config.pd_delay_us/16);				/* PD와 LED 딜레이가 이중으로 적용되므로 하나 막는다. */
			/////////////////////////////////////////////

			////////////////////////////////////////////////////	/* LED Changed */
			if(led_no &amp;lt; FULL_LED_NO) {
				led_no++;
#if FEATURE_PRINTF
				printf(&amp;quot;LED changed to %d ---------------------------\r\n&amp;quot;, led_no);
#endif
				////////////////////////////////////////////////
				led_on(led_full_list[led_no]);
				full_main_clock_delay(m_config.led_delay_us/16);
				////////////////////////////////////////////////

			} else if(led_no &amp;gt;= FULL_LED_NO) {
				if(pd_adc_full_a_start == true) {
					pd_adc_full_a_start = false;
					pd_adc_full_a_end = true;
								
					main_timer_start();
				}

				if(pd_adc_full_b_start == true) {
					pd_adc_full_b_start = false;
					pd_adc_full_b_end = true;
								
					main_timer_start();
				}

				if(pd_adc_full_c_start == true) {
					pd_adc_full_c_start = false;
					pd_adc_full_c_end = true;
								
					main_timer_start();
				}

				if(pd_adc_full_d_start == true) {
					pd_adc_full_d_start = false;
					pd_adc_full_d_end = true;
								
					main_timer_start();
				}
				
				printf(&amp;quot;\r\n&amp;quot;);
				full_adc_end();
				return;
			}
		}
	}
} 


static void full_voltage_handler(nrf_drv_saadc_evt_t const * p_event)	/* PD Voltage reading */
{

    if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
    {	
		static uint16_t main_delay_cnt = 0;
		static float imsi_voltage = 0;

#if FEATURE_FOR_SCOPE    
		nrf_gpio_pin_set(ADC_CLK_18);
		nrf_gpio_pin_clear(ADC_CLK_18);
#endif

        nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, FULL_SAMPLES_IN_BUFFER);
		imsi_voltage = FULL_VOUT_IN_MILLI_VOLTS(p_event-&amp;gt;data.done.p_buffer[0]);

		if(full_main_testing == true) {

#if FEATURE_PRINTF
			printf(&amp;quot;[buf_seq=%d], led_no=%d(%d), pd_no=%d(%d), irq_no=%d V=%f\r\n&amp;quot;, buf_seq, led_no, led_full_list[led_no], pd_no, pd_full_list[pd_no], irq_no, imsi_voltage);
#endif			
			full_cycle_buff[irq_no] = imsi_voltage;

//#if FEATURE_PRINTF
//			printf(&amp;quot;full_cycle_buff=\r\n&amp;quot;);
//			switch(m_config.pd_adc_cnt){
//				case 8:
//					for(uint8_t i = 16; i &amp;lt; 24; i++) {
//						printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
//					}
//					break;
//			
//				case 16:
//					for(uint8_t i = 16; i &amp;lt; 32; i++) {
//						printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
//					}
//					break;
//			
//				case 24:
//					for(uint8_t i = 16; i &amp;lt; 40; i++) {
//						printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
//					}
//					break;
//			
//				case 32:
//					for(uint8_t i = 16; i &amp;lt; 48; i++) {
//						printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
//					}
//					break;
//			
//				default:
//					break;
//			}
//			printf(&amp;quot;===============\r\n&amp;quot;);
//		
//			printf(&amp;quot;full_cycle_send_buff=\r\n&amp;quot;);
//			for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_SEND_CNT; i++) {
//				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_send_buff[i]);
//			}
//			printf(&amp;quot;===============\r\n\r\n&amp;quot;);
//#endif

			full_main_meas_process();
			
		}else if(full_main_delay) {
#if FEATURE_PRINTF
			printf(&amp;quot;m_d = %d  &amp;quot;, main_delay_cnt);
#endif			
			if(main_delay_cnt++ &amp;gt;= FULL_DELAY_CLK-1) {
#if FEATURE_PRINTF
				printf(&amp;quot;\r\n&amp;quot;);
#endif					
				main_delay_cnt = 0;
				full_main_delay = false;
				full_main_testing = true;
			}
		}
    }
}


void full_adc_init(void)
{
	static nrfx_saadc_config_t default_config;
	default_config.resolution			= (nrf_saadc_resolution_t)NRFX_SAADC_CONFIG_RESOLUTION; /* Resolution is 10bits */
	default_config.oversample			= (nrf_saadc_oversample_t)NRFX_SAADC_CONFIG_OVERSAMPLE; /* Over Sampling Disabled */
	default_config.interrupt_priority	= NRFX_SAADC_CONFIG_IRQ_PRIORITY;						/* Interrupt Priority is 0(Highest) */
	default_config.low_power_mode		= NRFX_SAADC_CONFIG_LP_MODE;							/* Low Power Mode is Disabled */

	static nrf_saadc_channel_config_t config;
	config.resistor_p	= NRF_SAADC_RESISTOR_DISABLED;
	config.resistor_n	= NRF_SAADC_RESISTOR_DISABLED;
	config.gain 		= NRF_SAADC_GAIN1_6;
	config.reference	= NRF_SAADC_REFERENCE_INTERNAL;
	config.acq_time 	= NRF_SAADC_ACQTIME_10US;
	config.mode 		= NRF_SAADC_MODE_DIFFERENTIAL;
	config.burst		= NRF_SAADC_BURST_DISABLED;
	config.pin_p		= (nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN0);
	config.pin_n		= (nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN1);
	
	ret_code_t err_code = nrf_drv_saadc_init(&amp;amp;default_config, full_voltage_handler);
	APP_ERROR_CHECK(err_code);

	err_code = nrf_drv_saadc_channel_init(0, &amp;amp;config);
	APP_ERROR_CHECK(err_code);

	err_code = nrf_drv_saadc_buffer_convert(pd_full_adc_buf[0], FULL_SAMPLES_IN_BUFFER);
	APP_ERROR_CHECK(err_code);

	err_code = nrf_drv_saadc_buffer_convert(pd_adc_buf[1], SIM_SAMPLES_IN_BUFFER);
	APP_ERROR_CHECK(err_code);	
}



void full_adc_uninit(void)
{
#if FEATURE_PRINTF
	printf(&amp;quot;pd_full_adc_uninit\r\n&amp;quot;);
#endif

	nrf_drv_saadc_uninit();
	nrf_drv_saadc_channel_uninit(0);
}


void full_adc_start(void)
{

	battery_timer_stop();

	full_adc_init();
	full_irq_init();
	full_ppi_init();
	ada2200_start();

	full_sampling_event_enable();	

	if(pd_adc_full_a_start == true) {
#if FEATURE_PRINTF
		printf(&amp;quot;\r\n===============================================================\r\n&amp;quot;);
		printf(&amp;quot;===== Full_A start ============================================\r\n&amp;quot;);
		printf(&amp;quot;===============================================================\r\n&amp;quot;);
#endif
		memcpy(led_full_list, led_full_list_a, 6);
		memcpy(pd_full_list, pd_full_list_a, 12);
	}

	if(pd_adc_full_b_start == true) {
#if FEATURE_PRINTF
		printf(&amp;quot;\r\n===============================================================\r\n&amp;quot;);
		printf(&amp;quot;===== Full_B start ============================================\r\n&amp;quot;);
		printf(&amp;quot;===============================================================\r\n&amp;quot;);
#endif
		memcpy(led_full_list, led_full_list_b, 6);
		memcpy(pd_full_list, pd_full_list_b, 12);
	}

	if(pd_adc_full_c_start == true) {
#if FEATURE_PRINTF
		printf(&amp;quot;\r\n===============================================================\r\n&amp;quot;);
		printf(&amp;quot;===== Full_C start ============================================\r\n&amp;quot;);
		printf(&amp;quot;===============================================================\r\n&amp;quot;);
#endif
		memcpy(led_full_list, led_full_list_c, 6);
		memcpy(pd_full_list, pd_full_list_c, 12);
	}

	if(pd_adc_full_d_start == true) {
#if FEATURE_PRINTF
		printf(&amp;quot;\r\n===============================================================\r\n&amp;quot;);
		printf(&amp;quot;===== Full_D start ============================================\r\n&amp;quot;);
		printf(&amp;quot;===============================================================\r\n&amp;quot;);
#endif
		memcpy(led_full_list, led_full_list_d, 6);
		memcpy(pd_full_list, pd_full_list_d, 12);
	}

#if FEATURE_PRINTF
	printf(&amp;quot;LED(0) ON, PD(0) ON\r\n&amp;quot;);
#endif

	led_on(led_full_list[0]);

	led_pd_matching_value_set(led_full_list[0], pd_full_list[0]); /* MCP4725 DAC setting And PD on */
	nrf_delay_us(m_config.pd_delay_us);

#if FEATURE_PRINTF
	printf(&amp;quot;\r\nfull_cycle_buff Cleared&amp;lt;start&amp;gt;\r\n&amp;quot;);
	printf(&amp;quot;full_cycle_send_buff Cleared&amp;lt;start&amp;gt;\r\n&amp;quot;);
#endif
	
	for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_CNT; i++) {
		full_cycle_buff[i] = 0.0f;
	}
	for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_SEND_CNT; i++) {
		full_cycle_send_buff[i] = 0.0f;
	}

#if FEATURE_PRINTF
	printf(&amp;quot;full_cycle_buff=\r\n&amp;quot;);
	switch(m_config.pd_adc_cnt){
		case 8:
			for(uint8_t i = 16; i &amp;lt; 24; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		case 16:
			for(uint8_t i = 16; i &amp;lt; 32; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		case 24:
			for(uint8_t i = 16; i &amp;lt; 40; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		case 32:
			for(uint8_t i = 16; i &amp;lt; 48; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		default:
			break;
	}
	printf(&amp;quot;===============\r\n&amp;quot;);

	printf(&amp;quot;===============\r\n&amp;quot;);

	printf(&amp;quot;full_cycle_send_buff=\r\n&amp;quot;);
	for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_SEND_CNT; i++) {
		printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_send_buff[i]);
	}
	printf(&amp;quot;===============\r\n\r\n&amp;quot;);
#endif

	buf_seq		= 0;
	irq_no		= 0;
	pd_no 		= 0;
	led_no		= 0;

	full_main_testing = true;
	
}


void full_adc_end(void) 
{
#if FEATURE_PRINTF
	printf(&amp;quot;full_adc_end\r\n&amp;quot;);
#endif

	battery_timer_start();

	ada2200_stop();
	full_sampling_event_disable();

	full_irq_uninit();
	full_adc_uninit();
	full_ppi_uninit();

#if FEATURE_PRINTF
	printf(&amp;quot;\r\nfull_cycle_buff Cleared&amp;lt;end&amp;gt;\r\n&amp;quot;);
	printf(&amp;quot;full_cycle_send_buff Cleared&amp;lt;end&amp;gt;\r\n&amp;quot;);
#endif

	for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_CNT; i++) {
		full_cycle_buff[i] = 0.0f;
	}
	for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_SEND_CNT; i++) {
		full_cycle_send_buff[i] = 0.0f;
	}

#if FEATURE_PRINTF
	printf(&amp;quot;full_cycle_buff=\r\n&amp;quot;);
	switch(m_config.pd_adc_cnt){
		case 8:
			for(uint8_t i = 16; i &amp;lt; 24; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		case 16:
			for(uint8_t i = 16; i &amp;lt; 32; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		case 24:
			for(uint8_t i = 16; i &amp;lt; 40; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		case 32:
			for(uint8_t i = 16; i &amp;lt; 48; i++) {
				printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_buff[i]);
			}
			break;
	
		default:
			break;
	}
	printf(&amp;quot;===============\r\n&amp;quot;);

	printf(&amp;quot;===============\r\n&amp;quot;);

	printf(&amp;quot;full_cycle_send_buff=\r\n&amp;quot;);
	for(uint8_t i = 0; i &amp;lt; FULL_CYCLE_SEND_CNT; i++) {
		printf(&amp;quot;&amp;lt;%d&amp;gt;= %f\r\n&amp;quot;, i, full_cycle_send_buff[i]);
	}
	printf(&amp;quot;===============\r\n\r\n&amp;quot;);
#endif

	led_off(99);
	pd_off(99);

	full_main_testing = false;
	full_main_delay = false;
}


void full_irq_init(void){
    ret_code_t err_code;
#if FEATURE_PRINTF
	printf(&amp;quot;full_irq_init\r\n&amp;quot;);
#endif

	/* Initialize int pin */
	if (!nrfx_gpiote_is_init())
	{
	  err_code = nrfx_gpiote_init();
	  APP_ERROR_CHECK(err_code);
	}

    nrfx_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
    in_config.pull = NRF_GPIO_PIN_PULLDOWN;

    err_code = nrfx_gpiote_in_init(ADA2200_SYNCO_PIN, &amp;amp;in_config, NULL);
    APP_ERROR_CHECK(err_code);

    nrfx_gpiote_in_event_enable(ADA2200_SYNCO_PIN, true);
}


void full_irq_uninit(void){
#if FEATURE_PRINTF
	printf(&amp;quot;full_irq_uninit\r\n&amp;quot;);
#endif	
	nrfx_gpiote_in_event_disable(ADA2200_SYNCO_PIN);
	nrfx_gpiote_in_uninit(ADA2200_SYNCO_PIN);
}

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please review whether PPI, EasyDMA, etc. are implemented well.&lt;/p&gt;
&lt;p&gt;And I use 2 channels for ADC sampling with DIFFRENTIAL Mode. It takes a register value and calculates the actual voltage value using the following formula:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define FULL_REF_VOLTAGE_IN_MILLIVOLTS   	600.0f                                     /**&amp;lt; Reference voltage (in milli volts) used by ADC while doing conversion. */
#define FULL_PRE_SCALING_COMPENSATION    	6.0f                                       /**&amp;lt; The ADC is configured to use VDD with 1/3 prescaling as input. And hence the result of conversion is to be multiplied by 3 to get the actual value of the battery voltage.*/
#define FULL_ADC_RES_10BITS             	1024.0f                                    /**&amp;lt; Maximum digital value for 10-bit ADC conversion. */

#define FULL_VOUT_IN_MILLI_VOLTS(ADC_VALUE)\
				((((ADC_VALUE) * FULL_REF_VOLTAGE_IN_MILLIVOLTS) / FULL_ADC_RES_10BITS) * FULL_PRE_SCALING_COMPENSATION)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is it correct to use this formula? Or should the formula be changed?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;SunBae Yim.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI delay due to interrupt disable.</title><link>https://devzone.nordicsemi.com/thread/393252?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2022 13:23:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bf53fca-4b75-4cf5-a75c-17f6478f820e</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello SunBae Yim,&lt;br /&gt;&lt;br /&gt;It looks to me like your PPI might not be set up correctly. Could you share the section of your code in which this takes place?&lt;br /&gt;When PPI is set up correctly you will not need the CPU to handle any interrupts, in order for the connected TASK to be triggered by the generated EVENT.&lt;br /&gt;Therefore, there should be no delay on the triggering of the TASK as well, since it will happen as soon as the connected EVENT is generated.&lt;br /&gt;&lt;br /&gt;Are you using the nRF5 SDK, and if so, are also using the SoftDevice in your project?&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>