********************************************************************************
* Detailed Description:
*
* This example shows how to use the back-to-back mode of the PDB to trigger
* sequence of ADC channels conversion. 4 PDB channel pre-triggers/triggers are
* generated upon single PDB SW trigger. The first trigger is started by the PDB,
* no delay is used. Next 3 triggers start after corresponding acknowledgment is
* received from ADC.
*
* DMA is configured to read the ADC result registers.
* Within DMA major interrupt the new conversion scan is started via PDB SW request.
*
* Converted data is used to change color of the EVB led based on Trimmer position.
*
* ------------------------------------------------------------------------------
* Test HW: FRDM-S32K144
* MCU: PS32K144HFVLL 0N77P
* Fsys: 160MHz
* Debugger: S32DS
* Target: internal_FLASH
*
********************************************************************************
Is DMA triggered after each of 4 channels conversion is completed or after all four conversions?
Never mind. I figure it out.
the DMA function does not work corrcetly in my S32 DS enviroment?
Hello , the sample can not run normal ,after the DMA0 Clock enabled it will stop at :
DefaultISR:
b DefaultISR
could you give some help for this
I am also same symptom , it was stop at below DMA0 Clock enable line.
PCC->PCCn[PCC_DMA0_INDEX] |= PCC_PCCn_CGC_MASK; // CGC=1: Clock enabled for DMA0
I had the same problem.
If you use this project then comment the enable clock line of the DMA.
//PCC->PCCn[PCC_DMA0_INDEX] |= PCC_PCCn_CGC_MASK; // CGC=1: Clock enabled for DMA0
If you make a new project then you will need to enable the clock with a other code line. To enable the DMA clock write:
SIM->PLATCGC |= SIM_PLATCGC_CGCDMA_MASK; //Enable clock DMA
To let the project work do you still need to change the register of the DMAMUX_CHCFG. This needs to be:
DMAMUX->CHCFG[0] |= DMAMUX_CHCFG_SOURCE(42); // ADC0 COCO is the source of the DMA0 channel
Hello, I am trying to get my ADC results from R[0] assigned to a variable by using DMA. This code is not working for me.
Can you please tell me where can I find the list of sources for the DMAMUX_CHCFG? In other words, where did you find the source number is 42?
I found it in the attached file (DMA Interrupt mapping) from the Reference manual.
Thanks! I want to use this code in a new project. I followed your instructions, but while building the project using this code, I get an error in IRQs_Init() method. Without this, the DMA doesn't work. Basically, I want to read analog signals from 2 different pins and transfer the ADC result to an array/variable via DMA. Is there a fix for this?
TIA.
In this code is the interrupt line written with FSL_NVIC.
With a new project should it be S32_NVIC.
Then it should work.
Thanks for the help. The code works now, I have 4 ADC channels passing the digital values from ADC result registers to the results array. The values also show up correctly.
I've run into another issue, I wanted to use the DMA in the first place for a faster rate. But it seems like the graph that I could plot WITHOUT using the DMA was better.
As you can see from this thread: https://community.nxp.com/thread/497208
Is there some clocking issue or something? Because I didn't change any codes in my ADC or PDB methods, just using DMA to get the results in the results array.
I don't know how the graph looks now. But it could be that you miss a sample because the PDB is restarted after the DMA is done with the data transfer. But i don't know how to fix this, sorry.
The link of the example is broken: Example-S32K144-PDB-ADC_backtoback-DMA-ISR-v1_0-S32DS.zip