Need two comperators in nrf5340

Hi,

Before I opened this issue ( adc windows mode in nrf sdk connect)  but later I found out that I need to two comparators since I have two sensors that generate volt values between (0 -> Vdd)

The solution with Comp was acceptable, but since I have two sensors connected to two different ANALOG pins and NRF5340 has only one COMP, what is the best solution (alternative) to solve this problem?

I would like to have an interrupt-based solution to detect volt when it goes lower than Thershold-low and higher than Threshold-high. 

Thanks in advance!

Tools:

SOC: nrf5340

SDK: v2.2.0

Parents
  • Hello,

    There is only one comparator as you say, so the only way then is to periodically read the adc value of the second input. How frequently you need to read the second input really depends on how fast you expect the signal to vary and your requirement to latency from it changes until you need to detect it. Have in mind that the ADC also draw some current, so it will impact the current consumption if you do it continously/frequently.

    Kenneth

  • Hello Kenneth,

    Actually, power consumption is not an issue in our project since it is not battery-powered. The only issue is that the ADC reading needs to be checked permanently and very frequently to see if there is a change in voltage.
    So in Zephyr RTOS do you think is better to read adc (very often maybe per 20 ms) using  SAADC with timer ppi or using k_work_delayable  to schedule a work_thread to check adv value and rescheduled again?


    BR,

Reply
  • Hello Kenneth,

    Actually, power consumption is not an issue in our project since it is not battery-powered. The only issue is that the ADC reading needs to be checked permanently and very frequently to see if there is a change in voltage.
    So in Zephyr RTOS do you think is better to read adc (very often maybe per 20 ms) using  SAADC with timer ppi or using k_work_delayable  to schedule a work_thread to check adv value and rescheduled again?


    BR,

Children
  • Mustafa said:
    So in Zephyr RTOS do you think is better to read adc (very often maybe per 20 ms) using  SAADC with timer ppi or using k_work_delayable  to schedule a work_thread to check adv value and rescheduled again?

    If you don't have any strict timing requirment I suggest to schedule the work, reason is simply that it is easier to port and maintain code between devices when using the zephyr api, rather than to work with very hardware close implementations.

    Kenneth

Related