Repetitive ADC and ISR chain not working

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

cross mob
lock attach
Attachments are accessible only for community members.
Sparky
Level 1
Level 1
First reply posted First question asked Welcome!

Hi,

I've been trying to make a hardware based boost converter using PSOC5 but it isn't working. I have attached a picture of my hardware configuration.

Hardware configuration.PNG

The PWM's period is 21.333us and the listed sampling rate of the ADC is 100000, giving the system about 10us of time for the system to complete the DMA and trigger the interrupt along with running a few lines of code. However using the debugger the interrupt runs either only once or not at all. I know it at least has been set up properly because it can be triggered.

I have attached the project below and am hoping someone might have insight as to why it is not repeatedly triggering.

Any help would be appreciated

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Sparky,

Thanks for uploading your project.

I have replicated your results.  I found the issue.

It is a 1-line code fix.

In main() your line 49:

 

CyDmaTdSetConfiguration(DMA_TD[0], 1, DMA_DISABLE_TD, ADC_GET_DMA__TD_TERMOUT_EN | TD_INC_DST_ADR);

 

The issues:

DMA_DISABLE_TD automatically terminates the DMA and disable it.  

Even if the TD were not disabled, TD_INC_DST_ADR will increment the DMA destination address.   You allowed ONLY one RAM location (adc_reading) and not an array.  You don't want to increment the destination address.

Make the following changes to line 49:

 

CyDmaTdSetConfiguration(DMA_TD[0], 1, DMA_TD[0], ADC_GET_DMA__TD_TERMOUT_EN); 

 

Making these changes have allowed the DMA_ISR to be issued immediately following the DMA operation.

One additional note:

In main.c, your line 33 has

 

#include "DMA_ISR.c"

 

The included "project.h" already includes "DMA_ISR.h"

Also you don't want to include the .c file.

 

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
2 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Sparky,

Thanks for uploading your project.

I have replicated your results.  I found the issue.

It is a 1-line code fix.

In main() your line 49:

 

CyDmaTdSetConfiguration(DMA_TD[0], 1, DMA_DISABLE_TD, ADC_GET_DMA__TD_TERMOUT_EN | TD_INC_DST_ADR);

 

The issues:

DMA_DISABLE_TD automatically terminates the DMA and disable it.  

Even if the TD were not disabled, TD_INC_DST_ADR will increment the DMA destination address.   You allowed ONLY one RAM location (adc_reading) and not an array.  You don't want to increment the destination address.

Make the following changes to line 49:

 

CyDmaTdSetConfiguration(DMA_TD[0], 1, DMA_TD[0], ADC_GET_DMA__TD_TERMOUT_EN); 

 

Making these changes have allowed the DMA_ISR to be issued immediately following the DMA operation.

One additional note:

In main.c, your line 33 has

 

#include "DMA_ISR.c"

 

The included "project.h" already includes "DMA_ISR.h"

Also you don't want to include the .c file.

 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Thank you.

After double checking the DMA documentation I did find the problem as well.

0 Likes