I have a question about mpc5744p dma.
I have implemented pwm-ctu-adc-dma and the source address of the destination address comes in well. However, when I declare the value read by dma to another function such as ctu interrupt or pit interrupt, the value becomes 0. What is the reason?
AIPS has already been set up. Do I need to set up additional? The system clock is composed of 200MHz.
Solved! Go to Solution.
Hi,
You must probably go trough reference manual few more times to understand invalidation of cache and SMPU unit.
I will attach example code for demonstration.
Peter
Thank you, Peter.
I checked with the example code you gave me, and it was nice to know a lot. Thanks.
However, even though reading the value of adc_CDATA through dma, the value is read as 0 when declared as a variable. I want to use it by reading it as a variable. what should i do?
Hi Peter
I use the s32 compiler and the example file you gave uses the Greenhills compiler.
Can I give it back to the s32 compiler if I keep getting an error?
Yes,
you can use it in S32, just rewrite the assembly code for your compiler.
I am not working with S32 compiler, but code modify should be quite simple.
Or for the test you can just load my compiled *elf file into micro via debugger.
Peter
Hi, peter!
My question is related to mpc5744p dma.
When reading a variable named adc_1_ch0 with dma, it comes to dma destination address (adcresult [2]) on trace32. However, when the dma variable (adc1) is read from another function (ex, ctu interrupt, main), the value of the variable is read as 0.
[summary]
adc = adc_1_ch0_CDATA // normal mode setting
adcResult [2] = dma_0_TCD [16] destination //
adc1 = adcresult [2]; // This variable is always read as 0, I do not know why
I'd appreciate it if you could tell me why.
Attach the following file.
Hi,
This looks like a problem with cache.
Make sure you are not using cache in memory area where DMA is writing/reading.
The data are physically there but your debugger are reading them from cache and not from memory itself.
So make memory area which is used by DMA cache inhibited.
For more details refer to SPMU periphery chapter.
Peter
Thank you, Peter.
I had a bad time, but I knew where to look at the manual!
As you can tell, I found part of a DMA Cathe inhibited in the SMPU module. and i configurated it
But the result is the same.
* SMPU_0.RGD [2] .WORD3.B.CI = 1; // Local master ID (DMA = 2)
Is this the right setting?*
Hi,
I was able to run you program.
Your DMA init must be wrong as program wasn't copying data from ADC to RAM on ADC conversion done event.
I have skip your DMA init and configured DMA in debugger as follows:
Below you can see the memory after I have started ADC conversion. ADC result data was copied by DMA to RAM.
I will try to find the issue in your DMA TCD setting tomorrow.
However your DMAMUX is correct.
Peter
Hi,
Could you please explain it once again and clearly?
I am not able to understand from your description where is the issue.
Peter