Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
chwa_1570756
Level 4
Level 4
25 sign-ins 25 replies posted 10 replies posted

Hi,

There are some interrupts in my project, one is DMA int, others are Timer and GPIO int, MCU can enter either of interrupt service indepently, but when MCU is running in GPIO or Timer int code, it can not respond and  enter into DMA int. I guess the issue was led by priority set, but I find the DMA interrupt was not listed in interrupt page of psoc creator IDE, and I tried to set the DMA priority to highest, it still can not work, so how can set the DMA interrupt for this case?

Chris

0 Likes
1 Solution
Ekta
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hi @chwa_1570756 

1. Once you configure the DMA to generate an interrupt on transfer completion, you can call the CyIntSetPriority(CYDMA_INTR_NUMBER, priority); function to set the priority of this interrupt from 0 to 3 (0 being the highest priority and 3 being the lowest).

2. Make sure you configure the priority of GPIO and timer less than what value you pass in the above function.

3. In your project to check if the DMA interrupts are working properly try disabling the timer and GPIO interrupt and see if the program enters the DMA interrupt. This would confirm if the DMA interrupt is configured properly.

The following is a C language example demonstrating how to define and set a callback function. This example assumes the Component has been placed in a design with the instance name “DMA”.

Callback function prototype example:
void MyIntrCallback(void);

Callback function definition example:
void MyIntrCallback(void)
{
/* Code to process the interrupt */
}

Setting callback function example:
DMA_SetInterruptCallback(&MyIntrCallback);

Interrupt enabling example:
CyIntEnable(CYDMA_INTR_NUMBER);
CyGlobalIntEnable;

When configuring software DMA that doesn’t use the DMA Component on a schematic, call CyDmaSetInterruptSourceMask() to enable interrupt generation to the CPU core.

Hope this helps

Best Regards
Ekta

View solution in original post

0 Likes
1 Reply
Ekta
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hi @chwa_1570756 

1. Once you configure the DMA to generate an interrupt on transfer completion, you can call the CyIntSetPriority(CYDMA_INTR_NUMBER, priority); function to set the priority of this interrupt from 0 to 3 (0 being the highest priority and 3 being the lowest).

2. Make sure you configure the priority of GPIO and timer less than what value you pass in the above function.

3. In your project to check if the DMA interrupts are working properly try disabling the timer and GPIO interrupt and see if the program enters the DMA interrupt. This would confirm if the DMA interrupt is configured properly.

The following is a C language example demonstrating how to define and set a callback function. This example assumes the Component has been placed in a design with the instance name “DMA”.

Callback function prototype example:
void MyIntrCallback(void);

Callback function definition example:
void MyIntrCallback(void)
{
/* Code to process the interrupt */
}

Setting callback function example:
DMA_SetInterruptCallback(&MyIntrCallback);

Interrupt enabling example:
CyIntEnable(CYDMA_INTR_NUMBER);
CyGlobalIntEnable;

When configuring software DMA that doesn’t use the DMA Component on a schematic, call CyDmaSetInterruptSourceMask() to enable interrupt generation to the CPU core.

Hope this helps

Best Regards
Ekta

0 Likes