SAADC(two channel) Differencial Sampling by External 62.5KHz Clock Interrupt.

I am developing a product using the nRF52840.
I am currently running into a difficult problem. I inquired about it 2 years ago, but it has not been resolved.

I need to process Two Channel (Diffrencial) type saadc by using an external 62.5Khz interrupt.
However, the nRF52840 doesn't seem to be able to handle this speed.
The SAADC handler comes out too late.
I use s140_nrf52_7.2.0_softdevice.hex for soft device.

Please give me an answer on how to implement saadec two channel diffrencial type sampling at 62.5Khz rate.

  • Hello,
    I have a tight schedule these days, so it's very difficult. I need your help.
    I inquired about the PPI source code above.
    Please review my source code and give me an answer.
    I took your advice and blocked the interrupt.
    simple_voltage_handler() function is not executed.

  • Hi again,

    Looking at the example you shared on your google drive, these are the two things you can change.

    In simple_irq_init() use:
    err_code = nrfx_gpiote_in_init(ADA2200_SYNCO_PIN, &in_config, NULL);

    In addition change to:
    #define SIM_SAMPLES_IN_BUFFER 10 // or maybe even higher like 100

    At least then it seems to trigger simple_voltage_handler() every 10 or 100 samples here.

    Best regards,
    Kenneth

  • Hello,

    I implemented ADC sampling with a differential like the source code above, and converted it into a voltage value using the formula.
    However, the voltage value is only half of the actual measured value.

    Does the differential read half the voltage? Or do I have to change the formula?

    In differential sampling, half the voltage is output, how can I solve it?

    Best Regards,

    SunBae Yim.

  • Hi,

    ParanBada said:
    Does the differential read half the voltage?

    No, it should not. I suggest for test that you try with a different source (for instance with less impedance), and possible try to increase the acquisition time, ref:
    https://infocenter.nordicsemi.com/topic/ps_nrf52840/saadc.html

    Best regards,
    Kenneth

  • Hi,

    Differential ADC sampling:
    Find the difference by reading the P and N channels. Is that right? (VALUE = P - N)

    The same formula is used as follows.

    #define SIMPLE_REF_VOLTAGE_IN_MILLIVOLTS   		600.0f                                     /**< Reference voltage (in milli volts) used by ADC while doing conversion. */
    #define SIMPLE_PRE_SCALING_COMPENSATION    		6.0f                                       /**< 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 SIMPLE_ADC_RES_10BITS             		1024.0f                                    /**< 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 SIMPLE_VOUT_IN_MILLI_VOLTS(ADC_VALUE)\
    				((((ADC_VALUE) * SIMPLE_REF_VOLTAGE_IN_MILLIVOLTS) / SIMPLE_ADC_RES_10BITS) * SIMPLE_PRE_SCALING_COMPENSATION)
    

    Please check if this formula can also be used for DIFFRENTIAL.

    Best Regards,

    SunBae Yim.

Related