Just out here seeing the craziest programming behaviour I have ever seen, I was wondering if anyone can explain why is this happening?
I finally just finished rewriting how UART packets from an ESP32 is processed within the STM32H753ZI with an array that holds address of functions.
Depending on which packet arrives, for example 0x03
which is enable line-in input it will access that function within the function pointer array at the index of the packet, so in this case the functionPointerArray[3]
What's happening is that when I comment out this piece of code:
void I2S_MuteHandler() {
/* SPI1 -> CR1 |= SPI_CR1_CSUSP;
SPI3 -> CR1 |= SPI_CR1_CSUSP;
while (((SPI1 -> CR1) & (SPI_CR1_CSTART)));
while (((SPI3 -> CR1) & (SPI_CR1_CSTART)));
DMA1_Stream0 -> CR &= ~DMA_SxCR_EN;
DMA1_Stream1 -> CR &= ~DMA_SxCR_EN;
DMA1_Stream3 -> CR &= ~DMA_SxCR_EN;
SPI1 -> CR1 &= ~SPI_CR1_SPE;
SPI3 -> CR1 &= ~SPI_CR1_SPE;*/
}
The output wave of which processed through a DSP code and sent out via I2S3_TxBUFF
of code:
void I2S_HALFCOMPLETE_CALLBACK() {
int * I2S1_RxBUFF = getI2S1_RxBUFF();
int * I2S1_TxBUFF = getI2S1_TxBUFF();
int * I2S3_TxBUFF = getI2S3_TxBUFF();
double INSAMPLE_I2S_L[1024];
double INSAMPLE_I2S_R[1024];
double INSAMPLE_I2S_MONO[2048];
double OUTSAMPLE_I2S_L[1024];
double OUTSAMPLE_I2S_R[1024];
double OUTSAMPLE_I2S_MONO[2048];
for (int i = 0; i < 2048; i += 2) {
//EVEN
INSAMPLE_I2S_L[(i >> 1)] = (double)I2S1_RxBUFF[i] * (double)ADC_COMPENSATOR * 0.01 * centers.volume * centers.inputCompensator;
INSAMPLE_I2S_MONO[i] = (double)((I2S1_RxBUFF[i] + I2S1_RxBUFF[i+1]) >> 1) * (double)ADC_COMPENSATOR * 0.01 * subwoofers.volume;
//ODD
INSAMPLE_I2S_R[(i >> 1)] = (double)I2S1_RxBUFF[i+1] * (double)ADC_COMPENSATOR * 0.01 * centers.volume * centers.inputCompensator;
INSAMPLE_I2S_MONO[i+1] = INSAMPLE_I2S_MONO[i];
}
arm_biquad_cascade_df2T_f64(&subwoofers.audioStream_MONO, INSAMPLE_I2S_MONO, OUTSAMPLE_I2S_MONO, 2048);
arm_biquad_cascade_df2T_f64(¢ers.audioStream_L, INSAMPLE_I2S_L, OUTSAMPLE_I2S_L, 1024);
arm_biquad_cascade_df2T_f64(¢ers.audioStream_R, INSAMPLE_I2S_R, OUTSAMPLE_I2S_R, 1024);
for (int i = 0 ; i < 2048; i += 2){
//EVEN
I2S1_TxBUFF[i] = (int)OUTSAMPLE_I2S_L[i >> 1];
I2S3_TxBUFF[i] = (int)OUTSAMPLE_I2S_MONO[i];
//ODD
I2S1_TxBUFF[i+1] = (int)OUTSAMPLE_I2S_R[i >> 1];
I2S3_TxBUFF[i+1] = (int)OUTSAMPLE_I2S_MONO[i+1];
}
}
void I2S_TRANSFERCOMPLETE_CALLBACK() {
int * I2S1_RxBUFF = getI2S1_RxBUFF();
int * I2S1_TxBUFF = getI2S1_TxBUFF();
int * I2S3_TxBUFF = getI2S3_TxBUFF();
double INSAMPLE_I2S_L[1024];
double INSAMPLE_I2S_R[1024];
double INSAMPLE_I2S_MONO[2048];
double OUTSAMPLE_I2S_L[1024];
double OUTSAMPLE_I2S_R[1024];
double OUTSAMPLE_I2S_MONO[2048];
for (int i = 2048; i < 4096; i += 2) {
//EVEN
INSAMPLE_I2S_L[(i >> 1)-1024] = (double)I2S1_RxBUFF[i] * (double)ADC_COMPENSATOR * 0.01 * (double)centers.volume * centers.inputCompensator;
INSAMPLE_I2S_MONO[i-2048] = (double)((I2S1_RxBUFF[i] + I2S1_RxBUFF[i+1]) >> 1) * (double)ADC_COMPENSATOR * 0.01 * subwoofers.volume;
//ODD
INSAMPLE_I2S_R[(i >> 1)-1024] = (double)I2S1_RxBUFF[i+1] * (double)ADC_COMPENSATOR * 0.01 * (double)centers.volume * centers.inputCompensator;
INSAMPLE_I2S_MONO[(i+1)-2048] = INSAMPLE_I2S_MONO[i-2048];
}
arm_biquad_cascade_df2T_f64(&subwoofers.audioStream_MONO, INSAMPLE_I2S_MONO, OUTSAMPLE_I2S_MONO, 2048);
arm_biquad_cascade_df2T_f64(¢ers.audioStream_L, INSAMPLE_I2S_L, OUTSAMPLE_I2S_L, 1024);
arm_biquad_cascade_df2T_f64(¢ers.audioStream_R, INSAMPLE_I2S_R, OUTSAMPLE_I2S_R, 1024);
for (int i = 2048 ; i < 4096; i += 2){
//EVEN
I2S1_TxBUFF[i] = (int)OUTSAMPLE_I2S_L[(i >> 1)-1024];
I2S3_TxBUFF[i] = (int)OUTSAMPLE_I2S_MONO[i-2048];
//ODD
I2S1_TxBUFF[i+1] = (int)OUTSAMPLE_I2S_R[(i >> 1)-1024];
I2S3_TxBUFF[i+1] = (int)OUTSAMPLE_I2S_MONO[(i+1)-2048];
}
}
makes the input sine wave look like square waves and the biquad filters stop working
and when I uncomment the code that's causing the issue, the wave is working perfectly and the biquad filters work.
For a better in-depth look I'll include how I populate the array of function pointers and how it executes.
The function pointer array gets populated during the initialization stage of the MCU along-side its peripherals CODE:
void load_functionHandlers() {
messageReceived[0] = I2S_MuteHandler; // I believe the issue stems here in this function
messageReceived[1] = I2S_UnmuteHandler;
// messageReceived[2] = SPDIF_MuteHandler;
// messageReceived[3] = SPDIF_UnmuteHandler;
messageReceived[3] = audioSelectorInlineHandler;
// messageReceived[5] = audioSelectorBluetoothHandler;
// messageReceived[6] = audioSelectorSPDIFHandler;
// messageReceived[7] = audioSelectorHDMIHandler;
// messageReceived[8] = audioSelectorInternalHandler;
// messageReceived[9] = audioSelectorExternalHandler;
// messageReceived[10] = setupIRHandler;
// messageReceived[11] = disableTouchHandler;
// messageReceived[12] = enableTouchHandler;
// messageReceived[13] = nightRiderLightsHandler;
// messageReceived[14] = rainbowLightsHandler;
messageReceived[15] = volumeIncreaseHandler;
messageReceived[16] = volumeDecreaseHandler;
//
messageReceived[17] = n_12dB_subBass_notch_EQHandler;
messageReceived[18] = n_9dB_subBass_notch_EQHandler;
messageReceived[19] = n_6dB_subBass_notch_EQHandler;
messageReceived[20] = n_3dB_subBass_notch_EQHandler;
messageReceived[21] = _0dB_subBass_notch_EQHandler;
messageReceived[22] = p_3dB_subBass_notch_EQHandler;
messageReceived[23] = p_6dB_subBass_notch_EQHandler;
messageReceived[24] = p_9dB_subBass_notch_EQHandler;
messageReceived[25] = p_12dB_subBass_notch_EQHandler;
messageReceived[26] = n_12dB_Bass_notch_EQHandler;
messageReceived[27] = n_9dB_Bass_notch_EQHandler;
messageReceived[28] = n_6dB_Bass_notch_EQHandler;
messageReceived[29] = n_3dB_Bass_notch_EQHandler;
messageReceived[30] = _0dB_Bass_notch_EQHandler;
messageReceived[31] = p_3dB_Bass_notch_EQHandler;
messageReceived[32] = p_6dB_Bass_notch_EQHandler;
messageReceived[33] = p_9dB_Bass_notch_EQHandler;
messageReceived[34] = p_12dB_Bass_notch_EQHandler;
messageReceived[35] = n_12dB_lower_midrange_notch_EQHandler;
messageReceived[36] = n_9dB_lower_midrange_notch_EQHandler;
messageReceived[37] = n_6dB_lower_midrange_notch_EQHandler;
messageReceived[38] = n_3dB_lower_midrange_notch_EQHandler;
messageReceived[39] = _0dB_lower_midrange_notch_EQHandler;
messageReceived[40] = p_3dB_lower_midrange_notch_EQHandler;
messageReceived[41] = p_6dB_lower_midrange_notch_EQHandler;
messageReceived[42] = p_9dB_lower_midrange_notch_EQHandler;
messageReceived[43] = p_12dB_lower_midrange_notch_EQHandler;
messageReceived[44] = n_12dB_midrange_notch_EQHandler;
messageReceived[45] = n_9dB_midrange_notch_EQHandler;
messageReceived[46] = n_6dB_midrange_notch_EQHandler;
messageReceived[47] = n_3dB_midrange_notch_EQHandler;
messageReceived[48] = _0dB_midrange_notch_EQHandler;
messageReceived[49] = p_3dB_midrange_notch_EQHandler;
messageReceived[50] = p_6dB_midrange_notch_EQHandler;
messageReceived[51] = p_9dB_midrange_notch_EQHandler;
messageReceived[52] = p_12dB_midrange_notch_EQHandler;
messageReceived[53] = n_12dB_higher_midrange_notch_EQHandler;
messageReceived[54] = n_9dB_higher_midrange_notch_EQHandler;
messageReceived[55] = n_6dB_higher_midrange_notch_EQHandler;
messageReceived[56] = n_3dB_higher_midrange_notch_EQHandler;
messageReceived[57] = _0dB_higher_midrange_notch_EQHandler;
messageReceived[58] = p_3dB_higher_midrange_notch_EQHandler;
messageReceived[59] = p_6dB_higher_midrange_notch_EQHandler;
messageReceived[60] = p_9dB_higher_midrange_notch_EQHandler;
messageReceived[61] = p_12dB_higher_midrange_notch_EQHandler;
messageReceived[62] = n_12dB_presence_notch_EQHandler;
messageReceived[63] = n_9dB_presence_notch_EQHandler;
messageReceived[64] = n_6dB_presence_notch_EQHandler;
messageReceived[65] = n_3dB_presence_notch_EQHandler;
messageReceived[66] = _0dB_presence_notch_EQHandler;
messageReceived[67] = p_3dB_presence_notch_EQHandler;
messageReceived[68] = p_6dB_presence_notch_EQHandler;
messageReceived[69] = p_9dB_presence_notch_EQHandler;
messageReceived[70] = p_12dB_presence_notch_EQHandler;
messageReceived[71] = n_12dB_brilliance_notch_EQHandler;
messageReceived[72] = n_9dB_brilliance_notch_EQHandler;
messageReceived[73] = n_6dB_brilliance_notch_EQHandler;
messageReceived[74] = n_3dB_brilliance_notch_EQHandler;
messageReceived[75] = _0dB_brilliance_notch_EQHandler;
messageReceived[76] = p_3dB_brilliance_notch_EQHandler;
messageReceived[77] = p_6dB_brilliance_notch_EQHandler;
messageReceived[78] = p_9dB_brilliance_notch_EQHandler;
messageReceived[79] = p_12dB_brilliance_notch_EQHandler;
messageReceived[80] = n_12dB_Bass_lowShelf_EQHandler;
messageReceived[81] = n_9dB_Bass_lowShelf_EQHandler;
messageReceived[82] = n_6dB_Bass_lowShelf_EQHandler;
messageReceived[83] = n_3dB_Bass_lowShelf_EQHandler;
messageReceived[84] = _0dB_Bass_lowShelf_EQHandler;
messageReceived[85] = p_3dB_Bass_lowShelf_EQHandler;
messageReceived[86] = p_6dB_Bass_lowShelf_EQHandler;
messageReceived[87] = p_9dB_Bass_lowShelf_EQHandler;
messageReceived[88] = p_12dB_Bass_lowShelf_EQHandler;
//messageReceived[89] = disableLightsHandler;
}
How the function pointer gets executed CODE:
static void (*messageReceived[255])(void); // Global Variable
void UART4_TRANSFERCOMPELTE_CALLBACK(uint8_t exitPacket) {
//functions pointers
if (exitPacket) {
if ((exitPacket >= 0) && (exitPacket <= 88)) {
(*messageReceived[exitPacket])();
}
} else {
uint8_t packet = getUART4_RxBUFF()[0];
if ((packet >= 0) && (packet <= 88)) {
(*messageReceived[packet])();
}
}
}
I can't never predict the behaviour of this. I try commenting out random function pointers where the function pointers get populated into the array and it works, and vice versa.
I thought it was a memory address being overwritten somewhere, however I double checked the the two address of when the wave is square and when the wave is perfect. Its registers, address, anything you name it are identical. I am mind blown right now. If anyone can shine light on this would be amazing. It doesn't even enter the function that's in question at all.
I know it's an issue where populating the array is happening as when I do this test code to bypass the function pointer and comment out out the block of code it doesn't work still.
static void (*messageReceived[255])(void);
void UART4_TRANSFERCOMPELTE_CALLBACK(uint8_t exitPacket) {
//functions pointers
uint8_t * packet;
if (exitPacket) {
packet = malloc(sizeof(uint8_t));
packet[0] = exitPacket;
} else {
packet = getUART4_RxBUFF();
}
//(*messageReceived[packet[0]])(); // By passing function pointer array
audioSelectorInlineHandler();
}
UPDATE 1:
If I once again bypass the function pointer array and comment EVERYTHING in the function that populates the function pointer array. It works
CODE:
/*
* UART_PACKET_PROCESSOR.c
*
* Created on: May 13, 2021
* Author: Christopher
*/
#include <stdint.h>
#include <stdlib.h>
#include <constants.h>
#include <dspFactory.h>
#include <inputSourceFactory.h>
#include <opcode.h>
#include <packetProcessor.h>
#include <uartFactory.h>
static void (*messageReceived[255])(void);
void UART4_TRANSFERCOMPELTE_CALLBACK(uint8_t exitPacket) {
//functions pointers
uint8_t * packet = NULL;
if (exitPacket) {
//(*messageReceived[packet[exitPacket]])();
} else {
//(*messageReceived[getUART4_RxBUFF()[0]])();
}
audioSelectorInlineHandler();
}
void load_functionHandlers() {
// for (int i = 0; i < 255; i++) {
// messageReceived[i] = 0;
// }
//
// messageReceived[0] = &I2S_MuteHandler;
// messageReceived[1] = &I2S_UnmuteHandler;
//// messageReceived[2] = SPDIF_MuteHandler;
//// messageReceived[3] = SPDIF_UnmuteHandler;
//
// messageReceived[3] = &audioSelectorInlineHandler;
//// messageReceived[5] = audioSelectorBluetoothHandler;
//// messageReceived[6] = audioSelectorSPDIFHandler;
//// messageReceived[7] = audioSelectorHDMIHandler;
//
//// messageReceived[8] = audioSelectorInternalHandler;
//// messageReceived[9] = audioSelectorExternalHandler;
//
//// messageReceived[10] = setupIRHandler;
//// messageReceived[11] = disableTouchHandler;
//// messageReceived[12] = enableTouchHandler;
//
//// messageReceived[13] = nightRiderLightsHandler;
//// messageReceived[14] = rainbowLightsHandler;
//
// messageReceived[15] = &volumeIncreaseHandler;
// messageReceived[16] = &volumeDecreaseHandler;
////
// messageReceived[17] = &n_12dB_subBass_notch_EQHandler;
// messageReceived[18] = &n_9dB_subBass_notch_EQHandler;
// messageReceived[19] = &n_6dB_subBass_notch_EQHandler;
// messageReceived[20] = &n_3dB_subBass_notch_EQHandler;
// messageReceived[21] = &_0dB_subBass_notch_EQHandler;
// messageReceived[22] = &p_3dB_subBass_notch_EQHandler;
// messageReceived[23] = &p_6dB_subBass_notch_EQHandler;
// messageReceived[24] = &p_9dB_subBass_notch_EQHandler;
// messageReceived[25] = &p_12dB_subBass_notch_EQHandler;
//
// messageReceived[26] = &n_12dB_Bass_notch_EQHandler;
// messageReceived[27] = &n_9dB_Bass_notch_EQHandler;
// messageReceived[28] = &n_6dB_Bass_notch_EQHandler;
// messageReceived[29] = &n_3dB_Bass_notch_EQHandler;
// messageReceived[30] = &_0dB_Bass_notch_EQHandler;
// messageReceived[31] = &p_3dB_Bass_notch_EQHandler;
// messageReceived[32] = &p_6dB_Bass_notch_EQHandler;
// messageReceived[33] = &p_9dB_Bass_notch_EQHandler;
// messageReceived[34] = &p_12dB_Bass_notch_EQHandler;
//
// messageReceived[35] = &n_12dB_lower_midrange_notch_EQHandler;
// messageReceived[36] = &n_9dB_lower_midrange_notch_EQHandler;
// messageReceived[37] = &n_6dB_lower_midrange_notch_EQHandler;
// messageReceived[38] = &n_3dB_lower_midrange_notch_EQHandler;
// messageReceived[39] = &_0dB_lower_midrange_notch_EQHandler;
// messageReceived[40] = &p_3dB_lower_midrange_notch_EQHandler;
// messageReceived[41] = &p_6dB_lower_midrange_notch_EQHandler;
// messageReceived[42] = &p_9dB_lower_midrange_notch_EQHandler;
// messageReceived[43] = &p_12dB_lower_midrange_notch_EQHandler;
//
// messageReceived[44] = &n_12dB_midrange_notch_EQHandler;
// messageReceived[45] = &n_9dB_midrange_notch_EQHandler;
// messageReceived[46] = &n_6dB_midrange_notch_EQHandler;
// messageReceived[47] = &n_3dB_midrange_notch_EQHandler;
// messageReceived[48] = &_0dB_midrange_notch_EQHandler;
// messageReceived[49] = &p_3dB_midrange_notch_EQHandler;
// messageReceived[50] = &p_6dB_midrange_notch_EQHandler;
// messageReceived[51] = &p_9dB_midrange_notch_EQHandler;
// messageReceived[52] = &p_12dB_midrange_notch_EQHandler;
//
// messageReceived[53] = &n_12dB_higher_midrange_notch_EQHandler;
// messageReceived[54] = &n_9dB_higher_midrange_notch_EQHandler;
// messageReceived[55] = &n_6dB_higher_midrange_notch_EQHandler;
// messageReceived[56] = &n_3dB_higher_midrange_notch_EQHandler;
// messageReceived[57] = &_0dB_higher_midrange_notch_EQHandler;
// messageReceived[58] = &p_3dB_higher_midrange_notch_EQHandler;
// messageReceived[59] = &p_6dB_higher_midrange_notch_EQHandler;
// messageReceived[60] = &p_9dB_higher_midrange_notch_EQHandler;
// messageReceived[61] = &p_12dB_higher_midrange_notch_EQHandler;
//
// messageReceived[62] = &n_12dB_presence_notch_EQHandler;
// messageReceived[63] = &n_9dB_presence_notch_EQHandler;
// messageReceived[64] = &n_6dB_presence_notch_EQHandler;
// messageReceived[65] = &n_3dB_presence_notch_EQHandler;
// messageReceived[66] = &_0dB_presence_notch_EQHandler;
// messageReceived[67] = &p_3dB_presence_notch_EQHandler;
// messageReceived[68] = &p_6dB_presence_notch_EQHandler;
// messageReceived[69] = &p_9dB_presence_notch_EQHandler;
// messageReceived[70] = &p_12dB_presence_notch_EQHandler;
//
// messageReceived[71] = &n_12dB_brilliance_notch_EQHandler;
// messageReceived[72] = &n_9dB_brilliance_notch_EQHandler;
// messageReceived[73] = &n_6dB_brilliance_notch_EQHandler;
// messageReceived[74] = &n_3dB_brilliance_notch_EQHandler;
// messageReceived[75] = &_0dB_brilliance_notch_EQHandler;
// messageReceived[76] = &p_3dB_brilliance_notch_EQHandler;
// messageReceived[77] = &p_6dB_brilliance_notch_EQHandler;
// messageReceived[78] = &p_9dB_brilliance_notch_EQHandler;
// messageReceived[79] = &p_12dB_brilliance_notch_EQHandler;
//
// messageReceived[80] = &n_12dB_Bass_lowShelf_EQHandler;
// messageReceived[81] = &n_9dB_Bass_lowShelf_EQHandler;
// messageReceived[82] = &n_6dB_Bass_lowShelf_EQHandler;
// messageReceived[83] = &n_3dB_Bass_lowShelf_EQHandler;
// messageReceived[84] = &_0dB_Bass_lowShelf_EQHandler;
// messageReceived[85] = &p_3dB_Bass_lowShelf_EQHandler;
// messageReceived[86] = &p_6dB_Bass_lowShelf_EQHandler;
// messageReceived[87] = &p_9dB_Bass_lowShelf_EQHandler;
// messageReceived[88] = &p_12dB_Bass_lowShelf_EQHandler;
//messageReceived[89] = disableLightsHandler;
}
UPDATE 2:
If I tried another function to comment out and it still does the same behaviour.
CODE:
void load_functionHandlers() {
for (int i = 0; i < 255; i++) {
messageReceived[i] = 0;
}
messageReceived[0] = &I2S_MuteHandler;
messageReceived[1] = &I2S_UnmuteHandler; //Comment this shows same behavoir
// messageReceived[2] = SPDIF_MuteHandler;
// messageReceived[3] = SPDIF_UnmuteHandler;
messageReceived[3] = &audioSelectorInlineHandler;
// messageReceived[5] = audioSelectorBluetoothHandler;
// messageReceived[6] = audioSelectorSPDIFHandler;
// messageReceived[7] = audioSelectorHDMIHandler;
// messageReceived[8] = audioSelectorInternalHandler;
// messageReceived[9] = audioSelectorExternalHandler;
// messageReceived[10] = setupIRHandler;
// messageReceived[11] = disableTouchHandler;
// messageReceived[12] = enableTouchHandler;
// messageReceived[13] = nightRiderLightsHandler;
// messageReceived[14] = rainbowLightsHandler;
messageReceived[15] = &volumeIncreaseHandler; // no affect
messageReceived[16] = &volumeDecreaseHandler; // no affect
//
messageReceived[17] = &n_12dB_subBass_notch_EQHandler; ////////
messageReceived[18] = &n_9dB_subBass_notch_EQHandler;
messageReceived[19] = &n_6dB_subBass_notch_EQHandler;
messageReceived[20] = &n_3dB_subBass_notch_EQHandler;
messageReceived[21] = &_0dB_subBass_notch_EQHandler;
messageReceived[22] = &p_3dB_subBass_notch_EQHandler; any of these shows same behavior
messageReceived[23] = &p_6dB_subBass_notch_EQHandler;
messageReceived[24] = &p_9dB_subBass_notch_EQHandler;
messageReceived[25] = &p_12dB_subBass_notch_EQHandler;
messageReceived[26] = &n_12dB_Bass_notch_EQHandler;
messageReceived[27] = &n_9dB_Bass_notch_EQHandler;
messageReceived[28] = &n_6dB_Bass_notch_EQHandler;
messageReceived[29] = &n_3dB_Bass_notch_EQHandler;
messageReceived[30] = &_0dB_Bass_notch_EQHandler;
messageReceived[31] = &p_3dB_Bass_notch_EQHandler;
messageReceived[32] = &p_6dB_Bass_notch_EQHandler;
messageReceived[33] = &p_9dB_Bass_notch_EQHandler;
messageReceived[34] = &p_12dB_Bass_notch_EQHandler;
messageReceived[35] = &n_12dB_lower_midrange_notch_EQHandler;
messageReceived[36] = &n_9dB_lower_midrange_notch_EQHandler;
messageReceived[37] = &n_6dB_lower_midrange_notch_EQHandler;
messageReceived[38] = &n_3dB_lower_midrange_notch_EQHandler;
messageReceived[39] = &_0dB_lower_midrange_notch_EQHandler;
messageReceived[40] = &p_3dB_lower_midrange_notch_EQHandler;
messageReceived[41] = &p_6dB_lower_midrange_notch_EQHandler;
messageReceived[42] = &p_9dB_lower_midrange_notch_EQHandler;
messageReceived[43] = &p_12dB_lower_midrange_notch_EQHandler;
messageReceived[44] = &n_12dB_midrange_notch_EQHandler;
messageReceived[45] = &n_9dB_midrange_notch_EQHandler;
messageReceived[46] = &n_6dB_midrange_notch_EQHandler;
messageReceived[47] = &n_3dB_midrange_notch_EQHandler; any of these shows same behavior
messageReceived[48] = &_0dB_midrange_notch_EQHandler;
messageReceived[49] = &p_3dB_midrange_notch_EQHandler;
messageReceived[50] = &p_6dB_midrange_notch_EQHandler;
messageReceived[51] = &p_9dB_midrange_notch_EQHandler;
messageReceived[52] = &p_12dB_midrange_notch_EQHandler;
messageReceived[53] = &n_12dB_higher_midrange_notch_EQHandler;
messageReceived[54] = &n_9dB_higher_midrange_notch_EQHandler;
messageReceived[55] = &n_6dB_higher_midrange_notch_EQHandler;
messageReceived[56] = &n_3dB_higher_midrange_notch_EQHandler; any of these shows same behavior
messageReceived[57] = &_0dB_higher_midrange_notch_EQHandler;
messageReceived[58] = &p_3dB_higher_midrange_notch_EQHandler;
messageReceived[59] = &p_6dB_higher_midrange_notch_EQHandler;
messageReceived[60] = &p_9dB_higher_midrange_notch_EQHandler;
messageReceived[61] = &p_12dB_higher_midrange_notch_EQHandler;
messageReceived[62] = &n_12dB_presence_notch_EQHandler;
messageReceived[63] = &n_9dB_presence_notch_EQHandler;
messageReceived[64] = &n_6dB_presence_notch_EQHandler;
messageReceived[65] = &n_3dB_presence_notch_EQHandler; any of these shows same behavior
messageReceived[66] = &_0dB_presence_notch_EQHandler;
messageReceived[67] = &p_3dB_presence_notch_EQHandler;
messageReceived[68] = &p_6dB_presence_notch_EQHandler;
messageReceived[69] = &p_9dB_presence_notch_EQHandler;
messageReceived[70] = &p_12dB_presence_notch_EQHandler;
messageReceived[71] = &n_12dB_brilliance_notch_EQHandler;
messageReceived[72] = &n_9dB_brilliance_notch_EQHandler;
messageReceived[73] = &n_6dB_brilliance_notch_EQHandler;
messageReceived[74] = &n_3dB_brilliance_notch_EQHandler;
messageReceived[75] = &_0dB_brilliance_notch_EQHandler;
messageReceived[76] = &p_3dB_brilliance_notch_EQHandler; any of these shows same behavior
messageReceived[77] = &p_6dB_brilliance_notch_EQHandler;
messageReceived[78] = &p_9dB_brilliance_notch_EQHandler;
messageReceived[79] = &p_12dB_brilliance_notch_EQHandler;
messageReceived[80] = &n_12dB_Bass_lowShelf_EQHandler;
messageReceived[81] = &n_9dB_Bass_lowShelf_EQHandler;
messageReceived[82] = &n_6dB_Bass_lowShelf_EQHandler;
messageReceived[83] = &n_3dB_Bass_lowShelf_EQHandler;
messageReceived[84] = &_0dB_Bass_lowShelf_EQHandler; any of these shows same behavior
messageReceived[85] = &p_3dB_Bass_lowShelf_EQHandler;
messageReceived[86] = &p_6dB_Bass_lowShelf_EQHandler;
messageReceived[87] = &p_9dB_Bass_lowShelf_EQHandler;
messageReceived[88] = &p_12dB_Bass_lowShelf_EQHandler; ////////////
//messageReceived[89] = disableLightsHandler;
}
UPDATE 3:
I strongly believe it's a memory issue. The code below is essentially a smaller version of what's above. I commented all the other handlers() expect for the one that's in testing "audioSelectorInlineHandler()" and changed the allocation of the function pointer array from [255]
-> [4]
and it works.
UPDATE 4: Took out the function pointers and noticed it did the same thing. I am going to assume this is caused by using SPI3. Not sure why