I've had a friend help me create a avrdude based windows program that lets me reprogram my arduino with new code and thats working great!
But I'm also wanting my device to show up as a compliant USB MIDI device so it can be used as a controller on the computer or other devices.
I want it to show up correctly as a midi device but also when i hit update in my program it will flash the new program onto my main chip and my understanding is that if i hit program with say mocolufa firmware installed its not going to be able to update my main controller?
I want to do both without having to do a reboot or any steps, just does it automatically.
What would be my best path to achieving what I need? Do i need to just have a custom firmware made for my 16u2?
Do you mean use LUFA to make the custom firmware?
I'm using a 4809 with 16u2 for USB communication.
It seems to me it would just be a think of if the 16u2 receives midi messages it converts it appropriately but if it connects to avrdude or receives a specific command message then it converts usb ttl to serial to upload the needed hex file?
Thanks!! It seems like that is very close to what i want but you do have to ground out a pin to change modes. Ideally i would love for it to be a plug in, hit update, and its back to being a midi controller again. So there is zero effort on the user and i'm not sure how to accomplish that with the klik firmware.
Maybe i can edit the Kkik source so that when it receives a specific message from my command software it switches modes automatically?
PieterP:
I would expect that the author of the USBMidiKlik firmware had his reasons not to do this, maybe you can open an issue on GitHub and ask him?
Personally, I would just connect a push button to that pin, and call it a day. No need to twiddle around with multiple USB functions etc.
Good thought, i tried that and hopefully they are still active and can help me out. This is going to be a customer product so a button just for programming isn't ideal. I may have to just pay for some custom code which would be fine by me if it gets me what i want.
PieterP:
Wouldn't using a board that supports MIDI over USB natively (Leonardo, Teensy, Due, Micro, Zero ...) be a much cleaner solution?
It very well may be. I've already built the device so it would be annoying to switch (failed to think of this ahead)
but definitely if thats the best solution thats what i will do.
I'm pretty sure it won't be as annoying as rewriting USB firmware.
What does your code do? What libraries does it use? If you post it, we may be able to estimate the amount of work.
Do you have any experience with writing USB code?
PieterP:
I'm pretty sure it won't be as annoying as rewriting USB firmware.
What does your code do? What libraries does it use? If you post it, we may be able to estimate the amount of work.
Do you have any experience with writing USB code?
I have absolutely zero experience with hard coded usb orientated stuff.
My only experience is writing in basic and then arduino so far.
These are the libraries i'm currently using. #include <LiquidCrystal.h> // includes the LiquidCrystal Library #include <EEPROM.h> #include <Wire.h>
Matthewseffects:
I have absolutely zero experience with hard coded usb orientated stuff.
My only experience is writing in basic and then arduino so far.
I wouldn't recommend trying to edit USBMidiKlik in that case.
Matthewseffects:
These are the libraries i'm currently using. #include <LiquidCrystal.h> // includes the LiquidCrystal Library #include <EEPROM.h> #include <Wire.h>
All of those libraries are supported on all Arduino boards, as far as I know.
You could try compiling your code for Leonardo, then you'll now if you have to rewrite anything.
For MIDI, you can then use the MIDIUSB library instead of serial MIDI.
PieterP:
I wouldn't recommend trying to edit USBMidiKlik in that case.
All of those libraries are supported on all Arduino boards, as far as I know.
You could try compiling your code for Leonardo, then you'll now if you have to rewrite anything.
For MIDI, you can then use the MIDIUSB library instead of serial MIDI.
Looking more at
it looks like i can send it a certain midi message and it will change to programming mode! This should be perfect!
I'll test it out but that should be exactly what i need thanks!!