Full project can be found here: https://forum.pjrc.com/threads/59860-Senior-design-project-UIUC.
Using this function I am trying to poll 3 filtered audio signals.
But when I run this code, nothing happens in the serial monitor. Also, sometimes I get a message that the Teensy on COM6 is not available.
This issue started when I added the interrupt priority code and called the two additional interval timers. Originally I was just using one interval timer, but since I needed to set priority on all 3 I figured I needed to call 3.
Using this function I am trying to poll 3 filtered audio signals.
But when I run this code, nothing happens in the serial monitor. Also, sometimes I get a message that the Teensy on COM6 is not available.
Code:
#define PIN_BASS A0
#define PIN_MID A1
#define PIN_TWEET A2
#define BITS 10
IntervalTimer ADC_Read_Timer_Bass, ADC_Read_Timer_Mid, ADC_Read_Timer_Tweet;
void setup() {
IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_02 &= ~ (1<<12) ; // disable keeper
IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_03 &= ~ (1<<12) ; // disable keeper
IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_04 &= ~ (1<<12) ; // disable keeper
pinMode(PIN_BASS, INPUT);
pinMode(PIN_MID, INPUT);
pinMode(PIN_TWEET, INPUT);
analogReadResolution(BITS);
ADC_Read_Timer_Bass.begin( ADC_READ_BASS, 22);
delayMicroseconds(7);
ADC_Read_Timer_Mid.begin( ADC_READ_MID, 22);
delayMicroseconds(7);
ADC_Read_Timer_Tweet.begin(ADC_READ_TWEET, 22);
ADC_Read_Timer_Bass.priority(10);
ADC_Read_Timer_Mid.priority(9);
ADC_Read_Timer_Tweet.priority(8);
Serial.begin(115200);
}
volatile u_int16_t AnalogValue_Bass;
volatile u_int16_t AnalogValue_Mid;
volatile u_int16_t AnalogValue_Tweet;
void ADC_READ_BASS(){
AnalogValue_Bass = analogRead(PIN_BASS);
}
void ADC_READ_MID(){
AnalogValue_Mid = analogRead(PIN_MID);
}
void ADC_READ_TWEET(){
AnalogValue_Tweet = analogRead(PIN_TWEET);
}
void loop() {
u_int16_t AnalogValue_Bass_copy;
u_int16_t AnalogValue_Mid_copy;
u_int16_t AnalogValue_Tweet_copy;
noInterrupts();
AnalogValue_Bass_copy = AnalogValue_Bass;
interrupts();
noInterrupts();
AnalogValue_Mid_copy = AnalogValue_Mid;
interrupts();
noInterrupts();
AnalogValue_Tweet_copy = AnalogValue_Tweet;
interrupts();
Serial.print("Analog value Bass is ");
Serial.println(AnalogValue_Bass_copy);
Serial.print("Analog value Mid is ");
Serial.println(AnalogValue_Mid_copy);
Serial.print("Analog value Tweet is ");
Serial.println(AnalogValue_Tweet_copy);
}
This issue started when I added the interrupt priority code and called the two additional interval timers. Originally I was just using one interval timer, but since I needed to set priority on all 3 I figured I needed to call 3.
Last edited: