cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable
        Hello, I am using a WaveDAC8 to generate a low frequency tone. It is using a PWM as an external clock source. This allows me to vary the frequency of the tone by changing the PWM period. When I stop the PWM I want to set the WaveDAC output to a predetermined value. I assumed SetValue would accomplish this, but with the clock stopped, the output stays at whatever the last value of the waveform was. SetValue has no effect. What am I doing wrong?   
0 Likes
1 Solution
RaAl_264636
Contributor II

Hi Beartooth,

   

 

   

according to the WaveDAC datasheet the clock should be stopped when using SetValue(), so this approach is correct.

   

I also read the clock component datasheet, which states that if the Clock_Stop() function is used, the clock signal output will be low.

   

Which signal does your PWM signal have when you stop it? Maybe it would be a good idea to temporarily replace the PWM with a clock component and test if the SetValue() works when using the clock component.

   

 

   

Regards,

   

 

   

Ralf

View solution in original post

0 Likes
9 Replies
RaAl_264636
Contributor II

Hi Beartooth,

   

 

   

according to the WaveDAC datasheet the clock should be stopped when using SetValue(), so this approach is correct.

   

I also read the clock component datasheet, which states that if the Clock_Stop() function is used, the clock signal output will be low.

   

Which signal does your PWM signal have when you stop it? Maybe it would be a good idea to temporarily replace the PWM with a clock component and test if the SetValue() works when using the clock component.

   

 

   

Regards,

   

 

   

Ralf

View solution in original post

0 Likes
Anonymous
Not applicable
        This is crazy... If I use a "Logic 0" component as the clock source, SetValue works. If I put an AND gate between the PWM output and the clock source, feeding one input the PWM signal and the other, a CTL_REG signal. SetValue does not work. If I drive the WaveDAC directly with the PWM output and I use a CTL_REG to control the PWM reset signal, which when set high, should cause the PWM output to go to 0...SetValue still does not work.. In all these cases the waveform works fine when I allow the PWM output to toggle. Stopping a clock signal and using SetValue to set the output to a static level does not work. My next idea is to create 1 byte length array that contains the value I want and to point the wave dac DMAs to it using WaveDAC8_Wave1Setup(uint8 *WavePtr, uint16 SampleSize). I'll post my results. I am convinced there is a bug in the component SetValue function.   
0 Likes
HeLi_263931
Honored Contributor II

An additional note: you can also use a clock component, since its divider can be configured at runtime too. There is no need to use the PWM.

Anonymous
Not applicable
        Well that accomplishes my goal. Its a bit of a cludgey work around since it requires the use of DMA resources just to make the DAC hold a static output. I wonder if any Cypress people are aware of this bug. And recommend they test it out and fix it. Good luck. Kevin   
0 Likes
Anonymous
Not applicable
        Hli, interesting I didn't realize the divider of a Clock component could be configured at runtime, that's why I was using the PWM. If it is possible with a clock component. I'll check it out, that sounds like a much cleaner solution. Thank you very much. I'll give it a shot.   
0 Likes
Anonymous
Not applicable
        Hli....Nope it does now wrk with a clock component either. There is definitely a bug with SetValue... The only way I can get it to work is to use a Logic 0 component. Stoping a clock component, has the exact same effect as the PWM did. I'm going back to the 1 Byte array technique, that's the only way I can make it work.   
0 Likes
ETRO_SSN583
Esteemed Contributor

This may be a bug, consider filing a case, and point back to this

   

thread.

   

 

   

    

   

          

   

To create a technical case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
RaAl_264636
Contributor II

Hi,

   

 

   

since I'm now running myself into this issue, I've created a support case about this.

   

 

   

Viewing the WaveDAC internal schematic shows that the VDAC components strobe mode is set to 'external', which implies that a strobe pulse is needed to put the register value to the output.

   

I've suggested Cypress to temporarily switch to 'register write' mode for the SetValue() function prior to writing the value to the DAC, so it would be independent from the attached (possible slow) external clock pulses. I'll report back if Cypress considers this as a real bug.

   

 

   

Regards,

   

 

   

Ralf

0 Likes
RaAl_264636
Contributor II

Here's the update:

   

Cypress verified the behaviour. I assume there'll be an corrected API on the next WaveDAC component update.

   

As a temporary workaround, you can use this code snippet after disabling the WaveDAC clock source:

   


uint8_t CtrlReg; CtrlReg = WaveDAC8_1_VDAC8_Strobe; //save current strobe register value

   

WaveDAC8_1_VDAC8_Strobe &= WaveDAC8_1_VDAC8_STRB_MASK; //select bus write as strobe input

   

WaveDAC8_1_SetValue(x); //set wave DAC output to 'x'

   

WaveDAC8_1_VDAC8_Strobe = CtrlReg; //restore strobe register
 

   

Regards,

   

 

   

Ralf

0 Likes