Constantly getting an error while trying to send data from SAR to LPF via DMA?

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

cross mob
Anonymous
Not applicable

Hello Every one,

   

I am trying to send data from SAR to Filter via DMA. But i am always getting one error (see attached picture). I don't know how to solve this error.

   

 

   

Kindly guide me.

   

Looking forward for your comments

   

Best Regards

   

Awais

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When I load your project into the IDE I can get hints about definitions, compilation errors opening and closing brackets as well as parameter lists and more. Even at simple projects I can plug in a development kit and do a real debug, but that's usually not needed.

   

Incrementing the destination address is wrong for the filter...

   

 

   

Bob

   

 

   

Bob

View solution in original post

0 Likes
15 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

LO16() expects a variable name as parameter, but you only give it a type name ('uint32') (which is used for a type cast). Look at the first part of the line, where it is used correctly.

   

(And I think, out of my memory, that you want to use HI16 there)

0 Likes
Anonymous
Not applicable

Hi,

   

I have generated this code via DMA wizard. Is that ok?

   

Regards

   

Awais

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Line 79: LO16((uint32)) is rubbish. File cytypes.h is a generated file, did you change anything within?

   

For further investigation post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

Thankyou Bob for your comment. No, I did'nt change any thing.

   

I am trying to implement an example with SAR.

   

I am attaching the file. You can have a look on it.

   

Regards

   

Awais

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Change Line 79 to

   

CyDmaTdSetAddress(DMA_TD[0], LO16((uint32)ADC_SAR_1_SAR_WRK0_PTR), LO16((uint32)Filter_STAGEAH_PTR));

   


Read from filter, add 128 to the value and then send to VDAC.

   

You do not need #include <vdac.h>

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Moin Bob,

   

This is my code now. But i am still not seeing an output on oscilloscope.

   

CY_ISR(filterVDAC)
{
    
    VDAC8_SetValue(Filter_Read8(Filter_CHANNEL_A) + 128u);
}

   


int main()
{
    /* Start all components used on schematic */
    ADC_SAR_1_IRQ_Start();
    isr_StartEx(filterVDAC);
    ADC_SAR_1_Start();
    ADC_SAR_1_StartConvert();
    VDAC8_Start();

   

    Filter_Start();

   

    /* User-implemented function to set-up DMA */
    DMA_Config();

   

    /* Enable Global Interrupts */
    CYGlobalIntEnable;

   

    for(;;)
    {
    }
} /* End of main */
void DMA_Config(void)
{
   uint8 DMA_Chan;
uint8 DMA_TD[1];
/* DMA Configuration for DMA */
DMA_Chan = DMA_DmaInitialize(DMA_BYTES_PER_BURST, DMA_REQUEST_PER_BURST,
    HI16(DMA_SRC_BASE), HI16(DMA_DST_BASE));

   

DMA_TD[0] = CyDmaTdAllocate();

   

CyDmaTdSetConfiguration(DMA_TD[0],1u , CY_DMA_DISABLE_TD, TD_INC_DST_ADR);

   

CyDmaTdSetAddress(DMA_TD[0], LO16((uint32)ADC_SAR_1_SAR_WRK0_PTR), LO16((uint32)Filter_STAGEAH_PTR));
CyDmaTdSetAddress(DMA_TD[0], LO16((uint32)ADC_SAR_1_SAR_WRK0_PTR),
                      LO16((uint32)VDAC8_Data_PTR));

   

CyDmaChSetInitialTd(DMA_Chan, DMA_TD[0]);

   

CyDmaChEnable(DMA_Chan, 1);

   

}

   


/* [] END OF FILE */

   

Looking forward for your reply!

   

Awais

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

CyDmaTdSetAddress appears twice. It is always easier to check a program using the IDE, so better attach a workspace bundle than just code-snippets

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thankyou for your reply Bob. I already skip that out but still the problem is there.

0 Likes
Anonymous
Not applicable

using the IDE means through debug?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When I load your project into the IDE I can get hints about definitions, compilation errors opening and closing brackets as well as parameter lists and more. Even at simple projects I can plug in a development kit and do a real debug, but that's usually not needed.

   

Incrementing the destination address is wrong for the filter...

   

 

   

Bob

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thank you Bob for keep guiding me.

   

But i am sorry i did'nt get your point this time. I just attached my current file. Can you please have a look on it.

   

Looking forward for your comments.

   

Best Regards

   

Awais

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

That wrong register gave me some headaches!

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Moin Bob,

   

Thank you so much for your reply.

   

I want to discuss some points with you before doing further steps:

   

1. After my filter block, I want to implement an elliptical low pass filter (in software).

   

My question is : How i can tackle data coming from my filter block and after passing that data through ELPF, How i can write my final output of elliptical low pass filter (ELPF) into VDAC8 with very less delay?

   

Looking forward for your suggestions.

   

 

   

Best Regards

   

Awais

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Speed will be the problem, so keep an eye (or two) on that.

   

Change ADC sample mode to hardware signal and connect it to a timer or a clock to check out for the max. conversion rate.

   

Program your filter and some means to indicate duration of a cycle ie. toggle a pin, watch with a logic analyzer.

   

Set the build configuration from debug to release, check that compiler optimization set for speed.

   

Evaluate max speed, then change the timing for your filters accordingly.

   

 

   

Happy coding

   

Bob

0 Likes
Anonymous
Not applicable

Oh Ok,

   

I will work on it and will let you know.

   

Thankyou Bob once again.

   

Have a nice weekend 🙂

   

Regards

   

Awais

0 Likes