The ADC settings on the nRF52840 with Zephyr are malfunctioning for certain parameters.

"The nRF52840 is developed using NCS v2.6.1. When the ADC is set with the reference voltage as (.reference = ADC_REF_VDD_1_4, .resolution = 10), the ADC sampling output is 0 and malfunctions. However, when set to (.reference = ADC_REF_VDD_1_4, .resolution = 12), it works normally. Additionally, when set to (.reference = ADC_REF_INTERNAL, .resolution = 10), it also works normally. Why does the combination of (.reference = ADC_REF_VDD_1_4, .resolution = 10) cause a malfunction?"

Parents
  • Hello,

    When using VDD as reference, then you need to add .zephyr,vref-mv = <nnnn>; where nnnn depends on the vdd/4 voltage (e.g. 750mV if VDD=3V). Make sure to use pristine build, it's not allways that changes in devicetree is picked up otherwize.

    Kenneth

  • First of all, thank you very much for your reply. However, I also noticed .vref_mv and configured it accordingly. Regrettably, when the ADC parameters are set to (.reference = ADC_REF_VDD_1_4, .resolution = 10), the ADC collection does not work properly.

    To troubleshoot, I bypassed the devicetree ADC attribute configuration and directly used the adc_dt_spec structure variable to configure the ADC sampling parameters (struct adc_dt_spec adc_channels). Even with this configuration, it still doesn't work properly.

Reply
  • First of all, thank you very much for your reply. However, I also noticed .vref_mv and configured it accordingly. Regrettably, when the ADC parameters are set to (.reference = ADC_REF_VDD_1_4, .resolution = 10), the ADC collection does not work properly.

    To troubleshoot, I bypassed the devicetree ADC attribute configuration and directly used the adc_dt_spec structure variable to configure the ADC sampling parameters (struct adc_dt_spec adc_channels). Even with this configuration, it still doesn't work properly.

Children
Related