Hello,
I need to get 3.072MHz clock on an output pin, for audio purposes.
I have Arduino Due and Arduino M0 pro.
This rate is common with I2S, but none of the boards support I2S library (as far as I could tell from googling).
I tried the following code on Arduino Due, but it doesn't give me the exact frequency:
void setup() {
int32_t freq = 3072000;
int32_t mask_PWM_pin = digitalPinToBitMask(6);
REG_PMC_PCER1 = 1<<4;
REG_PIOC_PDR |= mask_PWM_pin;
REG_PIOC_ABSR |= mask_PWM_pin;
REG_PWM_CLK = 0;
REG_PWM_CMR7 = 0<<9;
REG_PWM_CPRD7 = 84000000/freq;
REG_PWM_CDTY7 = 42000000/freq;
REG_PWM_ENA = 1<<7;
}
void loop() {
}
Could you please assist me with this?
Thanks!
P.S. as a fallback, if you can tell me what board can do it for sure, and with what code, it would be much appreciated.
Thanks!