Great. I will give it a try and let you know how it goes.

Thank you for your response. It helps.

Mo

On Sun, Jun 28, 2020, 04:20 Casper Meijn <cas...@meijn.net> wrote:

> Hi Mo Chen,
>
> I am not part of the core team. I have used the ADC on the nRF52832. As
> I understood it, it has a single ADC for actual measurement and this
> could be connected to 8 different inputs. This would mean that you only
> need ADC0 and you configure multiple channels using struct adc_chan_cfg.
>
> I have not done this myself, as I only have one pin to measure, but I
> believe this is how you should do it.
>
> Hope this helps,
> Casper
>
> On di, jun 23, 2020 at 15:47, Mo Chen <shanyechu...@gmail.com> wrote:
> > 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