Half Complete flag bug in DMAChannel_LDD

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Half Complete flag bug in DMAChannel_LDD

ソリューションへジャンプ
1,694件の閲覧回数
bowerymarc
Contributor V

looks like setting "Initialization->Half complete" to Enabled does not OR in DMA_CSR_INTHALF_MASK as it should.

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
1,342件の閲覧回数
Petr_H
NXP Employee
NXP Employee

Hi,

Yes, we confirm that it's a bug, this option doesn't work properly. We are working on the fix for the next release.

We are sorry for an inconvenience. For now, the following workaround can be applied:

1) Set properties according to your request.
2) Enable GetTransferCompleteStatus() method generation.
3) Generate code

4)Disable generation of DMAChannel_LDD and DMAController components using the context (pop-up) menu option Code geration > Don't Write Generated Code Modules.

5) Open DMACH1.c generated  by DMAChannnel_LDD component

6) Find DMA1_TChnInit const DMACH1_ChInit structure and
    add DMA_CSR_INTHALF_MASK constant to the  TCD_CSR register initial value item.
    (see attached picture)

7) Open DMA1.c generated by DMAController component.

8) Find static void HandleInterrupt(DMA1_TChnDevData *ChnDevDataPtr) and
    add following code after last "} else {" statement: (see attached picture)

    DMA1__ClearChannelInterruptFlag(DmaMemMapPtr, ChnDevConstPtr->PhyChnNum);
    if (ChnDevDataPtr->Events.OnCompleteFnPtr != NULL) {
      ChnDevDataPtr->Events.OnCompleteFnPtr(ChnDevDataPtr->UserDataPtr);
    }

9) In DMACH1_OnComplete() event you can use following code in order to distinguish "Full complete" and "Half complete" event.

void DMACH1_OnComplete(LDD_TUserData *UserDataPtr)
{
  if (DMACH1_GetTransferCompleteStatus(hDmaChn) == FALSE) {
    /* FullComplete = FALSE;    HalfComplete = TRUE;  */
  } else {
    /* FullComplete = TRUE;    HalfComplete = FALSE;  */
  }
}

Note: If interrupts are disabled or your code doesn't handle OnComplete event before all data are transferred by DMA peripheral, OnComplete event will be invoked only once and GetTransferCompleteStatus() called from this event will always return TRUE = "Full complete".

Best regards

Petr Hradsky

Processor Expert Support Team

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,342件の閲覧回数
scottm
Senior Contributor II

It's been 3 years and the component doesn't seem to be fixed yet.  Was there a release that I missed?  I'm running CW 10.7, and the component shows up as version 01.051.

Thanks,

Scott

0 件の賞賛
返信
1,343件の閲覧回数
Petr_H
NXP Employee
NXP Employee

Hi,

Yes, we confirm that it's a bug, this option doesn't work properly. We are working on the fix for the next release.

We are sorry for an inconvenience. For now, the following workaround can be applied:

1) Set properties according to your request.
2) Enable GetTransferCompleteStatus() method generation.
3) Generate code

4)Disable generation of DMAChannel_LDD and DMAController components using the context (pop-up) menu option Code geration > Don't Write Generated Code Modules.

5) Open DMACH1.c generated  by DMAChannnel_LDD component

6) Find DMA1_TChnInit const DMACH1_ChInit structure and
    add DMA_CSR_INTHALF_MASK constant to the  TCD_CSR register initial value item.
    (see attached picture)

7) Open DMA1.c generated by DMAController component.

8) Find static void HandleInterrupt(DMA1_TChnDevData *ChnDevDataPtr) and
    add following code after last "} else {" statement: (see attached picture)

    DMA1__ClearChannelInterruptFlag(DmaMemMapPtr, ChnDevConstPtr->PhyChnNum);
    if (ChnDevDataPtr->Events.OnCompleteFnPtr != NULL) {
      ChnDevDataPtr->Events.OnCompleteFnPtr(ChnDevDataPtr->UserDataPtr);
    }

9) In DMACH1_OnComplete() event you can use following code in order to distinguish "Full complete" and "Half complete" event.

void DMACH1_OnComplete(LDD_TUserData *UserDataPtr)
{
  if (DMACH1_GetTransferCompleteStatus(hDmaChn) == FALSE) {
    /* FullComplete = FALSE;    HalfComplete = TRUE;  */
  } else {
    /* FullComplete = TRUE;    HalfComplete = FALSE;  */
  }
}

Note: If interrupts are disabled or your code doesn't handle OnComplete event before all data are transferred by DMA peripheral, OnComplete event will be invoked only once and GetTransferCompleteStatus() called from this event will always return TRUE = "Full complete".

Best regards

Petr Hradsky

Processor Expert Support Team

0 件の賞賛
返信
1,342件の閲覧回数
bowerymarc
Contributor V

Thanks Petr for verifying.

You forgot to attach the picture...

0 件の賞賛
返信
1,342件の閲覧回数
Petr_H
NXP Employee
NXP Employee

I'm sorry, you are right, here it is:

DMA_HalfComplete_Fix.jpg

 

Best regards

Petr Hradsky

Processor Expert Support Team

0 件の賞賛
返信