MIDI input using GPIO30 pin with Oopsy

Hi there,

I recently built a version of the FunBox and I’ve been struggling to get the MIDI input up and running usuing Oopsy.

The PCB for the FunBox has the 1/8" TRS MIDI input connected to GPIO30 with USART1 Rx.

However, when adding the additional field of “OOPSY_TARGET_HAS_MIDI_INPUT” in the json file, nothing seems to work.

Now, the custom json page seems to indicate:

  • With its value set to 1, this macro will provide a MIDI input stream that’s accessed like an audio input (e.g., in 3 midi if the board has two audio ins). This feature uses USART 1 on pins 13 and 14 of Daisy Seed.

Since pin 30 also has the USART functionality, how can I get Oopsy to compile my gen~ patch so I can incorporate MIDI into this build? Here is the json file I’ve been using with oopsy, along with a Max 9 patch that I’ve been using to test this featrure.

Any help with altering my json file or oopsy so I can get this up and running would be greatly appreciated!

Thanks!


{
“name”: “funbox”,
“som”: “seed”,
“audio”: {
“channels”: 2
},
“defines”: {
“OOPSY_TARGET_HAS_MIDI_INPUT”: 1
},
“components”: {
“sw1”: {
“component”: “Switch”,
“pin”: 14,
“pull”: “daisy::Switch::PULL_UP”
},
“sw2”: {
“component”: “Switch”,
“pin”: 13,
“pull”: “daisy::Switch::PULL_UP”
},
“sw3”: {
“component”: “Switch”,
“pin”: 7,
“pull”: “daisy::Switch::PULL_UP”
},
“sw4”: {
“component”: “Switch”,
“pin”: 10,
“pull”: “daisy::Switch::PULL_UP”
},
“sw5”: {
“component”: “Switch”,
“pin”: 2,
“pull”: “daisy::Switch::PULL_UP”
},
“sw6”: {
“component”: “Switch”,
“pin”: 4,
“pull”: “daisy::Switch::PULL_UP”
},
“sw7”: {
“component”: “Switch”,
“pin”: 25,
“pull”: “daisy::Switch::PULL_UP”
},
“sw8”: {
“component”: “Switch”,
“pin”: 26,
“pull”: “daisy::Switch::PULL_UP”
},
“dip1”: {
“component”: “Switch”,
“pin”: 1,
“pull”: “daisy::Switch::PULL_UP”
},
“dip2”: {
“component”: “Switch”,
“pin”: 3,
“pull”: “daisy::Switch::PULL_UP”
},
“dip3”: {
“component”: “Switch”,
“pin”: 5,
“pull”: “daisy::Switch::PULL_UP”
},
“dip4”: {
“component”: “Switch”,
“pin”: 6,
“pull”: “daisy::Switch::PULL_UP”
},
“knob1”: {
“component”: “AnalogControl”,
“pin”: 16
},
“knob2”: {
“component”: “AnalogControl”,
“pin”: 17
},
“knob3”: {
“component”: “AnalogControl”,
“pin”: 18
},
“knob4”: {
“component”: “AnalogControl”,
“pin”: 19
},
“knob5”: {
“component”: “AnalogControl”,
“pin”: 20
},
“knob6”: {
“component”: “AnalogControl”,
“pin”: 21
},
“exp”: {
“component”: “AnalogControl”,
“pin”: 15
},
“led1”: {
“component”: “Led”,
“pin”: 22
},
“led2”: {
“component”: “Led”,
“pin”: 23
}
},
“aliases”: {
“sw1_Left”: “sw1”,
“sw1_Right”: “sw2”,
“sw2_Left”: “sw3”,
“sw2_Right”: “sw4”,
“sw3_Left”: “sw5”,
“sw3_Right”: “sw6”,
“footswitch1”: “sw7”,
“footswitch2”: “sw8”,
“dip1”: “dip1”,
“dip2”: “dip2”,
“dip3”: “dip3”,
“dip4”: “dip4”,
“knob”: “knob1”,
“ctrl”: “knob1”,
“ctrl1”: “knob1”,
“ctrl2”: “knob2”,
“ctrl3”: “knob3”,
“ctrl4”: “knob4”,
“ctrl5”: “knob5”,
“ctrl6”: “knob6”,
“ctrl7”: “exp”,
“led_a”: “led1”,
“led_b”: “led2”
}
}

Hi Zack!

I think the issue is that Oopsy is assuming you’re using pin D14 (USART1_RX) for MIDI.
There should be a way to change this to pin D30. I currently don’t know how, so I can check with the team and get back to you. Thank you for the wait!

I had a suspicion that may have been the issue. But no worries, I appreciate the help. Thank you!

Thanks for the wait!

So it is possible to change the pins.
The code that initializes the UART is right here: https://github.com/electro-smith/oopsy/blob/5c9b1c83210cb1a9680087b32f5b7c6bdda71ac8/source/genlib_daisy.h#L495-L512.

And here’s a great document made by a community member for figuring out the STM32H7 pin name. For example, D14 (USART1_RX) is PB7 so that’s why it’s set as config.pin_config.rx = {DSY_GPIOB, 7}; in that genlib_daisy.h file.

In your local copy of Oopsy, you can just change those pins to what you want (unless there’s a conflict that is, but we don’t think Oopsy’s using D30 for example).

Thank you for the resources and guidance. Much appreciated!

For some reason I’m running into a little hurdle when trying to test this out because of this section in the json file, regardless of the pin’s value with PSY-GPIOB.

“defines”: {
“OOPSY_TARGET_HAS_MIDI_INPUT”: 1
},

When I remove "“OOPSY_TARGET_HAS_MIDI_INPUT”: 1 from the json file it compiles perfectly fine, but when trying to add it in despite the tutorials instruction it causes the compile to fail. I’m not exactly sure what I’m doing wrong currently when it comes to that. If I can figure out a solution to this I’ll be sure to update whether the updated pin values work for the MIDI.


{
  "name": "funbox",
  "som": "seed",
  "audio": {
  "channels": 2
  },
  "defines": {
        "OOPSY_TARGET_HAS_MIDI_INPUT": 1
  },
  "components": {
      "sw1": {  
          "component": "Switch",
          "pin": 14,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw2": {
          "component": "Switch",
          "pin": 13,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw3": {  
          "component": "Switch",
          "pin": 7,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw4": {
          "component": "Switch",
          "pin": 10,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw5": {   
          "component": "Switch",
          "pin": 2,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw6": {
          "component": "Switch",
          "pin": 4,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw7": {
          "component": "Switch",
          "pin": 25,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw8": {
          "component": "Switch",
          "pin": 26,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip1": {
          "component": "Switch",
          "pin": 1,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip2": {
          "component": "Switch",
          "pin": 3,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip3": {
          "component": "Switch",
          "pin": 5,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip4": {
          "component": "Switch",
          "pin": 6,
          "pull": "daisy::Switch::PULL_UP"
      },
      "knob1": {
        "component": "AnalogControl",
        "pin": 16
      },
      "knob2": {
        "component": "AnalogControl",
        "pin": 17
      },
      "knob3": {
        "component": "AnalogControl",
        "pin": 18
      },
      "knob4": {
        "component": "AnalogControl",
        "pin": 19
      },
      "knob5": {
        "component": "AnalogControl",
        "pin": 20
      },
      "knob6": {
        "component": "AnalogControl",
        "pin": 21
      },
      "exp": {
        "component": "AnalogControl",
        "pin": 15
      },
      "led1": {
        "component": "Led",
        "pin": 22
      },
      "led2": {
        "component": "Led",
        "pin": 23
      }
  },
  "aliases": {
    "sw1_Left": "sw1",
    "sw1_Right": "sw2",
    "sw2_Left": "sw3",
    "sw2_Right": "sw4",
    "sw3_Left": "sw5",
    "sw3_Right": "sw6",
    "footswitch1": "sw7",
    "footswitch2": "sw8",
    "dip1": "dip1",
    "dip2": "dip2",
    "dip3": "dip3",
    "dip4": "dip4",
    "knob": "knob1",
    "ctrl": "knob1",
    "ctrl1": "knob1",
    "ctrl2": "knob2",
    "ctrl3": "knob3",
    "ctrl4": "knob4",
    "ctrl5": "knob5",
    "ctrl6": "knob6",
    "ctrl7": "exp",
    "led_a": "led1",
    "led_b": "led2"
  }
}

I see, so your issue is that the patch is not compiling possibly due to a problem with the json file. In that case, changing the pin number won’t affect this issue (of course, it’ll eventually help once you can compile!).

It looks ok from the glance. I can have a closer look and recreate the issue when I get a chance later.
In the meantime, I recommend checking out the json file for the Daisy Pod which also uses MIDI and see if there’s anything different: json2daisy/src/json2daisy/resources/pod.json at main · electro-smith/json2daisy · GitHub

So the suggestion to check out the Daisy Pod’s json file did the trick!

I can also confirm that changing the DSY_GPIOB pins to this works as well.

config.pin_config.rx = {DSY_GPIOB, 15};
config.pin_config.tx = {DSY_GPIOB, 14};

Here’s the fully updated json file.

{
	"name": "blackbox",
	"som": "seed",
	"defines": {
		"OOPSY_TARGET_HAS_MIDI_INPUT": 1
	},
	"display": {},
	"audio": {
    "channels": 2
  },
  "components": {
      "sw1": {  
          "component": "Switch",
          "pin": 14,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw2": {
          "component": "Switch",
          "pin": 13,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw3": {  
          "component": "Switch",
          "pin": 7,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw4": {
          "component": "Switch",
          "pin": 10,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw5": {   
          "component": "Switch",
          "pin": 2,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw6": {
          "component": "Switch",
          "pin": 4,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw7": {
          "component": "Switch",
          "pin": 25,
          "pull": "daisy::Switch::PULL_UP"
      },
      "sw8": {
          "component": "Switch",
          "pin": 26,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip1": {
          "component": "Switch",
          "pin": 1,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip2": {
          "component": "Switch",
          "pin": 3,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip3": {
          "component": "Switch",
          "pin": 5,
          "pull": "daisy::Switch::PULL_UP"
      },
      "dip4": {
          "component": "Switch",
          "pin": 6,
          "pull": "daisy::Switch::PULL_UP"
      },
      "knob1": {
        "component": "AnalogControl",
        "pin": 16
      },
      "knob2": {
        "component": "AnalogControl",
        "pin": 17
      },
      "knob3": {
        "component": "AnalogControl",
        "pin": 18
      },
      "knob4": {
        "component": "AnalogControl",
        "pin": 19
      },
      "knob5": {
        "component": "AnalogControl",
        "pin": 20
      },
      "knob6": {
        "component": "AnalogControl",
        "pin": 21
      },
      "exp": {
        "component": "AnalogControl",
        "pin": 15
      },
      "led1": {
        "component": "Led",
        "pin": 22
      },
      "led2": {
        "component": "Led",
        "pin": 23
      }
  },
  "aliases": {
    "sw1_Left": "sw1",
    "sw1_Right": "sw2",
    "sw2_Left": "sw3",
    "sw2_Right": "sw4",
    "sw3_Left": "sw5",
    "sw3_Right": "sw6",
    "footswitch1": "sw7",
    "footswitch2": "sw8",
    "dip1": "dip1",
    "dip2": "dip2",
    "dip3": "dip3",
    "dip4": "dip4",
    "knob": "knob1",
    "ctrl": "knob1",
    "ctrl1": "knob1",
    "ctrl2": "knob2",
    "ctrl3": "knob3",
    "ctrl4": "knob4",
    "ctrl5": "knob5",
    "ctrl6": "knob6",
    "ctrl7": "exp",
    "led_a": "led1",
    "led_b": "led2"
  }
}

Thank you very much for all the help! It was the last piece of the puzzle in regards to getting this project to work with Gen~, so it’s nice to finally have it all out there!

1 Like

YES!! Happy to hear that it’s working :smiley: