Arduino MIDI controller - not working

Hi guys
I'm working on a MIDI controller based on an arduino nano every, which is suppose to control an external unit through CC messages.
But it is not working

I think I build up everything in right way, but the thing is not working:

  • schematics is OK
  • connections are good
  • board is working
  • code is fine and uploaded
  • receiving unit is correctly set

this is the schematics and the code.

Any idea ? How can I check if the midi CC are really sent and going out the midi port ?

#include <MIDI.h>


MIDI_CREATE_DEFAULT_INSTANCE();
int waitforit = 300;
int midiChannel = 1;

#define BUTTON_PIN_1 3
#define BUTTON_PIN_2 2
#define BUTTON_PIN_3 4
#define BUTTON_PIN_4 5
#define led_g 10
#define led_b 9
#define led_r 8

void setup() {
   MIDI.begin(MIDI_CHANNEL_OMNI);

  pinMode(BUTTON_PIN_1, INPUT_PULLUP);
  pinMode(BUTTON_PIN_2, INPUT_PULLUP);
  pinMode(BUTTON_PIN_3, INPUT_PULLUP);
  pinMode(BUTTON_PIN_4, INPUT_PULLUP);
  pinMode(led_r, OUTPUT);
  pinMode(led_g, OUTPUT);
  pinMode(led_b, OUTPUT);
  
  digitalWrite(led_r, HIGH );
  
  //Serial.begin(9600);   // NB Serial monitor confligge con MIDI
}

void loop() {
  digitalWrite(led_r, HIGH );
  if (digitalRead(BUTTON_PIN_1) == LOW )  { sceneA(); }
  if (digitalRead(BUTTON_PIN_2) == LOW )  { sceneB(); }
  if (digitalRead(BUTTON_PIN_3) == LOW )  { sceneC(); }
  if (digitalRead(BUTTON_PIN_4) == LOW )  { sceneD(); }

/*
// monitor buttons ( NB Serial monitor confligge con MIDI)

  Serial.print(digitalRead(BUTTON_PIN_1));
  Serial.print(digitalRead(BUTTON_PIN_2));
  Serial.print(digitalRead(BUTTON_PIN_3));
  Serial.println(digitalRead(BUTTON_PIN_4));
   delay(100);
*/

}

  // ------------------------------------------------------------
  // -- FUNZIONI IN USO
void sceneA(){
    digitalWrite(led_r, LOW );
    digitalWrite(led_b, HIGH );
    MIDI.sendControlChange (43, 0, midiChannel); // vedi manuale Quad Cortex
    delay(waitforit);
    digitalWrite(led_r, HIGH );
    digitalWrite(led_b, LOW );
}

void sceneB(){
    digitalWrite(led_r, LOW );
    digitalWrite(led_b, HIGH );
    MIDI.sendControlChange (43, 1, midiChannel); // vedi manuale Quad Cortex
    delay(waitforit);
    digitalWrite(led_r, HIGH );
    digitalWrite(led_b, LOW );
}

void sceneC(){
    digitalWrite(led_r, LOW );
    digitalWrite(led_b, HIGH );
    MIDI.sendControlChange (43, 2, midiChannel); // vedi manuale Quad Cortex
    delay(waitforit);
    digitalWrite(led_r, HIGH );
    digitalWrite(led_b, LOW );
}

void sceneD(){
    digitalWrite(led_r, LOW );
    digitalWrite(led_b, HIGH );
    MIDI.sendControlChange (43, 3, midiChannel); // vedi manuale Quad Cortex
    delay(waitforit);
    digitalWrite(led_r, HIGH );
    digitalWrite(led_b, LOW );
}

The words "it's not working" give us no clue what to look for. Please give more dtails.

see this

once uploaded and conntected the receiving unit (it's this one) , is not doing anything.

No LED switching?

What do you mean?

Is no LED changing when activating inputs?

I'm not sure it was supposed to do that.

Buy I checked the input changing the code in such a way that I saw the buttons working in the serial monitor

if I try with

MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI);

it goes on uploading forever,

stuck with this

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\giuse\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200

On your board you have to try with ( Serial1 ):

MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);

Nano RP2040 Connect

This library adds MIDI I/O communications to an Arduino board.

Features

  • ....
  • Compatible with all Arduino boards (and clones with an AVR processor).

you will never reach your goal if you go in the opposite direction

and your schematic is not for USB MIDI suitable

I'm not getting: it's an Arduino nano every, not the rp2040

And I why schematics is not ok for MIDI?

look this
grafik

I got a Nano Every on a custom PCB with the schematics here below, nothing is connected to it.
image

Board is brand new, out of the box this afternoon: i successfully uploaded few sketches in the same configuration and the this

I cannot upload anything, even Blink, that I got this

Lo sketch usa 1118 byte (2%) dello spazio disponibile per i programmi. Il massimo è 49152 byte.
Le variabili globali usano 22 byte (0%) di memoria dinamica, lasciando altri 6122 byte liberi per le variabili locali. Il massimo è 6144 byte.
Esecuzione di un touch reset a 1200-bps sulla porta seriale COM3
"C:\Users\giuse\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\giuse\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega4809 -cjtag2updi -PCOM3  -b115200 -e -D "-Uflash:w:C:\Users\giuse\AppData\Local\Temp\arduino\sketches\7A03FD8D1A3CB1899BFCCE0B59BED572/Blink.ino.hex:i" "-Ufuse2:w:0x01:m" "-Ufuse5:w:0xC9:m" "-Ufuse8:w:0x00:m" {upload.extra_files}

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\giuse\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              1.07
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.07
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4809
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 1.07
         S_MCU hardware version: 1
         S_MCU firmware version: 6.07
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: jtagmkII_reset(): timeout/error communicating with programmer (status -1)
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)

avrdude done.  Thank you.

Caricamento non riuscito: errore durante il caricamento: exit status 1

image

What were you expecting?

What do you mean?

Nothing uploads: last line of the output is in Italian, but it says basically

uploas failed: error during uploading: exit status 1

I have merged your topics due to them having too much overlap on the same subject matter @piepolitb.

In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.

The reason is that generating multiple threads on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Thanks in advance for your cooperation.

Hook up a LED and resistor to the TX1 pin and check if it flashes when a message is supposed to go out. If you have a logic analyzer you can use that.

LED will not flash when a message is supposed to go out. because TO goes completely different way to using MIDI. as i said in post#13. his picture shows using Serial, but in the sketch is USB library used. further more, his board is 3.3V one, so there should be other resistors, as i showed in his crossposted topic.

1 Like