Go Down

Topic: Arduino Mega Midi Shield Problem (Read 3423 times) previous topic - next topic


It seems the MidiVoX SHield i bought doesnt work with Arduino Mega. It is fine with my Duemillanove.
I dont receive any midi data with the Mega, what could be the problem ?

I already found a thread that tells to change the SPI Pins to 50,51,52,53.. I did that and it still doesnt work. Maybe something in the code has to be rewritten ?

Here is the link to the shields code and specs: http://www.narbotic.com/kits/midivox/

Please help a fella out ...

Greets from Austria


I did that and it still doesnt work.

Did what? Did that how? What doesn't work? What is happening that shouldn't What is not happening that should?

Maybe something in the code has to be rewritten ?

Line 27 is wrong.
The art of getting good answers lies in asking good questions.


Jan 12, 2011, 03:29 pm Last Edit: Jan 12, 2011, 04:34 pm by izze Reason: 1
I did change the SPI Pins going from 10,11,12,13 to the corresponding right ones 50,51,52,53. I jumpered from 10 to 53, 11 to 51, 12 to 50, 13 to 52 like i should.

The Shield doesnt work at all that means i receive no incoming midi data, no data led flashes, no sound comes out on the Audio Out.

It worked on the Duemillanove. The Mega Board is OK as it is my second one, because i replaced it already.

Maybe there has to be changes to the Hardware.pde. I looked everything up but dont really get behind it well. Thats the Code
Code: [Select]
// Hardware Setup

extern uint16_t SynthEngine_ProcessSample() ;
void Hardware_Setup(){

 //Timer2 setup  This is the audio rate timer, fires an interrupt at 15625 Hz sampling rate

 TIMSK2 = 1<<OCIE2A;  // interrupt enable audio timer
 OCR2A = 127;
 TCCR2A = 2;               // CTC mode, counts up to 127 then resets
 TCCR2B = 0<<CS22 | 1<<CS21 | 0<<CS20;   // different for atmega8 (no 'B' i think)
 SPCR = 0x50;   // set up SPI port  SPCR = 01010000,
 SPSR = 0x01;  //
 DDRB |= 0x2E;       // PB output for DAC CS, and SPI port
 PORTB |= (1<<1);   // CS high
 sei();                  // global interrupt enable

uint8_t dacSPI0;            // the two bytes that go to the DAC over SPI
uint8_t dacSPI1;

// Timer 2 interrupt routine calling the synth engine for every sample

 OCR2A = 127;
 //PORTB &= ~(1<<1); // Frame sync low for SPI (making it low here so that we can measure length of interrupt with scope)

 uint16_t sample = SynthEngine_ProcessSample();
 // format sample for SPI port
 dacSPI0 = sample >> 8;
 dacSPI0 >>= 4;
 //dacSPI0 |= 0x30; // Write to DAC-A, unbuffered VREF, gain=1x, Output Power Down Control bit (low impedence out?),
 dacSPI0 |= 0x70;  //buffered VRef
 dacSPI1 = sample >> 4;  

 // transmit value out the SPI port
 PORTB &= ~(1<<1); // Frame sync low
 SPDR = dacSPI0;  //The SPI Data Register - Writing to the register initiates data transmission.
 while (!(SPSR & (1<<SPIF))); //Wait for data to be sent over SPI, flag raised
 SPDR = dacSPI1;
 while (!(SPSR & (1<<SPIF)));
 PORTB |= (1<<1); // Frame sync high

I dont really know if Port Registers and so on are 1:1 compatible from Duemillanove to Mega?

Hope someone can help


I am doomed.. i ripped everything apart.. Trying to run it with the Arduino Duemilanove again. It works, but only when connected via USB. It doesnt work with the Battery (the battery is more than strong enough so its not a power issue). Also if the Arduino runs on battery and i plug in USB for some seconds (for as long as the Data LED flashes) and then disconnect it, it will work in battery mode?

I got to realize my project wont work.. sad that i got the Hardware part all ready and spend all my money on it.

Have a nice day all


Not that this could be it, but it almost sounds like a power issue. I know you said the battery is good, but how many volts is the battery? The Mega 2560 has a little claim that if the power supply is less than 7 volts then the 5 volt pin may not provide 5 volts (which might be why the MIDI has no apparent power) and the board can become unstable.


Its a 8 Volt Li-Po Battery with 3 Amps.. it is used for Strong RC Cars, so i think it will drive the arduino mega..
Well i gave up on the Arduino Mega, its a piece of crap... No Midi Stuff seems to work on it, i tried arduinoboy it has same issues.. i ordered a Arduino Nano and i will use the Arduino Mega as a paper weight..

Go Up