Hi,
As everyone knows, a cheap DAC can be created by filtering PWM using a RC - or other - filter. The higher the PWM freq, the less time it takes for the DAC output to settle as the time constant of the filter can be reduced. It's easier to filter out the carrier if it's far away from the analogue signal we're trying to represent.
e.g. if we wanted to produce an 8-bit PCM audio signal using a 4MHz PIC STD PWM module, the PWM freq would be 4M/4/256 = 3.9KHz, which is right in the audio spectrum and a bit tough to remove (not to mention that it gives us an awfully low sampling rate for audio). If we use either of the following proposed methods, the PWM frequency is increased to 62.5kHz, which is easier to filter out (although the sampling rate will be 3.9KHz). Using a 20MHz osc increases the above rates to 19.5kHz (standard) and 312.5kHz (proposed) respectively, the latter being much easier to filter out from our audio frequency spectrum (e.g. 0-8kHz).
So why aren't the following two methods employed to provide a PWM having the same or higher resolution and frequency? What's wrong with them?
A) Dual PWM channels: most significant channel summed with attenuated less significant channel. The configuration shown in the attached circuit gives 8-bit resolution but at 16 times the frequency of the standard single channel. With a 1% error in both resistors, the worst case error is ~0.31 LSb. It suffers from needing more hardware (attenuator & perhaps buffer) and having a higher output impedance.
B) "Submodulated" PWM. A single PWM channel in the normal configuration is used, but its duty cycle is potentially updated every output cycle. e.g. using 4-bit PWM with 4-bit subsampling, the value 0xE4 might be represented by the PWM sequence (shown as 4-bit PWM hex values): E, E, E, F, E, E, E, F, E, E, E, F, E, E, E, F. The main carrier frequency will count for most of the unwanted energy, but there will also be a small amount at the sub carrier frequency (in this case it's 1/4 of the main frequency).
I actually notice that the (A) is used, see https://www.electro-tech-online.com/custompdfs/2012/08/article_pcm15_20040813.pdf, though that is the only article I found; perhaps I didn't look hard enough.
As everyone knows, a cheap DAC can be created by filtering PWM using a RC - or other - filter. The higher the PWM freq, the less time it takes for the DAC output to settle as the time constant of the filter can be reduced. It's easier to filter out the carrier if it's far away from the analogue signal we're trying to represent.
e.g. if we wanted to produce an 8-bit PCM audio signal using a 4MHz PIC STD PWM module, the PWM freq would be 4M/4/256 = 3.9KHz, which is right in the audio spectrum and a bit tough to remove (not to mention that it gives us an awfully low sampling rate for audio). If we use either of the following proposed methods, the PWM frequency is increased to 62.5kHz, which is easier to filter out (although the sampling rate will be 3.9KHz). Using a 20MHz osc increases the above rates to 19.5kHz (standard) and 312.5kHz (proposed) respectively, the latter being much easier to filter out from our audio frequency spectrum (e.g. 0-8kHz).
So why aren't the following two methods employed to provide a PWM having the same or higher resolution and frequency? What's wrong with them?
A) Dual PWM channels: most significant channel summed with attenuated less significant channel. The configuration shown in the attached circuit gives 8-bit resolution but at 16 times the frequency of the standard single channel. With a 1% error in both resistors, the worst case error is ~0.31 LSb. It suffers from needing more hardware (attenuator & perhaps buffer) and having a higher output impedance.
B) "Submodulated" PWM. A single PWM channel in the normal configuration is used, but its duty cycle is potentially updated every output cycle. e.g. using 4-bit PWM with 4-bit subsampling, the value 0xE4 might be represented by the PWM sequence (shown as 4-bit PWM hex values): E, E, E, F, E, E, E, F, E, E, E, F, E, E, E, F. The main carrier frequency will count for most of the unwanted energy, but there will also be a small amount at the sub carrier frequency (in this case it's 1/4 of the main frequency).
I actually notice that the (A) is used, see https://www.electro-tech-online.com/custompdfs/2012/08/article_pcm15_20040813.pdf, though that is the only article I found; perhaps I didn't look hard enough.