Hi dear team,

As we know that there are 8 ADC ports on nrf52832. And looks like in the
apache-mynewt-core source and cfg files, only ADC0 is enabled by default.

I have searched the entire core, there are 6 files, 8 locations that need
to be modified to enable other ADC ports.

I wonder if there is a simple way to enable more ADC ports without
modifying the core code, so that it won't warn me those files are dirty
when I try to do a "newt upgrade".

Or include all ADC ports in the core code as what I had done and users can
config the ADC_X = 1 in their own target syscfg.yml file without modifying
the core code to keep everything clean.

Or am I doing it in a wrong way? Any guidance?


Thanks,

Those files and locations are:

1. apache-mynewt-core/hw/mcu/nordic/nrf52xxx/pkg.yml
2. apache-mynewt-core/hw/mcu/nordic/nrf52xxx/syscfg.yml
3. apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/nrf52_periph.c
4. apache-mynewt-core/hw/mcu/nordic/nrf52xxx/include/nrfx52_config.h
5. apache-mynewt-nimble/porting/nimble/include/syscfg/syscfg.h
6. apache-mynewt-nimble/porting//npl/riot/include/syscfg/syscfg.h

example of changes I made:

in order to use ADC_1 and ADC_6, I have to add the corresponding code to
the core src file:
apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/nrf52_periph.c shown as below:
(also other file mentioned above need modified)

#if MYNEWT_VAL(ADC_0)
rc = os_dev_create(&os_bsp_adc0.ad_dev, "adc0",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
nrf52_adc_dev_init, &os_bsp_adc0_config);
assert(rc == 0);
#endif

#if MYNEWT_VAL(ADC_1)
rc = os_dev_create(&os_bsp_adc1.ad_dev, "adc1",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
nrf52_adc_dev_init, &os_bsp_adc1_config);
assert(rc == 0);
#endif

#if MYNEWT_VAL(ADC_6)
rc = os_dev_create(&os_bsp_adc6.ad_dev, "adc6",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
nrf52_adc_dev_init, &os_bsp_adc6_config);
assert(rc == 0);
#endif
}



--
Mo Chen

Reply via email to