Hi,
I have K60F120M tower board.
I have issues with ISR event callback problem and want to remove the DMA controller and regenerate through PE. But after I removed DMA controller, I couldn't put it back as the same as before. I copied back the saved version, but The order of the channels in the Property page (attached) is not Chan 0 to Chan 3.
which creates a huge problem for me after PE generated code.
All channel numbers are reassigned into a different number, e.g. DMACH1 should be DMA1_STATIC_CHANNEL_1, but it reassigned to DMA1_STATIC_CHANNEL_3 even the Channel is chan 1 in the DMA1 controller as shown above.
The green line is new code generated by PE and the red line is removed/changed from previously generated code.
How to fix it?
Thank you,
David Zhou
Solved! Go to Solution.
Hello David,
This is just one logical channel, not the actual physical channel.
It meaning, this is just stand for the sequence of configure the DMA channel,
for example , we add three channel , at start , in turn to configuration : DMACH1 ,2, 3,then
from the DMACHx.c file , we can see they are in turn :
If then you change one , for example the component of DMACH2, we will see that ,
in the DMACH2.C file , the logical channel number become 2, not 1 , while in the DMACH3.C file ,
is "DMA1_STATIC_CHANNEL_1, ", the reason is we last configure the DMACH2, so the his logical nummber
is the last :
While it doesn't matter , the actual channel control is at the DMA1.C FILE :
they are one to one correspondence.
If you think this is confused , i recommend you if change one channles configure, you can from the first one ,then change all of them one by one , only need change one place on each channel, for the do not need changed
channel , you change it to other , then change it back .
Hope it hleps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello David,
Yes, i also think so with you , hope the next version of PE can fix this problem.
Sorry for the inconvenient to you .
BR
Alice
Hello David,
You can change the Channel settings for chan 3 to chan 1, then generate code to have a try.
If still can not work well , please tell me which IDE do you use , and which DMA component ,
please take a screenshot . Then you'd better how to reproduce your error , i will check on
my side .
Hope it helps
Alice
Hi Alice,
Those parameters are not editable. They are fixed.
Is there any way to enable for editing?
Thank you,
David Zhou
Hi David,,
Send your project to me , or take a screenshot about which DMA component do you add.
BR
Alice
Hi Alice,
The screen dump of PE compoents: (This is before generating code)
After regenerating code: ( - Red Code Lines are removed, and + Green Code Lines are added into the new code) (Screen Dump From GIT)
From DMA1_DevConst, Channel 0 is changed from (DMA_Channel_0) (- Red Line ) to Channel 0 (DMA_Channel 2) ( Green Line), and so on.
In AD1_DMA0.c, before regenerating, the ChInit data has DMA1_STATIC_CHANNEL_0, but now it is DMA1_STATIC_CHANNEL_2
and for other channels in DMACH1, DMACH2, etc.
Now I have to manually make changes, for example, if I want to enable interrupt for a DMA channel, which was disabled.
I have also zipped my bsp_ project. I cannot attach to this thread. May I send it to you by email?
Thank you,
David Zhou
Hello David,
About the DMA channel configuration , please configure the component of "DMAChannel_LDD":
Not on the DMAConroller.
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Alice,
All DMA_Channels in DMALDD_Components are selected with correct channel numbers:
For example DMA_Channel3 is selected as DMA_Channel3:
But generated channel number changed from CHANNEL3 to CHANNEL1 for DMACH3
Thanks,
David Zhou
Hello David,
This is just one logical channel, not the actual physical channel.
It meaning, this is just stand for the sequence of configure the DMA channel,
for example , we add three channel , at start , in turn to configuration : DMACH1 ,2, 3,then
from the DMACHx.c file , we can see they are in turn :
If then you change one , for example the component of DMACH2, we will see that ,
in the DMACH2.C file , the logical channel number become 2, not 1 , while in the DMACH3.C file ,
is "DMA1_STATIC_CHANNEL_1, ", the reason is we last configure the DMACH2, so the his logical nummber
is the last :
While it doesn't matter , the actual channel control is at the DMA1.C FILE :
they are one to one correspondence.
If you think this is confused , i recommend you if change one channles configure, you can from the first one ,then change all of them one by one , only need change one place on each channel, for the do not need changed
channel , you change it to other , then change it back .
Hope it hleps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Alice,
Thank you for your input.
I think if the program only uses the code generated by PE, this is OK and it will work. I know these numbers are logical. But if logical matches physical will be less confusion and less prone to error/bugs, because if the code is modified and using the macros, such as DMA_TCD1_CS,
pDMA->SERQ = DMA_SERQ_SERQ(DMA_CHANNEL1);
then all these codes need to be modified again. The logical numbers are shuffled by PE. I think I need to make such modifications for my customized code.
Thank you for your support.
David Zhou