Control-Surface icon indicating copy to clipboard operation
Control-Surface copied to clipboard

Is there a maximum of mux that the library can use?

Open benwadub opened this issue 3 years ago • 11 comments

Hi Pieter, I try to double my controller and when I put my code for 16 channels nothing work, do you think 10 4067 mux is too mutch ? D6A10D5D-D576-448C-91AA-D1443BB57046

benwadub avatar Oct 13 '20 17:10 benwadub

Hard to say without seeing your code. Try adding some print statements to figure out where the code hangs. If you have enough memory, try enabling the debug mode:

https://github.com/tttapa/Control-Surface/blob/21a09383bb3eaa5f1835184a63fdcdb4b8f5799b/src/AH/Settings/Settings.hpp#L19-L27

tttapa avatar Oct 13 '20 17:10 tttapa

my code is this one, it works fine with only 5 mux but as soon as I try using 10 nothing works except few pots on mux 2 that seems to send on 4 different channels

#include <Control_Surface.h>

//#include <name.c>
// celà doit etre écrit avant la library control surface
 USBDebugMIDI_Interface midi = 115200; // enlever les // en début de ligne pour entrer en mode debug usb et voir dans le panneau de control si vos controler envoient bien les infos

//auto &serial = Serial1;// Selectionne le port série à utiliser remplacer par serial pour une arduino
//SerialMIDI_Interface<decltype(serial)> midi = {serial, MIDI_BAUD};// démarre une interface midi serial au midi baud rate par defaut
//USBMIDI_Interface usbmidi;// enlever les / en debut de ligne pour activer l'interface usb, penser à désactiver l'interface série(din)
//HardwareSerialMIDI_Interface midiser = Serial1;
 
 
//MIDI_PipeFactory<8> pipes;


CD74HC4067 mux1 = {
  14,       // numéro de broche de l'arduino
  {9, 3, 4, 5} // numéro de pins de l'arduino sur lesquels sont branchés tous les multiplexeurs apellés mux S0, S1, S2
};

CD74HC4067 mux2 = {
  15,              
  {9, 3, 4, 5}, 
};

CD74HC4067 mux3 = {
  16,       
  {9, 3, 4, 5} 
};
CD74HC4067 mux4 = {
  17,       
  {9, 3, 4, 5} 
};
CD74HC4067 mux5 = {
  18,      
  {9, 3, 4, 5} 
};
CD74HC4067 mux6 = {
  6,      
  {9, 3, 4, 5} 
};
CD74HC4067 mux7 = {
  7,      
  {9, 3, 4, 5} 
};
CD74HC4067 mux8 = {
  8,      
  {9, 3, 4, 5} 
};
CD74HC4067 mux9 = {
  11,      
  {9, 3, 4, 5} 
};
CD74HC4067 mux10 = {
  10,      
  {9, 3, 4, 5} 
};
//Bank<2> bank = {8}; // active 2 bank avec 8 adresses par bank
/*IncrementSelector<2> selector = {
    bank,       // Bank to manage
    20,     // push button pins (increment, decrement)
    Wrap::Wrap, // Wrap around
};
*/
CCPotentiometer fxparameter [] = {
  {mux1.pin(0), {1, CHANNEL_16}},//delay time
  {mux1.pin(1), {2, CHANNEL_16}},//pingpong
  {mux1.pin(2), {3, CHANNEL_16}},//stereo width
  {mux1.pin(3), {4, CHANNEL_16}},//feedback
  {mux1.pin(4), {5, CHANNEL_16}},//hph
  {mux1.pin(5), {6, CHANNEL_16}},//lpf
  {mux1.pin(6), {7, CHANNEL_16}},//reverb send
  {mux1.pin(7), {8, CHANNEL_16}},//mix volume
  {mux1.pin(15), {9, CHANNEL_16}},//pre delay
  {mux1.pin(14), {10, CHANNEL_16}},//reverb decay
  {mux1.pin(13), {11, CHANNEL_16}},//reverb filter
  {mux1.pin(12), {12, CHANNEL_16}},//shelving gain
  {mux1.pin(11), {13, CHANNEL_16}},//hpf
  {mux1.pin(10), {14, CHANNEL_16}},//lpf
  {mux1.pin(9), {15, CHANNEL_16}},//mux volume
  {mux1.pin(8), {16, CHANNEL_16}},//pattern volume
};

CCPotentiometer fxparameter2 [] = {
  {mux2.pin(0), {17, CHANNEL_1}},//delay time
  {mux2.pin(1), {18, CHANNEL_2}},//pingpong
  {mux2.pin(2), {19, CHANNEL_3}},//stereo width
  {mux2.pin(3), {20, CHANNEL_4}},//feedback
  {mux2.pin(4), {21, CHANNEL_5}},//hph
  {mux2.pin(5), {22, CHANNEL_6}},//lpf
  {mux2.pin(6), {23, CHANNEL_7}},//reverb send
  {mux2.pin(7), {24, CHANNEL_8}},//mix volume
  {mux2.pin(15), {25, CHANNEL_9}},//pre delay
  {mux2.pin(14), {26, CHANNEL_10}},//reverb decay
  {mux2.pin(13), {27, CHANNEL_11}},//reverb filter
  {mux2.pin(12), {28, CHANNEL_12}},//shelving gain
  {mux2.pin(11), {29, CHANNEL_13}},//hpf
  {mux2.pin(10), {30, CHANNEL_14}},//lpf
  {mux2.pin(9), {31, CHANNEL_15}},//mux volume
  {mux2.pin(8), {32, CHANNEL_16}},//pattern volume
};
CCPotentiometer fxparameter3 [] = {
  {mux3.pin(0), {17, CHANNEL_1}},//delay time
  {mux3.pin(1), {18, CHANNEL_2}},//pingpong
  {mux3.pin(2), {19, CHANNEL_3}},//stereo width
  {mux3.pin(3), {20, CHANNEL_4}},//feedback
  {mux3.pin(4), {21, CHANNEL_5}},//hph
  {mux3.pin(5), {22, CHANNEL_6}},//lpf
  {mux3.pin(6), {23, CHANNEL_7}},//reverb send
  {mux3.pin(7), {24, CHANNEL_8}},//mix volume
  {mux3.pin(15), {25, CHANNEL_9}},//pre delay
  {mux3.pin(14), {26, CHANNEL_10}},//reverb decay
  {mux3.pin(13), {27, CHANNEL_11}},//reverb filter
  {mux3.pin(12), {28, CHANNEL_12}},//shelving gain
  {mux3.pin(11), {29, CHANNEL_13}},//hpf
  {mux3.pin(10), {30, CHANNEL_14}},//lpf
  {mux3.pin(9), {31, CHANNEL_15}},//mux volume
  {mux3.pin(8), {32, CHANNEL_16}},//pattern volume
};

CCPotentiometer fxparameter4 [] = {
  {mux4.pin(0), {17, CHANNEL_1}},//delay time
  {mux4.pin(1), {18, CHANNEL_2}},//pingpong
  {mux4.pin(2), {19, CHANNEL_3}},//stereo width
  {mux4.pin(3), {20, CHANNEL_4}},//feedback
  {mux4.pin(4), {21, CHANNEL_5}},//hph
  {mux4.pin(5), {22, CHANNEL_6}},//lpf
  {mux4.pin(6), {23, CHANNEL_7}},//reverb send
  {mux4.pin(7), {24, CHANNEL_8}},//mix volume
  {mux4.pin(15), {25, CHANNEL_9}},//pre delay
  {mux4.pin(14), {26, CHANNEL_10}},//reverb decay
  {mux4.pin(13), {27, CHANNEL_11}},//reverb filter
  {mux4.pin(12), {28, CHANNEL_12}},//shelving gain
  {mux4.pin(11), {29, CHANNEL_13}},//hpf
  {mux4.pin(10), {30, CHANNEL_14}},//lpf
  {mux4.pin(9), {31, CHANNEL_15}},//mux volume
  {mux4.pin(8), {32, CHANNEL_16}},//pattern volume
};

CCPotentiometer fader [] = { //ici on déclare les faders avec comme vu plus haut le numéro de CC et le canal
  {mux5.pin(15), {7, CHANNEL_1}},//volume
  {mux5.pin(14), {7, CHANNEL_2}},
  {mux5.pin(13), {7, CHANNEL_3}},
  {mux5.pin(12), {7, CHANNEL_4}},
  {mux5.pin(11), {7, CHANNEL_5}},
  {mux5.pin(10), {7, CHANNEL_6}},
  {mux5.pin(9), {7, CHANNEL_7}},
  {mux5.pin(8), {7, CHANNEL_8}},
};
 CCButtonLatched buttonmute[] = { 
  {mux5.pin(0), {94, CHANNEL_1}},//numéro de bank correspondant/indique que le changement de bank change le canal midi (+8 car on a 8 adresses par bank)/pin sur laquelle le controleur est branché/numéro de cc/numéro de canal midi
  {mux5.pin(1), {94, CHANNEL_2}},
  {mux5.pin(2), {94, CHANNEL_3}},
  {mux5.pin(3), {94, CHANNEL_4}},
  {mux5.pin(4), {94, CHANNEL_5}},
  {mux5.pin(5), {94, CHANNEL_6}},
  {mux5.pin(6), {94, CHANNEL_7}},
  {mux5.pin(7), {94, CHANNEL_8}},
};
 CCPotentiometer fxparameter5 [] = {
  {mux6.pin(0), {93, CHANNEL_16}},//delay time
  {mux6.pin(1), {94, CHANNEL_16}},//pingpong
  {mux6.pin(2), {95, CHANNEL_16}},//stereo width
  {mux6.pin(3), {96, CHANNEL_16}},//feedback
  {mux6.pin(4), {97, CHANNEL_16}},//hph
  {mux6.pin(5), {98, CHANNEL_16}},//lpf
  {mux6.pin(6), {99, CHANNEL_16}},//reverb send
  {mux6.pin(7), {100, CHANNEL_16}},//mix volume
  {mux6.pin(15), {101, CHANNEL_16}},//pre delay
  {mux6.pin(14), {102, CHANNEL_16}},//reverb decay
  {mux6.pin(13), {103, CHANNEL_16}},//reverb filter
  {mux6.pin(12), {104, CHANNEL_16}},//shelving gain
  {mux6.pin(11), {105, CHANNEL_16}},//hpf
  {mux6.pin(10), {106, CHANNEL_16}},//lpf
  {mux6.pin(9), {107, CHANNEL_16}},//mux volume
  {mux6.pin(8), {108, CHANNEL_16}},//pattern volume
};

CCPotentiometer filtre2 [] = {
  {mux7.pin(0), {74, CHANNEL_9}},//filtre freq
  {mux7.pin(1), {74, CHANNEL_10}},
  {mux7.pin(2), {74, CHANNEL_11}},
  {mux7.pin(3), {74, CHANNEL_12}},
  {mux7.pin(4), {74, CHANNEL_13}},
  {mux7.pin(5), {74, CHANNEL_14}},
  {mux7.pin(6), {74, CHANNEL_15}},
  {mux7.pin(7), {74, CHANNEL_16}},
  {mux7.pin(15), {75, CHANNEL_9}},//filtre reso
  {mux7.pin(14), {75, CHANNEL_10}},
  {mux7.pin(13), {75, CHANNEL_11}},
  {mux7.pin(12), {75, CHANNEL_12}},
  {mux7.pin(11), {75, CHANNEL_13}},
  {mux7.pin(10), {75, CHANNEL_14}},
  {mux7.pin(9), {75, CHANNEL_15}},
  {mux7.pin(8), {75, CHANNEL_16}},
};
CCPotentiometer fxsend2 [] = {
  {mux8.pin(0), {85, CHANNEL_16}},//delay time
  {mux8.pin(1), {86, CHANNEL_16}},//pingpong
  {mux8.pin(2), {87, CHANNEL_16}},//stereo width
  {mux8.pin(3), {88, CHANNEL_16}},//feedback
  {mux8.pin(4), {89, CHANNEL_16}},//hph
  {mux8.pin(5), {90, CHANNEL_16}},//lpf
  {mux8.pin(6), {91, CHANNEL_16}},//reverb send
  {mux8.pin(7), {92, CHANNEL_16}},//mix volume
  {mux8.pin(15), {24, CHANNEL_16}},//pre delay
  {mux8.pin(14), {25, CHANNEL_16}},//reverb decay
  {mux8.pin(13), {26, CHANNEL_16}},//reverb filter
  {mux8.pin(12), {27, CHANNEL_16}},//shelving gain
  {mux8.pin(11), {28, CHANNEL_16}},//hpf
  {mux8.pin(10), {29, CHANNEL_16}},//lpf
  {mux8.pin(9), {31, CHANNEL_16}},//mux volume
  {mux8.pin(8), {119, CHANNEL_16}},//pattern volume
};
CCPotentiometer ODPAN2 [] = {
  {mux9.pin(0), {81, CHANNEL_9}},//overdrive
  {mux9.pin(1), {81, CHANNEL_10}},
  {mux9.pin(2), {81, CHANNEL_11}},
  {mux9.pin(3), {81, CHANNEL_12}},
  {mux9.pin(4), {81, CHANNEL_13}},
  {mux9.pin(5), {81, CHANNEL_14}},
  {mux9.pin(6), {81, CHANNEL_15}},
  {mux9.pin(7), {81, CHANNEL_16}},
  {mux9.pin(15), {10, CHANNEL_9}},//pan
  {mux9.pin(14), {10, CHANNEL_10}},
  {mux9.pin(13), {10, CHANNEL_11}},
  {mux9.pin(12), {10, CHANNEL_12}},
  {mux9.pin(11), {10, CHANNEL_13}},
  {mux9.pin(10), {10, CHANNEL_14}},
  {mux9.pin(9), {10, CHANNEL_15}},
  {mux9.pin(8), {10, CHANNEL_16}},
};
CCPotentiometer fader2 [] = { //ici on déclare les faders avec comme vu plus haut le numéro de CC et le canal
  {mux10.pin(15), {7, CHANNEL_9}},//volume
  {mux10.pin(14), {7, CHANNEL_10}},
  {mux10.pin(13), {7, CHANNEL_11}},
  {mux10.pin(12), {7, CHANNEL_12}},
  {mux10.pin(11), {7, CHANNEL_13}},
  {mux10.pin(10), {7, CHANNEL_14}},
  {mux10.pin(9), {7, CHANNEL_15}},
  {mux10.pin(8), {7, CHANNEL_16}},
};
CCButtonLatched buttonmute2[] = { //ces lignes déclarent le mux
  {mux10.pin(0), {94, CHANNEL_16}},//numéro de bank correspondant/indique que le changement de bank change le canal midi (+8 car on a 8 adresses par bank)/pin sur laquelle le controleur est branché/numéro de cc/numéro de canal midi
  {mux10.pin(1), {94, CHANNEL_15}},
  {mux10.pin(2), {94, CHANNEL_14}},
  {mux10.pin(3), {94, CHANNEL_13}},
  {mux10.pin(4), {94, CHANNEL_12}},
  {mux10.pin(5), {94, CHANNEL_11}},
  {mux10.pin(6), {94, CHANNEL_10}},
  {mux10.pin(7), {94, CHANNEL_9}},
};
CCButtonLatched button1 = {19, {120, CHANNEL_16}};
//CCButtonLatched button2 = {20, {121, CHANNEL_16}};

CCButton button2 = {
  // Push button on pin 20:
  20,
  // General Purpose Controller #1 on MIDI channel 1:
  {121, CHANNEL_16},
};
  
void setup() {
  Control_Surface.begin(); // initialise la library surface de control
  /*usbmidi >> pipes >> midiser; // all incoming midi from USB is sent to serial
  usbmidi << pipes << midiser; // all incoming midi from Serial is sent to USB
  usbmidi >> pipes >> usbmidi; // all incoming midi from USB is looped back
  midiser << pipes << midiser;
  Control_Surface >> pipes >> usbmidi;
  Control_Surface << pipes << usbmidi;
  Control_Surface >> pipes >> midiser;
  Control_Surface << pipes << midiser;
  usbmidi.begin();
  midiser.begin();
 */
}                           
void loop() {
  

  Control_Surface.loop(); // Update the Control Surface

  //midiser.update();
}```

benwadub avatar Oct 13 '20 18:10 benwadub

There isn't anything that jumps out to me. Have you tried enabling debug output? Are you using a Teensy 3.6?

tttapa avatar Oct 13 '20 18:10 tttapa

i m on a teensy 4.0 I tried the debug to see on the monitor what kind of messages are sent. it s crazy my 2 controllers works fine individually but when I try them together nothings works at all even the one where the teensy is plugged IMG_2094

benwadub avatar Oct 13 '20 18:10 benwadub

Have you tried turning on the debug mode as explained in my first reply?

You could try testing the AnalogReadSerial example with all your muxes: https://tttapa.github.io/Control-Surface-doc/Doxygen/dc/d1b/1_8AnalogReadSerial_8ino-example.html

tttapa avatar Oct 13 '20 19:10 tttapa

Also check if disconnecting the extra muxes changes anything. Maybe the address lines are shorted by one of the muxes, or maybe the capacitance is too high when you have a fan-out of 10 on these lines.

tttapa avatar Oct 13 '20 19:10 tttapa

with analog read test with the 10 mux I get this on monitor but really don t understand what that mean! Capture d’écran 2020-10-13 à 21 21 56

benwadub avatar Oct 13 '20 19:10 benwadub

It just prints all values of the analog inputs of the muxes: the first 16 columns are the inputs of the first mux, the 16 columns are the inputs of the second mux, and so on.

Try moving some potentiometers to see if the corresponding value changes as expected. You might want to print some separator values between the columns of each mux.

tttapa avatar Oct 13 '20 19:10 tttapa

all the values are displaying too fast for I can see anychange, I stopped the auto scrolling to check the values each time I turn a knob but on the second controller nothing seems to happend I I didn't t understood how to enter in debug mode with the debug midi interface I see that controller number one works fine but the second not at all

benwadub avatar Oct 13 '20 20:10 benwadub

I tried to swap some pins used by mux 6 to 10 and that seems to work! apparently some pins on my teensy don t want to be mux dress pins! don t understand why!!

benwadub avatar Oct 13 '20 20:10 benwadub

You might have shorted them out previously, and the output drivers could be destroyed. There aren't any limitations on which pins you can for the mux address lines.

If the AnalogReadSerial example doesn't work, the MIDI controller examples won't work either, so it's important to fix that first.

To enter debug mode, you have to edit the file Control-Surface/src/AH/Settings/Settings.hpp, comment out the line #define DEBUG_OUT and uncomment the line #define DEBUG_OUT Serial .

tttapa avatar Oct 13 '20 20:10 tttapa