Pages: [1]   Go Down
Author Topic: Arduino Mega Midi Shield Problem  (Read 1734 times)
0 Members and 1 Guest are viewing this topic.
Austria / Tyrol
Offline Offline
Newbie
*
Karma: 0
Posts: 42
learning....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey!
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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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?

Quote
Maybe something in the code has to be rewritten ?
Line 27 is wrong.
Logged

Austria / Tyrol
Offline Offline
Newbie
*
Karma: 0
Posts: 42
learning....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// 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
ISR(TIMER2_COMPA_vect) {

  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
Thanks
Patrick
« Last Edit: January 12, 2011, 10:34:42 am by izze » Logged

Austria / Tyrol
Offline Offline
Newbie
*
Karma: 0
Posts: 42
learning....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rochester, NY
Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Austria / Tyrol
Offline Offline
Newbie
*
Karma: 0
Posts: 42
learning....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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..
Logged

Pages: [1]   Go Up
Jump to: