DMA problem

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.
Anonymous
Not applicable

Hi Everyone!

I'm using PSOC creator 4.2 and PSOC programmer 3.27.3 for 2-3 weeks. So

My input converter is ADC_DelSig (16bit)  and my output converter is VDAC8 (8bit) so im the trying to do if my input is 2^16 I want to see

on LCD my output is 2^8 and I should take 4.080V from analog output pin I'm doing all this if my output 2^8 my output voltage is 4.08 and my output is 0 my output voltage

is 0 but not stable when my input is 2^16 output should be 2^8 but everytime turning in the loop such as my input were 24536 output is 255

than i take down my input to 24036 my output is 0 and  take down my input again  my output is going back to peak so 255  So my problem is this looks like 

my dma just taking first bite from ADC  and giving to DAC so DAC giving me 1 bite as 8 bite looks like there is no time to take all bites how can I fix this?

I will attach the file

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

my dma just taking first bite from ADC  and giving to DAC so DAC giving me 1 bite as 8 bite looks like there is no time to take all bites how can I fix this?

This is an inherent problem: the ADC delivers a 3 byte wide result in its registers, the DAC is only 1 byte wide (8 bits). So the example project you're using transmits the "middle" byte from the ADC which is correct when the resolution is set to 16 bits: Upper = 0, middle = 0 to 255 lower is skipped. So DMA delivers a result from 0 to 255 into the DAC.

I am afraid that the code in line 130: LCD_Char_1_PrintU32Number(VDAC8_1_Data_REG) may not work, use a PrintInt8().

Bob

View solution in original post

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

my dma just taking first bite from ADC  and giving to DAC so DAC giving me 1 bite as 8 bite looks like there is no time to take all bites how can I fix this?

This is an inherent problem: the ADC delivers a 3 byte wide result in its registers, the DAC is only 1 byte wide (8 bits). So the example project you're using transmits the "middle" byte from the ADC which is correct when the resolution is set to 16 bits: Upper = 0, middle = 0 to 255 lower is skipped. So DMA delivers a result from 0 to 255 into the DAC.

I am afraid that the code in line 130: LCD_Char_1_PrintU32Number(VDAC8_1_Data_REG) may not work, use a PrintInt8().

Bob

0 Likes
Anonymous
Not applicable

All you said you are ok. I understand So how can I fix it should I use 10 bit ADC and 10 bit DVDAC?

and I did as your said line 130: LCD_Char_1_PrintU32Number(VDAC8_1_Data_REG) I changed it to print Int8 it just slowed down not be stable as my wish

0 Likes

That's an approach, you may even use an 8 bit ADC and an 8 bit DAC. It all depends on what you want to perform.

Using the 8 bit configuration has a precision of < 1% which might be enough for many applications. So the question is:

What do you want to perform.

Which frequency? Every 250ms is very slow, absolutely no need for a (complicated) DMA solution.Just read an ADC result, scale it to 8 bit and send to DAC. You may use a timer component for the general timing.

Wihch precision?

Why an analog output?

What is the overall project performing?

Bob

0 Likes
Anonymous
Not applicable

My project is looks like engine control unit

I'm checking voltage,electricity 50 times per sec is enoughI guess maybe  more (100 times maybe) and at the same time I should read the

heat (degree , *C or *K)

After these I just write the code if heat going up cut the power ... bla bla  or  resistors are down (short circuit) cut the power  ... bla bla

My issue is just these

So I'm using MAX6675 for heat control

overall project is this  So idk about precision But if input be more bites  precision  will be more

(after ',' So X,nnnnnnn(if my inputs max value is 2^32 I will give max voltage from output(4,080V))) sensitive

0 Likes