Please consider registering

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —


— Match —


— Forum Options —


Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Generate clock signal for MAX297
2020 年 02 月 11 日
New Member
Forum Posts: 3
Member Since:
2017 年 10 月 15 日

I'm trying to set up a ADC / DAC chain using the 86Duino One's built-in ADC/PWM pins to acquire and process audio signals.
To keep the fidelity fairly high, I'm going to use 2x MAX297 ICs as programmable anti-aliasing / reconstruction low-pass filters.

The MAX297 is a high performance switched capacitor 8th order elliptic lowpass and can be programmed by means of an external clock source, that is 50 times the cut-off frequency. This would allow for configuring the sample-rate via software in order to balance audio bandwidth vs. CPU.

Let me give an example: Using the TimerOne lib I can set up a sampling rate of ~31kHz giving a Nyquist rate of ~15kHz. The TimerOne ISR would aqcuire, process and write my audio samples. The MAX297 has a transition bandwidth of r=1.5 so, setting its cut-off frequency to fc=10kHz (fstop=15kHz) requires a clock source of 0.5 MHz.

How would I go about setting up two timer ISRs, one at 1Mhz that toggles an arbitrary digital pin to generate the 0.5 Mhz clock signal, another one running at audio sample rate that's acquiring, processing and writing the audio samples?

TimerOne only gives me the option of running one timer at a fixed rate.

Thanks in advance!


2020 年 02 月 13 日
New Member
Forum Posts: 3
Member Since:
2017 年 10 月 15 日

Ok, let me try to put it differently:

Is it possible to run different PWM pins at different periods and have only one of them trigger an ISR? Please see the timing diagram below.

What I need is:

1. One or two pins running at 32us PWM period to output my audio signal. This slower timer should trigger the ISR
2. One free running pin that generates the clock signal at 2us PWM period at a fixed 50% duty cycle, no ISR is needed here in order not to hog the CPU.

2020 年 02 月 17 日
Forum Posts: 228
Member Since:
2014 年 04 月 01 日

Hi, ray_1,

We find the some problems in TimerOne library, currently only use one ISR (32us) and one pwm pin (2us),
like the below code:
#include "TimerOne.h"

TimerOne t2;
volatile int count = 0;
void myisr (void) {

void setup() {
Timer1.initialize(32); // ISR period is 32us.
t2.pwm(9, 512); // output PWM period is 2us and 50% duty on pin 9.
// no more ISR or pwm pin ...

void loop() {
printf("%d\ r", count);
Above code is work, but no more ISR and pwm pin in TimerOne.
If need the another ISR for different period, try to use the "MsTimer2" library.
If need more PWM pins(no ISR) in TimerOne library or "MsTimer2" is not what you want, I will take some time to modify and give the new version to you.

Forum Timezone: Asia/Taipei

Most Users Ever Online: 229

Currently Online:
4 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Dinosaur: 27

leutenecker: 13

mrZagg: 10

hippy: 9

smeezekitty: 8

lukeross: 8

tomka: 8

Ekkehard: 8

UIdahoCIT: 8

blaxxun: 7

Member Stats:

Guest Posters: 0

Members: 1569

Moderators: 15

Admins: 5

Forum Stats:

Groups: 2

Forums: 11

Topics: 248

Posts: 1114

Newest Members: EROGurnedo, Alfredhak, Davidherie, Nelsonbok, EugeneDut, RobertOwell, LamboSr, petershu, f0rkB0mb, Albert

Moderators: Glaux: 70, uaa: 11, guigra: 17, asian55: 22, Android_Lin: 228, bcarroll: 12, cucubutter: 84, recycled-air: 12, stevemork: 16, zerozaber: 52, pongraczi: 26, jejump: 14, George Andrews III: 56, poto: 11, garpastym: 20

Administrators: eveshih: 1, anthony: 31, viky6: 0, roboard: 135, hcl: 1