Hi guys,
I am embarking on building an Open.Theremin using a custom PCB and a SAM3SD8C ARM Cortex MCU (very similar to the Arduino Due's MCU, SAM3X8E). The CPU is clocked at 64MHz, but the timer/counter module is clocked at 16MHz to match the OTU.
I have quite a few features in mind that I plan to add to this project, but first I need to get the basics working (my current objective is to get pitch and volume control functioning correctly).
The design is based on the OTU V3 alpha, so it does not have a way of sampling the VOs directly, maybe in a future revision I'll correct that. Other potential flaws in the design are:
- neither pitch or antenna inputs are connected to capture pins, so this is handled in interrupts only (same as the OTU's volume)
- the chip select for the tuning DAC is connected to the designated peripheral output - this is only a very minor issue
Schematic: https://www.dropbox.com/s/tlzje1lb8cegjnb/Open.Theremin.Xtreme%20Rev%202.pdf?dl=0
The code has been manually ported from the Arduino IDE to Atmel Studio.
So far I've managed to:
- get the start up sequence to play
- the pitch to respond (poorly)
- get USB<->serial working for control and debug info
- add 3 routines based on the OUT V3 code for measuring:
- the 16MHz timer clock (generally reads to ~16001465 Hz)
- the pitch frequency leaving the flip-flop (reads about 360 Hz - 400 Hz with me away from the antenna)
- the volume frequency leaving the flip-flop (reads about 7737 Hz with me away from the antenna)
I have had no success with automatic calibration and little to no success with the volume - I'm trying to track down if the latter is an issue with the way interrupts work on this chip or something else.
What I have noticed, however, is if I modify the debouncing routine to use 2 and 4, I do get some, albeit very poor, response
if (PIOA->PIO_PDSR & IO_VOLUME_INPUT){
deb_v++; // volume pin counts debouncer
}
if (deb_v==3) {
NoInterrupts(); // Stop pitch and volume interrupts
vol_counter=vol_counter_i; // Get Timer-Counter 1 value
vol=(vol_counter-vol_counter_l); // Counter change since last interrupt
vol_counter_l=vol_counter; // Set actual value as new last value
}
if (deb_v==5){ //4 works, 5 does not
flag_vol=true; // set flag after 5 bounces
}
Is anyone able to tell me what frequencies I should be expecting coming out of the flip-flops? I'm suspecting the pitch frequency is ok, and the volume frequency is off, since with the debounce counters set to 3 and 5, vol=0 except when my hand is touching the antenna.
Any ideas on where to look to resolve the issue would be much appreciated.
-Andrew