- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using PSoC5 LP, and I need PWM to reconstruct an analogue signal from some data.
My question is, how can I increase PWM's frequency and at the same time having a 16-bit resolution ?
I have set BUS_CLOCK to 43MHz as indicated in the datasheet, for the maximum of clock frequency of 16-bit PWM.
As what I have understood, my PWM frequency is now 1/1.524ms = 656Hz ? which according to internet, is not sufficient, I would need it to be at least 20kHz.
I don't actually understand how does PWM function, but as what I have read from the internet, I should set PWM's frequency to the highest frequency possible and at the output of PWM I should have a low-pass filter at 10Hz to get the average value of my duty cycle.
I need a resolution of 16 bits because the value of the signal that I want to reconstruct varies from 0 to 65535.
Anyone has any idea of what I should do ? or is it just not realistic ?
Solved! Go to Solution.
- Labels:
-
PSOC5 LP MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
KahHou,
You are correct. With 43 MHz as the input clock to the PWM and 65535 as the period, the maximum supported frequency is 656 Hz. (43,000,000/65536 = 656).
The PWM cannot achieve the desired 20 KHz maximum frequency.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
KahHou,
You are correct. With 43 MHz as the input clock to the PWM and 65535 as the period, the maximum supported frequency is 656 Hz. (43,000,000/65536 = 656).
The PWM cannot achieve the desired 20 KHz maximum frequency.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
KahHow,
One possibility to achieve higher resolution DAC with fast response time is to use a Fractional PWM. You can find an example project using PSoC5 here:
Building a 16-bit PWM DAC out of 8-bit Fractional PWM and DeltaSigma Modulator
The idea behind Fractional PWM is to use 8-bit PWM, which duty cycle is being switched fast between (MSB) and (MSB+1) positions, providing averaged value. The Delta-Sigma Modulator provides fastest switching between two positions, serving the LSB for 16-bit value. Unlike 16-bits PWM, the main lobe will be at frequency 48MHz / 2^8 = 187.5 kHz, which is acceptable for some audio applications. It is also easy to filter out such high frequency using simple RC filters. Higher order filter (2-5) is recommended.
As usual, PWM DAC approach has other quirks. For example, output accuracy depends on PSoC Vdd stability. I recommend further reading about PWM DACs here:
http://www.openmusiclabs.com/learning/digital/pwm-dac.1.html
/odissey1