thekikgen / usbmidiklik Goto Github PK
View Code? Open in Web Editor NEWA robust USB MIDI Arduino firmware, with a dual bootloader, based on the LUFA library
A robust USB MIDI Arduino firmware, with a dual bootloader, based on the LUFA library
I'm trying to send:
F077 7777 0C08 0F01 0309 0006 08F7
Vendor Id:8F13
Product Id : 9068
Mac osx recognize device as:
ID product: 0x9068
ID vendor: 0xF139
I'm trying to send:
F077 7777 0C08 0F01 0309 0006 08F7
Vendor Id:8F13
Product Id : 9068
Mac osx recognize device as:
ID product: 0x9068
ID vendor: 0xF139
Hello...I have an Arduino Mega and I want it to send and receive midi via USB....that works very well...according to what I read, this firmware can send messages via Midi Din Out at the same time
But I don't understand how to be able to receive via Midi Din In and send that message via USB Out.
I would like to know if this can be enabled at runtime.
My other question is...can I disable Midi Din Out at runtime?
I hope you can understand me
Thank you very much for your work
Greetings
Hi,
First, thank you for your hard work. The firmware works perfectly for me -- I managed to build it for the Mega using EsGeh's pull request.
I'd like to use the dual mode advertised in the README:
For more convenience when updates are needed, a "dual mode" is embedded, allowing to switch back to the USB serial : when the PB2/MOSI pin of the ATMEGA8U2 is connected to ground, the Arduino is a classical one again, and you can change and upload a new firmware in the ATMEGA328P (UNO) with the standard Arduino IDE.
However, I can't seem to achieve that. I tried both the following bridging (reference in links): GND to Digital 51, GDN to ICSP PB2. None of them produced the expected result.
Am I missing something?
Thanks!
when i try to send a PC message it sends last sent Data byte in midi data[0].
Step to reproduce:
with hiduno works. (hiduno has problem with PC inputs instead USBMidiKliK works great!)
Hi and thank you for your code.
I made a Jupiter-8 (Arturia plugin) controller over a MEGA. Everything works fine when I tried your software over an UNO (reset Arduino, Atmel Flip, etc) but now, i have to inject it over the MEGA and I do not know how can i do it. I do not have hex file for MEGA and I do notknow how compilate it. I read #8 post and I spent half of the morning figuring out the way to do it, but I am not capable. Is it a process involving the command line? I am a newby in programing. Thank you
CC-NC is not remotely an open source license by OSI standards, and it is also not a license designed for nor appropriate for source code. It was made for other kinds of media, and does not contain verbage appropriate for source code. Creative Commons itself strongly warns against using CC licenses, especially NC, for code; and FSF also says that they are very bad.
At least it's not CC-SA-NC, which is in fact incompatible with Arduino's own LGPL license...
I understand the desire to prevent companies from using your code, though by doing so violates open source standards. The nearest thing philosophically is probably GPL: companies can use your code in house, but they can't sell anything that uses it without giving back. I would ask that you change to at least GPL 3.
I tried compiling by myself following the wiki but no luck.
Could you please add a compiled version of the firmware for arduino mega?
Thank you for sharing this project
All the best
Hello! Best regards from Chile.
Well this is not an issue at all... I would like to ask for help. Is there a way that you could upload a build hex file? I Don't know how to compile it.
I know it has to be made using WINAVR or withina avr-gcc environment that I don't know how to execute since I usually only work with arduino IDE.
Hope you can helpme or maybe explain me how to do it. Thanks so much Sr.
I would like to upload it to an ATMEGA16U2 on my Arduino Uno... But also, on a near future, i would like to buy standalone's atmegas16U2... could i upload this firmware just by USB (obiusly, building the circuit posted on your schematic). Mi idea is to use it to interface USB MIDI on a STM32F401. Thanks!
First of all thank you for this extremely solid piece of work.
I wonder if you (or some other kind soul) can help a beginner out with an custom enhancement. I hope it's ok to open an issue for questions like this, if not, please just close it.
What I want to do, is to add an analog pin listener to USBMidiKliK. When the value of any of 4 potentiometers change, the value should be mapped to MIDI CC controller 1-4 values 0-127, put in a neat midiPacket_t, inserted into the ring buffer and shipped to Serial or USB.
I made some tweaks to naught101/midi_knobs/midi_knobs.ino and now the general logic works as I need it to, but I need guidance how to correctly implement it in the USBMidiKlik architecture.
I have integrated the modified naught101 code, and added an #include wiring_analog.c (probably a completely backwards way to do this include :/ ) to be able to utilize the analogRead() function, from the AVR Core (ArduinoCore-avr-master), and I basically added the following code to USBMidiKlik_dual.cpp:
///////////////////////////////////////////////////////////////////////////////
// PROCESS POTMETER TO SERIAL/USB
// ----------------------------------------------------------------------------
// Check whether any potmeters has changed
///////////////////////////////////////////////////////////////////////////////
#include "wiring_analog.c"
#define N_POTS 1
const uint8_t MIDICC = 0x0B;
const int potPins[] = {0, 1, 2, 3};
const uint8_t potCC[] = {0x0A, 0x0B, 0x0C, 0x0D};
uint8_t potVals[N_POTS];
uint8_t potValsPrev[] = {0, 0, 0, 0};
static int map(int x, int x1, int x2, int y1, int y2){
return (x - x1) * (y2 - y1) / (x2 - x1) + y1;
}
static void SendCC(byte channel, byte control, byte value){
MIDI_EventPacket_t MIDIEvent = {0x0B, 0xB0 | channel, control, value};
RoutePacketToTarget(FROM_USB, (midiPacket_t *)&MIDIEvent);
RoutePacketToTarget(FROM_SERIAL, (midiPacket_t *)&MIDIEvent);
}
static void ProcessPots(){
for (int i=0;i<N_POTS;i++) {
if (abs(potValsPrev[i] - potVals[i]) > 1)
{
SendCC(0, potCC[i], potVals[i]);
potValsPrev[i] = potVals[i];
}
}
}
static void ReadPots(){
for (int i=0; i < N_POTS; i++) {
int val = analogRead(potPins[i]);
int mval = (uint8_t)(map(val, 0, 1023, 0, 127));
potVals[i] += (mval - potVals[i])/4;
}
}
///////////////////////////////////////////////////////////////////////////////
I then tried to find where to properly hook it up, and i ended up adding calls to ReadPots() and ProcessPots() in the infinite loop in ProcessMidiUSBMode() which seemed most suitable.
for ( ;; ) {
...
ProcessMidiToUsb();
ProcessUsbToMidi();
ReadPots();
ProcessPots();
MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
USB_USBTask();
}
Much to my surprise my changes actually compiles, but as very much expected, operating the CC potentiometer on my breadboard does not seem to send any MIDI. The Pro Micro still presents itself to my laptop as a USBMidiKlik device, so I do not believe I have completely broken the code, but my own changes do not work.
I think my first, very basic question on this long story is, if my approach to creating sending off the CC midi packages using RoutePacketToTarget, is anywhere near the correct solution for the task at hand, assuming the CC logic is working.
Hi,
When trying to make I get the error:
cc1plus.exe: error: unrecognized command line option "-std=gnu++11"
Environment is Windows 7 64bits with WinAVR 2010-01-20 (latest available version from SourceForge).
Is this a problem with the gcc version of WinAVR? How to troubleshoot this issue?
Thanks!
Hi!
I'm wanting to switch between firmware's based on a command i can send to the 16u2.
So normally it shows up as a midi controller but when i hit "Update" on my custom avrdude program it switches the firmware on the 16u2 and then updates my 4809 to the latest code and then switches back to the midi firmware.
is this doable with your code?
Hello,
I have sent you a message on your personnal blog, I tried to compile your project to the ATmega 16u2 chip, but I can't find the proper way to upload it (or even compile it). Do you have a schema of connections, a way of doing that properly, or a tutorial for a similar project that also work on yours ?
Thanks a lot
Using a arduino wifi rev2 and would like to use the same functionality as this for 16u2.
Successfully flashed the 16u2 on an Arduino Uno R3 clone (Elegoo), but after disconnecting the ISP programmer and unplugging/reconnecting the USB cable to the Uno, the device was not detected on the USB bus.
It wasn't just unrecognized or reported as malfunctioning, Windows 10 didn't detect that a new USB device had been plugged in. (This happened both with and without a jumper across ISP pins 4/6.)
Note: The same steps using 'mocolufa' works for me, leading me to believe it's a bug or incompatibility with USBMidiKliK as opposed to user error.)
> .\avrdude.exe -c usbtiny -P usb -p m16u2 -b 19200 -U flash:w:USBMidiKliK_dual.hex:i
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.03s
avrdude.exe: Device signature = 0x1e9489 (probably m16u2)
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: reading input file "USBMidiKliK_dual.hex"
avrdude.exe: writing flash (8644 bytes):
Writing | ################################################## | 100% 10.57s
avrdude.exe: 8644 bytes of flash written
avrdude.exe: verifying flash memory against USBMidiKliK_dual.hex:
avrdude.exe: load data flash data from input file USBMidiKliK_dual.hex:
avrdude.exe: input file USBMidiKliK_dual.hex contains 8644 bytes
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 7.27s
avrdude.exe: verifying ...
avrdude.exe: 8644 bytes of flash verified
avrdude.exe: safemode: Fuses OK (E:F4, H:D9, L:FF)
avrdude.exe done. Thank you.
Hey!
How can I use the firmware with a Arduino Mega?
So far I have been using the version for Uno.
This works, somehow.
But when I turn the device into USB serial mode, the device is recognized as an Arduino Uno, which leads to difficulties.
Is there a simple solution?
I.e., one time I connect it via USB to a laptop running Win10, it may be detected as a COM port, and either TX or RX led is lit at the same time. The next time I connect it, it may be detected as a midi device. Behavior is random.
When Uno is detected as a midi device, firmware works fine. Thank you for your work :)
For some reason my code sending SysEx is missing bytes, this seems to happen when sending 6 bytes, but not 7
stream.write( 0xF0 );
stream.write( 0x7F );
stream.write( 0x7F );
stream.write( 0x06 );
stream.write( 0x02 );
stream.write( 0xF7 );
522653696: 0xf07f7ff7
stream.write( 0xF0 );
stream.write( 0x7F );
stream.write( 0x7F );
stream.write( 0x06 );
stream.write( 0x02 );
stream.write( 0x02 );
stream.write( 0xF7 );
527349760: 0xf07f7f060202f7
Sorry if this is the wrong place but I cannot get this script working on. OSX:
#7
I have fish v3.40 install from homebrew, so the only thing I have changed is the fish path in init.fish to:
/usr/local/bin/fish
The script runs but produces the following error:
./scripts/init.fish readlink: illegal option -- m usage: readlink [-n] [file ...] usage: dirname path readlink: illegal option -- m usage: readlink [-n] [file ...] usage: dirname path mkdir: /dependencies: Read-only file system ERROR while downloading 'https://github.com/EsGeh/git_deps/raw/755daa23dd0b17cc986d4a1339e93ef5ec621fc7/get_deps.fish'
Any help appreciated
TIA
Hi,
First i want to thank you for all your work, it's great !!
I tried to change the name of the midi device without success.
the name is stuck to USA MidiKliK Build-646
I edit the makefile and build a new .hex file (i see -DMIDI_DEVICE_PRODUCT_STRING="USA Miditest Build-654 " in compilation log)
I connect my Arduino Uno R3 in DFU mode and upload the new .hex file with
sudo dfu-programmer atmega16u2 erase
dfu-programmer atmega16u2 flash USBMidiKliK_dual.hex
dfu-programmer atmega16u2 reset
I disconnect / reconnect the Arduino but the name is still USA MidiKliK Build-646
I tried to upload the sketch midiUsbConverter.ino and call SetProductString() in the setup()
I tried to use the OSX app SysExLibrarian (https://www.snoize.com/SysExLibrarian/) to upload the sysex of your readme (F0 77 77 77 0B 55 53 42 20 4D 69 64 69 4B 6C 69 4B F7) and reboot the Arduino
In all cases, device name is still "USA MidiKliK Build-646"
Do you have any idea of what is causing this ? Thanks you very much for you help
Hi, nice project.
Can you please clarify how the dual boot function is supposed to work? It looks like MISO is on pin 12/PB4, not PB2.
https://www.circuito.io/blog/arduino-uno-pinout/
I tried to shorting this pin to ground whilst attaching USB connection (to power board), but it remained as Midi-Kik device. I had flashed the pre-build firmware from git.
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0cf3:e301 Atheros Communications, Inc.
Bus 001 Device 004: ID 187c:0527 Alienware Corporation
Bus 001 Device 003: ID 0c45:6708 Microdia
Bus 001 Device 075: ID 2912:1967 <------------------------------------ no change
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ aconnect -l
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
Connecting To: 129:0
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'USB MidiKliK Build-646' [type=kernel,card=1]
0 'USB MidiKliK Build-646 MIDI 1'
client 128: 'bridge' [type=user,pid=9971]
0 'playback
Would be nice to have a few lines how to build the bootloader, for unexperienced users like me.
(naively typing make
leads to an error because of hardcoded windows (!) path...)
Does this scheme work as a usb host?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.