MPC5744P DMA QUESTION!!

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

MPC5744P DMA QUESTION!!

Jump to solution
2,463 Views
taejunmoon
Contributor I

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.

Labels (1)
0 Kudos
Reply
1 Solution
2,087 Views
petervlna
NXP TechSupport
NXP TechSupport

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

View solution in original post

0 Kudos
Reply
11 Replies
2,087 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

I have created example according to your needs.

Everything is working as expected.

Data from ADC_1 Ch0 are copied by DMA to SRAM.

Peter

0 Kudos
Reply
2,087 Views
taejunmoon
Contributor I

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?

0 Kudos
Reply
2,088 Views
petervlna
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
2,087 Views
taejunmoon
Contributor I

캡처22.PNGHi 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?

0 Kudos
Reply
2,087 Views
petervlna
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
2,087 Views
taejunmoon
Contributor I

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.

5744p_dma.PNG


[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.

0 Kudos
Reply
2,087 Views
petervlna
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
2,087 Views
taejunmoon
Contributor I

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?*

0 Kudos
Reply
2,087 Views
petervlna
NXP TechSupport
NXP TechSupport

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:

pastedImage_1.png

Below you can see the memory after I have started ADC conversion. ADC result data was copied by DMA to RAM.

pastedImage_2.png

I will try to find the issue in your DMA TCD setting tomorrow.

However your DMAMUX is correct.

Peter

0 Kudos
Reply
2,087 Views
taejunmoon
Contributor I
Thank you. Peter,

The MPC5744p and MPC5643l and register configurations are similar, so I configured the mpc5643l exactly the same. The 5643l is running properly. The variable adc1 contains the values read as dma.
So I'm comparing the two of them, but I do not know why not.
Could this be helpful?
0 Kudos
Reply
2,087 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

Could you please explain it once again and clearly?

I am not able to understand from your description where is the issue.

Peter

0 Kudos
Reply