looks like setting "Initialization->Half complete" to Enabled does not OR in DMA_CSR_INTHALF_MASK as it should.
已解决! 转到解答。
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 code4)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) 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 |
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 code4)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) 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 |