MK10DN512 ADC0 with DMA continuous mode not working!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MK10DN512 ADC0 with DMA continuous mode not working!

Jump to solution
934 Views
m4l490n
Contributor V

I'm pulling my hair out here and I don't know what else to try.

I have a project I created for the MK10DC512VLQ10 where I need to configure ADC0 to work with DMA in continuous mode. The idea is to first make it work with the internal temp sensor and then with the real ADC inputs.

I based my project on the twrk60d100m_demo_apps_adc16_low_power demo app which shows how to deal with the internal temp sensor. But since it doesn't use DMA, I tried to mix it with the frdmk64f_adc16_continuous_edma sample. The mix was not only a copy-paste mix since I'm using the config tool and most of the names won't coincide. I did an analysis of the frdmk64f_adc16_continuous_edma project and added the necessary code and configurations to my project to be consistent with what is being done.

The frdmk64f_adc16_continuous_edma and twrk60d100m_demo_apps_adc16_low_power projects work wonderfully separately, the former on an FRDMK64F board and the later on my MK10 custom board, with no problems at all. I have analyzed both to get familiar with them and I know how they work, but my project with the mix of both on the custom MK10 doesn't.

I have a place in the code where I do this:

    uint32_t adcr_bg = 0; /*! ADC value of BANDGAP */
    uint32_t vdd = 0;     /*! VDD in mV */
    pmc_bandgap_buffer_config_t pmcBandgapConfig;

    pmcBandgapConfig.enable = true;
    PMC_ConfigureBandgapBuffer(PMC, &pmcBandgapConfig);

    adc_clear();

    /* Set the channel to convert by ADC0 to bandgap */
    ADC16_SetChannelConfig(ADC0_PERIPHERAL, ADC0_CH0_CONTROL_GROUP, &adc0_channelsConfig[0]);

    /* Wait for the conversion to be done */
    //WDOG_Refresh(WATCHDOG_PERIPHERAL);
    while (!adc0_val_dma_transfer_rdy);

    /* Clear the flag */
    adc0_val_dma_transfer_rdy = false;

    /* Get current ADC BANDGAP value */
    adcr_bg = adc0_val;

 

That is the part where I'm trying to measure the internal bandgap to calibrate the internal temp sensor. Since I have configured the DMA, I expect the code to hit the adcr_bg = adc0_val; line with the ADC0 value already in adc0_val and placed there by the DMA.

The problem is that the code gets stuck in while (!adc0_val_dma_transfer_rdy); because the solution is not working.

I don't really know what is going on. If you care to please download and import the attached project to your MCUXpresso 11.3.0 you can see how I configured the project.

I can post more details of the code here if you don't want to download the project. I just didn't want to post all the code here and make this a very long post.

The ADC0 and DMA seem to be configured correctly, but I don't know. I have even copied the code from my project to the FRDMK64F and it works there!! So I don't really know what's going on.

1 Solution
922 Views
danielchen
NXP TechSupport
NXP TechSupport
0 Kudos
1 Reply
923 Views
danielchen
NXP TechSupport
NXP TechSupport

 

Glad to hear that this issue is resolved from below post.

https://community.nxp.com/t5/Kinetis-Microcontrollers/I-found-a-bug-on-the-DMA-code-for-the-MK10-fam...

 

Regards

Daniel

0 Kudos