I have a programm in Arduino Mega that works perfectly. Now, I want to use the same code in Arduino DUE, but there are some things that I know I have to change. Specific, there are two of them:
I need 6 pwm ouputs at 32 KHz. I have read some libraries for that but all of them only changes the frequency in 4 pins (real pwm outputs). I thing that I have to change the configuration of the Timers, but I don't know how to do that in DUE.
I need a periodic routine, so I need to programm a Timer for do something each certain time.
I need to use functions like delay() and micros(), so I can't change Timer0.
The Due has a special timer called SysTick that runs separately from the peripherals that are actually called timers. The delay functions on the Due use SysTick and the on-processor tick counter. I do not believe that Timer0 is used for delay() at all. But, it most likely still used for TimerCounter PWM or something.
The Due has 8 PWM outputs by default - 4 true PWM and 4 TC PWM. You can look at the Arduino core files, I believe in wiring_analog.cpp to see how they did it.
Using the library DueTimer, I can obtain a interrupt using, for example, Timer1.
Now the question is: Will the delay() and micros() functions work fine? Until now, I was using Arduino UNO and pro mini, and when I modified the PWM frequency this functions don't work well. I have been reading the Due datasheet and looks like I am not going to have problems, but I am not sure...