Page 1
Direct Digital Synthesis on the Intel® Quark™ microcontroller D1000 White Paper October 2015 Document Number: 332917–001US
Page 2
You may not use or facilitate the use of this document in connection with any infringement or other legal analysis concerning Intel products described herein. You agree to grant Intel a non-exclusive,...
Page 3
Contents 1 Abstract ........................................................................................................... 5 2 Introduction ..........................................................
Page 4
Revision History Date Revision Description October 2015 001 Initial release. Direct Digital Synthesis on the Intel® Quark™ microcontroller D1000 White Paper October 2015 4 Document Number: 332917–001U...
Page 5
1 Abstract Microcontrollers are often required to produce an analog output signal modulated by an analog input signal. The Intel® Quark™ D1000 has an integrated ADC with which to sample analog input s...
Page 6
2 Introduction A pulse width modulated (PWM) signal is a rectangular wave with fixed frequency and varying pulse width. PWMs have many uses. This paper shows how a PWM can be used as a digital to anal...
Page 7
Figure 1. Stem Plot of the DFT of a 64 Hz 25% Pulse Width Rectangular Wave of Unity Amplitude1 Plot of 64 Hz 25% Duty Cycle Rectangular Wave |X DFT of 64 Hz 25% Duty Cycle Rectangular Wave f (Hz) 1 No...
Page 8
Figure 2. Stem Plot of the DFT of a 64 Hz 50% Pulse Width Rectangular Wave of Unity Amplitude2 Plot of 64 Hz 50% Duty Cycle Rectangular Wave |X DFT of 64 Hz 50% Duty Cycle Rectangular Wave f (Hz) 2 No...
Page 9
Figure 3. Stem Plot of the DFT of a 64 Hz 75% Pulse Width Rectangular Wave of Unity Amplitude3 Plot of 64 Hz 75% Duty Cycle Rectangular Wave |X DFT of 64 Hz 75% Duty Cycle Rectangular Wave f (Hz) Pass...
Page 10
3 Methods The requirements of the sine wave generator in this example are as follows: Frequency: 0 – 1200 Hz w/ ≤ 2.5 Hz resolution Amplitude: 0 – 1 V w/ ≤ 2.5 m V resolution Total harmonic dist...
Page 11
3.1 PWM Periodic Rate The Intel® Quark™ microcontroller D1000 does not have PWM hardware, so this application implements PWM in software using timer interrupts. Interrupt latency can vary a few CPU cl...
Page 12
Figure 5. 2-pole Salan-Key LPF R2R1 VO C2 Cascading two of the 2-pole Salan-Key filters designed above yields a 4-pole 3-octave stop band attenuation approaching 4 6 d B 72 d B. Since the pass band fr...
Page 13
Figure 6. LTSpice* Test Bench for a PWM-LPF DAC Using the Linear Technology* LTC1563-3 Filter Chip PWM Model Figure 7. Plot of PWM Output in Blue and LPF Output in Green Direct Digital Synthesis on th...
Page 14
Figure 8. Spectrum of LPF Output Showing 60 d B Stop Band Attenuation at 10 k Hz 3.3 Sine Lookup Table The sine lookup table contains the output of the function sin(𝜃𝑛) where 𝜃𝑛 Δ𝑖 is the accumul...
Page 15
Choosing 8-bit values gives 255 positive quantization levels, 255 negative quantization levels, and zero for a total of 511 quantization levels or 𝑄 511⁄ . Table entries were generated using the foll...
Page 16
// loop forever while (1) { // halt and wait for interrupt __asm__("hlt"); // get frequency and amplitude controls from ADC if (T1_CTL_REG.f.ENABLE == 0) { AD_CMD.f = (AD_CMD_bits_s) { .W = ...
Page 17
// PWM high unsigned int amplitude = WAVE_MAX; void pwm_high(void) { //declare local variables unsigned int sin_index; // index into sinwave LUT unsigned int sin_value; // sinwave value at current pha...
Page 18
The following callback executes at the end of the PWM pulse width. First, the GPIO pin is driven low. This minimizes the delay between timer 1 interrupt and end of PWM pulse. Next, the phase accumulat...
Page 19
4 Results A synthesized 1200 Hz sine wave is shown in Figure 9. The PWM duty cycle in green can be seen varying periodically from low to high. The resulting LPF output in blue is a visibly pure sine w...
Page 20
Figure 9. Waveforms for 1200 Hz Sine wave with PWM Output in Green, LPF Output in Blue and Core Current in Red Direct Digital Synthesis on the Intel® Quark™ microcontroller D1000 White Paper October 2...
Page 21
At the other end of the spectrum, a 5 Hz sine wave is shown in Figure 10. Again, the LPF output is a visibly pure sine wave with 1 V peak amplitude. Note that while a 5 Hz sine wave is demonstrated, t...
Page 22
Figure 11 shows the maximum PWM duty cycle of ~93%. The PWM period and pulse width timer interrupts nearly run together, making higher duty cycles impossible. Figure 12 shows the minimum PWM duty cycl...
Page 23
Figure 12. Waveforms Showing Minimum PWM Duty Cycle in Green, LPF Output in Blue and Core Current in Red It is apparent from the core current waveforms in red that the total time for the CPU to servic...
Page 24
An example of amplitude modulation is shown in Figure 13 where the amplitude of the output 1200 Hz sine wave in blue is modulated by a 40 Hz sine wave in yellow applied to the amplitude control input....
Page 25
An example of frequency modulation is shown in Figure 14 where the frequency of the output sine wave is modulated by an exponential decay curve in yellow applied to the frequency control input. The at...
Page 26
5 Discussion While these methods yielded exceptional results, there are some practical limitations. The ratio between the PWM periodic rate and the timer clock rate determines the amplitude programm...
Page 27
6 Conclusion This paper demonstrated a direct digital synthesizer to produce sine waves with time varying amplitude ranging from 0 to 1 V and time varying frequency ranging from 0 to 1200 Hz. This DDS...