MIDIFighter Source
MIDIFighter Source Posted on: 29.06.2010 by Odette Weymouth I just wanted to say thank you for making the source code so easy to read, I have been trying to dissect everything, and the comments have been invaluable.Im pretty new to micro-controller programming, so I do have some questions: Where are the input/output pins specified? (Im sure its been starring me in the face this whole time) How does the TLC5924 work? What does the ADC file do? Im sure Ill be adding more questions to this. Thanks for your time, Ben. | |
Arcelia Siebeneck 12.10.2011 |
Originally Posted by MiL0
|
robert chanda 18.08.2010 |
Originally Posted by BenitoIsAwesomr
http://code.google.com/p/lufa-lib/so...vel/Endpoint.c The prototype declaration for Endpoint_Write_Stream_LE() should have it's last argument have a "default value", e.g. void Endpoint_Write_Stream_LE(buffer, length, callback=NULL); but this is controlled in the latest LUFA libraries by a compile-time flag called "NO_STREAM_CALLBACKS". If this is defined anywhere in the makefile then the callbacks are not declared. The Midifighter doesn't use the stream callbacks so feel free to add that flag to the makefile. Another reason for me to update the source. *le sigh* |
danny jeff 10.07.2010 | Which software or IDE or whatever do you used to edit the code? notepad |
Kimberly Lewark 06.11.2011 | Great! No problem. I assume you were using 111009 before? I actually ran into this myself but had forgotten that the midifighter does not currently use the latest version of lufa. Feel free to get in touch if you have any firmware related questions. I'm pretty familiar with it at this stage. |
Samella Vache 06.11.2011 | I've tried the LUFA101122 library and had no more errors. Thank you. |
Kimberly Lewark 06.11.2011 | Hrm, sorry, I have no idea as I am using the same version without problem (on windows). I assume you didn't change anything related before compiling and that you are using the makefile to build? Code:
C:\Users\dan\Desktop\mf>avr-gcc -v Using built-in specs. Target: avr Configured with: ../gcc-4.3.3/configure --enable-win32-registry=WinAVR-20100110 --with-gmp=/usr/local --with-mpfr=/usr/local --prefix=/c/WinAVR --target=avr --e nable-languages=c,c++,objc --with-dwarf2 --enable-doc --disable-shared --disable -libada --disable-libssp --disable-nls --with-pkgversion='WinAVR 20100110' --wit h-bugurl='URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=br owse' Thread model: single gcc version 4.3.3 (WinAVR 20100110) As a matter of interest, cd into the LUFA directory and run "make" (do "make clean" first if its not already clean). Does this build without error? |
Samella Vache 06.11.2011 | i use avr-gcc (GCC) 4.3.3 I've tried the old LUFA091122 library and only had these warnings: Makefile:712: warning: overriding commands for target `doxygen' LUFA091122/LUFA/makefile:53: warning: ignoring old commands for target `doxygen' Makefile:717: warning: overriding commands for target `clean_doxygen' LUFA091122/LUFA/makefile:58: warning: ignoring old commands for target `clean_doxygen' |
Kimberly Lewark 06.11.2011 | What compiler version are you using? |
Samella Vache 06.11.2011 | If i try to build the firmware i get the following error: Compiling C: menu.c menu.c:136: error: expected identifier or '(' before 'const' menu.c:136: error: expected ')' before '<' token menu.c:136: error: expected ')' before '?' token menu.c:137: error: expected identifier or '(' before 'const' menu.c:137: error: expected ')' before '>' token menu.c:137: error: expected ')' before '?' token make: *** [menu.o] Error 1 These are the two lines of code: inline uint8_t MIN(const uint8_t a, const uint8_t b) { return a<b ? a : b ; } inline uint8_t MAX(const uint8_t a, const uint8_t b) { return a>b ? a : b ; } Anyone know how to fix this? Thank you for helping. |
Arcelia Siebeneck 12.10.2011 |
Originally Posted by MiL0
|
Arcelia Siebeneck 16.09.2011 | did anyone ever port the midifighter source to teensyduino? |
Vernie Beharry 10.11.2010 | Definatley looking into expanding. . .Keeping an eye out on this. . .but I do have a few questions about expanding (I'm SOOO in over my head on this). . What I'm trying to do is add a few more inputs rather than the standard 4 Digital + 4 Analog buttons. In my case, I'm trying to add a couple more analog inputs (2 arcade buttons, 4 Rotaries, and 2 Faders.) Will the use of a MUX Breakout board from Sparkfun be okay to expand it a bit further? http://www.sparkfun.com/commerce/pro...oducts_id=9056 |
Odette Weymouth 09.09.2010 | Im still working on this, just super slowly, hehe, school has started so I havent got much time, Ive been trying to efficiently read a bunch of buttons, I believe this may be the hardest thing to do, because the Midifighter latches and shifts, so I cant just steal its code Anyways, I'm still chugging along, Ben |
Odette Weymouth 17.08.2010 | As I suspected! I was worried I missed something, thanks for answering! I have very rudimentary midi out working (No buttons, just a loop) that stops when it gets midi in (It has an LED programmed to blink when it does receive midi in), I still have a long ways to go, and not much time to work with school starting up :| Anyways! |
robert chanda 18.08.2010 |
Originally Posted by BenitoIsAwesomr
http://code.google.com/p/lufa-lib/so...vel/Endpoint.c The prototype declaration for Endpoint_Write_Stream_LE() should have it's last argument have a "default value", e.g. void Endpoint_Write_Stream_LE(buffer, length, callback=NULL); but this is controlled in the latest LUFA libraries by a compile-time flag called "NO_STREAM_CALLBACKS". If this is defined anywhere in the makefile then the callbacks are not declared. The Midifighter doesn't use the stream callbacks so feel free to add that flag to the makefile. Another reason for me to update the source. *le sigh* |
Odette Weymouth 17.08.2010 | So I was just wondering about the function: Code:
Endpoint_Write_Stream_LE Code:
Endpoint_Write_Stream_LE(&midi_event, sizeof(midi_event)); (Once I added a callback, just NULL, it worked fine, I was just wondering) Im still terribly terrible at programming, but Im getting more familiar with LUFA, and going back and forth between the demos and midifighter source has been helping a lot, thanks again for commenting it so well Thanks, Ben EDIT: Callback as the last argument, so its: Code:
Endpoint_Write_Stream_LE(Buffer, Length, Callback); |
Odette Weymouth 10.08.2010 | Well, I just got my Teensy today, and I got it to connect as a USB device, my plan is to base my code of the LUFA MIDI demo, and add on, probably referencing the Midifighter source as I go. |
Odette Weymouth 03.08.2010 | I just wanted to update, I'm still working on this, but I'm taking some time to learn C, I kinda figured I need a better understanding if I really wanna pulll this off! |
danny jeff 10.07.2010 | Which software or IDE or whatever do you used to edit the code? notepad |
robert chanda 09.07.2010 | Oops, that's been there for a while. Better fix that in the Sourceforge stream. Yes, I renamed my LUFA directory for no good reason, mainly so I could have several in the same directory as I upgraded the source from one version of LUFA to another. |
Adolf Hit 09.07.2010 | I had this problem and fixed it via editing the make file, there were a number of references which needed to be changed ... |
danny jeff 09.07.2010 | Hello! I had the same problem, it seems that the makefile points and old library
# Path to the LUFA library
LUFA_PATH = ./LUFA091122 i solve the problem downloading the version 091122. http://lufa-lib.googlecode.com/files/LUFA-091122.zip its important to delete the space between LUFA and the data otherwise doenst work for me. I tried to modify the makefile but give me a separator error, so decide to change the library instead hahaah Hope it works for you |
Odette Weymouth 04.07.2010 | So how sad is it I cant even get the original source to compile? Haha I followed the tutorial to the letter, I tried older versions of LUFA (The version that the makefile specifies), I reinstalled WinAvr, re-downloaded the Midifighter source, but everytime I try I get this: Code:
-------- begin -------- avr-gcc (WinAVR 20100110) 4.3.3 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. make: *** No rules to make target 'midifighter.elf', needed by 'elf'. Stop. Thanks for your time, Ben |
Odette Weymouth 02.07.2010 | Alright, thanks! Now I understand what you meant about getting it to enumerate. Ill probably be back with more questions Thanks for helping me out, I really appreciate it. Thanks, Ben |
robert chanda 02.07.2010 | USB devices first connect, then send a big packet of description about themselves to the Host which, if the host believes they are worthy, they are deemed "Enumerated" and will appear in your list of active hardware. "Connecting" is the just first part of that whole process, so I tend not to use that word. |
Odette Weymouth 02.07.2010 | What do you mean enumerate connect? Also I only need the latch-and-shift for multiplexers right? (From what Im reading it doesnt sound like it, woo Google) Thanks, Ben |
robert chanda 01.07.2010 | Well, that's where you start. Change that, recompile, see what happens. Getting it to compile is the first step to getting to be functional. Remember, the Teensy doesn't have the latch-and-shift-in key readers, the LED controller or the ADC chip, but you should be able to enumerate connect over USB. |
Odette Weymouth 01.07.2010 | Alright thanks I really do appreciate the help. So in the makefile I need to change: Code:
# MCU name MCU = at90usb162 Thanks, Ben |
Leeanna Ayla 01.07.2010 |
Originally Posted by Fatlimey
|
robert chanda 01.07.2010 |
Originally Posted by BenitoIsAwesomr
Originally Posted by BenitoIsAwesomr
The LED driver is a useful device to add to your design as it's made to provide constant current to however many LEDs you use, so they don't change brightness when you turn lots of them on or off.
Originally Posted by BenitoIsAwesomr
|
Odette Weymouth 28.06.2010 | Awesome, thanks for helping me out, Im so far in over my head So Im trying to adapt the MIDIFighter code for the Teensy, so:: Include the headers for the AVR chip the Teensy uses? (And whats that second included header "avr/include/avr/iousbxx2.h"? Is that generic?) And I shouldnt have to worry about the ADC stuff because the Teensy already has that, right? And what about the LED driver, is that going to be necessary with the Teensy? And if I try to document what Im doing and turn it into a tutorial of sorts, would you check over it and make sure I dont say something stupid? Thanks, Ben |
robert chanda 28.06.2010 | Thanks for the compliment. I spent a long time making the code as easy to use as possible. Most of the example code I see on the Arduino is written by non-programmers, so I thought I'd make a full sized, well documented piece of microcontroller code for a change. Your questions: Q: Where are the input/output pins specified? (Im sure its been starring me in the face this whole time) A: The addresses of the IO pins are specified in the WinAVR headers, specifically the headers: Code:
avr/include/avr/iousb162.h avr/include/avr/iousbxx2.h Code:
find . -name "*.[c|h] -exec etags -a {} \; find ../WinAVR -name "*.[c|h] -exec etags -a {} \; find ../LUFA -name "*.[c|h] -exec etags -a {} \; Q: How does the TLC5924 work? A: The datasheet will tell you everything you need to know. http://focus.ti.com/docs/prod/folder...t/tlc5924.html There's an LED BLANK pin that can be used to turn off all LEDS at once but we never use that feature, so we set it LOW during setup and keep it there. After setup the chip works using SPI - we shift in two bytes, 16 bits, where each bit represents one of the LEDs and it turns on or off the LED assocuated with those bits. That's pretty much it. The chip has other features for coping with different LED voltages that we never use. Check out the datasheet. Q: What does the ADC file do? A: It controls the ADC chip we added to the board that allows us to read the four analog inputs on the expansion bus. The chips that the Arduino uses have ADC built in, but our chip doesn't (it has USB hardware instead). So to read analog signals we added a MCP3004 chip to the SPI bus. It's data sheet is here: http://ww1.microchip.com/downloads/e...Doc/21295C.pdf It's got a fairly straightforward protocol for reading an Analog channel and returning 10 bits of binary data - essentially you shift out 3 specifically formatted bytes over SPI and shifts back in three bytes, the bottom two bytes being the 10-bit ADC value. First byte sent tells it which channel to read and the unused bits in the bytes introduce exactly the right amount of delay for the read and conversion to happen. Nifty. |
<< Back to MIDIfighter Resources and DiscussionReply