add a blink code in the MIDI sketch
Code: Select all
#include <USBComposite.h>
const uint8_t notes[] = {60, 62, 64, 65, 67, 69, 71, 72, 61, 63, 66, 68, 70};
const int numNotes = sizeof(notes)/sizeof(*notes);
uint8_t ledpin = PUT_YOUR_LED_PIN_HERE; //e.g. PAxx, or PC13 etc
void setup() {
pinMode(ledpin, OUTPUT);
USBComposite.setProductId(0x0031);
midi.begin();
// turn on the led, I'm assuming that HIGH is on
digitalWrite(ledpin, HIGH)l;
while (!USBComposite);
//turn off the LED
digitalWrite(ledpin, LOW)l;
}
void loop() {
for (int i=0;i<numNotes;i++) {
midi.sendNoteOn(0, notes, 127);
delay(200);
midi.sendNoteOff(0, notes, 127);
// blink the led
digitalWrite(ledpin, ! digitalRead(ledpin) );
}
}
this is so that the led should turn on before that
if it get past this, the led goes off and it should start blinking.
if the LED is constantly on maybe it is stuck before
, if the led blinks and nothing is seen at the USB side.
There may be a problem at the USB connector. or there is another possibility, that your system clock is running at the wrong frequency, this
has to do with the crystal on the board, the core codes expect a 8 Mhz crystal. If it is different, you would need to dig into the core codes to setup the PLL multipliers for HSE for that different frequency crystal.
If the LED did not even turn on, the sketch did not even reach after midi.begin(), it is stuck before that.
Then move that
Code: Select all
// turn on the led, I'm assuming that HIGH is on
digitalWrite(ledpin, HIGH)l;
further up until it turns on. If you get to the top, i.e. void setup() and the LED did not turn on.
your sketch did not run, something is stuck trying to initialize pheriperials or even just the cpu.
one common problem for boards that is not in prior use is the crystal frequency etc, it can get stuck and unable to start the clock (i.e. HSE)
this would require fixes for the PLL multipliers or even the board crystal circuit in worse cases.
Search for the schematic (e.g. google) for your board and post it. So that others can help to review and comment.
if you can't find the schematic take a look here to see if you can find your board
https://stm32-base.org/boards/
or even take a photo of the board (top and bottom), and maybe post it in imgur.com and link it here. Take close up especially the crystal find out what is the Mhz of the crystal, the usb connector circuit etc. There are some nasty boards where the usb connector is just use to supply power and they did not connnect even the usb pins.