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.
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.
1 of 1 people found this helpful
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.
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
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.
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.
This may be a bug, consider filing a case, and point back to this
To create a technical case at Cypress -
“Create a Case”
You have to be registered on Cypress web site first.
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.
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