Dear NXP Support Team,
I.m trying now approach, where GPIO PTD6 has setting as EIRQ14 ,rising edge detection and I want to map this pin signal to the DMA channel, where I try get current value from PIT_1 Timer[0]. This is setup as FreeRunning.
Seems that SIUL2 is set correctly for PTDA and I can see toggling on this pin when signal (1Hz) from signal generator is connect on related MCU pin.
But DMA not working for me
My guess here is that I have problem with finding proper chain from PTD6 ->DMAMUX-> DMA channel 4. and find where exactly I can find these information.
From S32K3xx_DMAMUX_map.xlsx I got this:
OndrejK_0-1784190602227.png
so here is my first issue: Which source->request is dedicated for PTD6(EIRQ14) ?
And how is related Table 44 from RM manual?
OndrejK_1-1784190821068.png
Here is fragments of my code which I working on now:
Setup PTD6
Hi@OndrejK
"Is this meaning, that MCU have 32 TCD channels and TCD 0 to 15 is valid for DMAMUX_0 and TCD 15 to31 is for DMAMUX_1 ?"
yes, you can find these info in the datasheet, I copy it for your reference.
Senlent_0-1784272853624.png
Hi Senlent,
thank you for your answer.
please, can you pointed me from where popup your meaning about TCD mapping?
Is this meaning, that MCU have 32 TCD channels and TCD 0 to 15 is valid for DMAMUX_0 and TCD 15 to31 is
for DMAMUX_1 ?
So I'm still little bit confused about information regarding DMAMUX and eDMA.
Best regards
Ondrej
Your understanding is correct:
PTD6->EIRQ14->DMAMUX1.SOURCE 7.
IP_DMAMUX_1->CHCFG[4] = DMAMUX_CHCFG_ENBL_MASK | DMAMUX_CHCFG_SOURCE(7u); // EIRQ14 is source 7 for DMAMUX_1
However, the TDC settings are incorrect.
My understanding is that they should be as follows:
IP_DMAMUX_1->CHCFG[0] ->TCD 16
IP_DMAMUX_1->CHCFG[4] -> TCD 20 instead of TCD4
HI SenLent,
I made some changes in my code based on my observation.
Here is my latest code:
main initialization:
Hi@OndrejK
I've created a demo for your reference, using PTD6 to trigger DMA for a single data transfer.
It's based on S32K344 + RTD 7.0.1.
And I've tested it;
I can assure you that my understanding is correct.
For PTD6, the source should 7.
IP_DMAMUX_1->CHCFG[0] = DMAMUX_CHCFG_ENBL_MASK | DMAMUX_CHCFG_SOURCE(7u);
Senlent_1-1784689141057.png
Hi SenLent,
about choosing DMA channel here was my imagine that I can choose freely one from related DMA_MUX groups
Meantime I tested other DMA_MUX <->TCD combination and on my side working only next one
IP_DMAMUX_1->CHCFG[3] and TCD16.
I got try next others:
IP_DMAMUX_1->CHCFG[4] and TCD17.
IP_DMAMUX_1->CHCFG[0] and TCD16.
And please, why exactly only IP_DMAMUX_1->CHCFG[3] and TCD16. working ?
And how is the relationship between IP_DMAMUX_1->CHCFG[xx] and TCDyy ?
Hi Senlent,
thank you very match for your example.
After some changes I have working example now. I attach my adjusted project , where was one important issue:
SIUL ICU with DMA req enabling was set up before whole DMA TCD channel was fully configured. In that case TCD_SADDR and TCD_DADDR was empty(zero values) and after that enabling DMA req in SUIL leads to DMA error - "Source bus error" what bring me sense.
After change order of this initialization. example start working for me.
But I have still problem understand exact relation between DMAMUX channel and TCD channel.
You wrote that DMAMUX should by configured as CHCGF[0].
After downloading and starting app in our S32k344 custom development board i found that DMAMUX-CHCFG[3] is configured and exactly in code in function Dma_Mux_Ip_Init_Privileged is line which exactly lead to this configuration:
RegisterIndex = DMA_MUX_IP_GATE_OFFSET((pConfig->pChannelConfigArr[ChannelCount].Channel));
here is screenshot from lauterbach Trace32 debugger, where you can see final setup after all initialization steps:
OndrejK_0-1784795174339.png
In Design studio I have next configuration after updating RTD to 7.0.1:
OndrejK_1-1784795478141.png
is this correct and what does it mean that here is choice of 3 DMA Mux sources?
Hi@OndrejK
Good to hear that.
This configuration tool may cause some confusion for developers who are just getting started.
For the S32K348, there is no DMAMUX_3; only DMAMUX_0 and DMAMUX_1 exist.
•For the S32K310, S32K311, and S32K312: DMAMUX_0 channels 0–5 and DMAMUX_1 channels 0–5 are mapped to eDMA Transfer Control Descriptor (TCD) 0–5 and eDMA Transfer Control Descriptor (TCD) 6–11, respectively. Programming of DMAMUX_0 channels 6–15 and DMAMUX_1 channels 6–15 is therefore not expected; however, if programmed, any access will result in either an error response for channels 8–15 or no error response for channels 6–7.
•For the remaining S32K3xx devices: DMAMUX_0 channels 0–15 and DMAMUX_1 channels 0–15 are mapped to eDMA Transfer Control Descriptors (TCDs) 0–15 and eDMA Transfer Control Descriptors (TCDs) 16–31, respectively.
The above is taken from the data sheet, and it is easy to understand:
The “DMA Hardware Channel” corresponds to the TCD number.
When you select DMA_CHANNEL_0 ~ DMA_CHANNEL_15, DMAMUX_0 is used by default;
when you select 16–31, DMAMUX_1 is used by default.
For example, in this topic, PTD6 corresponds to Source 7 of DMAMUX_1, so “DMA Hardware Channel” can be set to any value between DMA_CHANNEL_16 and DMA_CHANNEL_31.
Let’s take another example: if you select EIRQ 7 to trigger DMA, then “Dma Hardware Channel” can be set to any value between DMA_CHANNEL_0 and DMA_CHANNEL_15.
Hi@OndrejK
Here is the right order:
IP_DMAMUX_0>CHCFG[0] and TCD0.
IP_DMAMUX_0->CHCFG[1] and TCD1.
IP_DMAMUX_0->CHCFG[2] and TCD2.
IP_DMAMUX_0->CHCFG[3] and TCD3.
IP_DMAMUX_0->CHCFG[4] and TCD4.
IP_DMAMUX_0->CHCFG[5] and TCD5.
IP_DMAMUX_0->CHCFG[6] and TCD6.
IP_DMAMUX_0->CHCFG[7] and TCD7.
IP_DMAMUX_0->CHCFG[8] and TCD8.
IP_DMAMUX_0->CHCFG[9] and TCD9.
IP_DMAMUX_0->CHCFG[10] and TCD10.
IP_DMAMUX_0->CHCFG[11] and TCD11.
IP_DMAMUX_0->CHCFG[12] and TCD12.
IP_DMAMUX_0->CHCFG[13] and TCD13.
IP_DMAMUX_0->CHCFG[14] and TCD14.
IP_DMAMUX_0->CHCFG[15] and TCD15.
IP_DMAMUX_1->CHCFG[0] and TCD16.
IP_DMAMUX_1->CHCFG[1] and TCD17.
IP_DMAMUX_1->CHCFG[2] and TCD18.
IP_DMAMUX_1->CHCFG[3] and TCD19.
IP_DMAMUX_1->CHCFG[4] and TCD20.
IP_DMAMUX_1->CHCFG[5] and TCD21.
IP_DMAMUX_1->CHCFG[6] and TCD22.
IP_DMAMUX_1->CHCFG[7] and TCD23.
IP_DMAMUX_1->CHCFG[8] and TCD24.
IP_DMAMUX_1->CHCFG[9] and TCD25.
IP_DMAMUX_1->CHCFG[10] and TCD26.
IP_DMAMUX_1->CHCFG[11] and TCD27.
IP_DMAMUX_1->CHCFG[12] and TCD28.
IP_DMAMUX_1->CHCFG[13] and TCD29.
IP_DMAMUX_1->CHCFG[14] and TCD30.
IP_DMAMUX_1->CHCFG[15] and TCD31.
Hi Senlent,
meantime I tested this same project with my other colleague , which use S32DS version 3.6.3 and Ozone debugger and his results is same as your.
Seems that you have right. but I'm completely out what's going on on my side?
Hi SenLent,
I made test on latest S32 DS project and I added more DMA_MUX configurations.
Here is screenshot of my setup:
OndrejK_0-1785138171795.png
and here is result after download build code to our board:
OndrejK_2-1785138306423.png
As you can see, your described order for assigning DMA_MUX and TCD is not followed.
Is this same bug on RTD software or ?
Hi@OndrejK
It's obvious that this might be related to the debugger you're using, or perhaps the version of the debugger.
Hi@OndrejK
This is the demo you provided; I haven't made any modifications.
These are my test results.
Senlent_0-1785142055872.png
here is my project, just adjusted latest one which I attached before
I created 2 channel on DMA_MUX_0 as DMA_Channel_0 and DMA_Channel_1.
and for these channel is assigned DMA_MUX_0->CHCFG[3] and DMA-MUX_0-CHCFG[2].
Same "mixed" order you can see on DMA_MUX_1
Hi@OndrejK
I can't see what the problem is. Could you explain it more clearly, or provide the complete test project so I can tell you where your doubts lie?
Hi SenLent,
finaly i found where is "issue" here.
Problem is that Ozone and Lauterbach just presenting different way od DMA_MUX->CHCFG and final trick is that these CHCFG register is mapped on MCU side (base adress for DMA_MUX_1 is 0x40284000) in this order:
0x40284000 ->CHCFG[3]
0x40284001 ->CHCFG[2]
0x40284002 ->CHCFG[1]
0x40284003 ->CHCFG[0]
0x40284004 ->CHCFG[7]
0x40284005 ->CHCFG[6]
0x40284006 ->CHCFG[5]
0x40284007 ->CHCFG[4]
0x40284008 ->CHCFG[11]
....
see my screenshot below
OndrejK_0-1785316902701.png
and from this moment my result give me sense and corresponding with your tips
Thank you for your support
and I guess that this ticked can be resolved
Hi@OndrejK
Good, please click "ACCEPT AS SOLUTION" to close this topic.