Go Down

Topic: auduino-synth on leonardo (Read 1 time) previous topic - next topic

jn-wp

hi folks!

i just tried out the auduino-synth on my arduino-uno board and everything worked quite fine.
now i want to build a "boxed"-version of an auduino-synth and i bougth an arduino-leonardo board. if i want to upload the source-code to the leonardo-board i  get an error-message like

"auduino_v5.pde: In function 'void audioOn()':
auduino_v5:134: error: 'TCCR2A' was not declared in this scope
auduino_v5:134: error: 'COM2B1' was not declared in this scope
auduino_v5:134: error: 'WGM20' was not declared in this scope
auduino_v5:135: error: 'TCCR2B' was not declared in this scope
auduino_v5:135: error: 'CS20' was not declared in this scope
auduino_v5.pde: In function 'void TIMER2_OVF_vect()':
auduino_v5:207: error: 'OCR2B' was not declared in this scope"

its in the part of the source-code where the processor should be detected:

void audioOn() {
#if defined(__AVR_ATmega8__)
  // ATmega8 has different registers
  TCCR2 = _BV(WGM20) | _BV(COM21) | _BV(CS20);
  TIMSK = _BV(TOIE2);
#elif defined(__AVR_ATmega1280__)
  TCCR3A = _BV(COM3C1) | _BV(WGM30);
  TCCR3B = _BV(CS30);
  TIMSK3 = _BV(TOIE3);
#else
  // Set up PWM to 31.25kHz, phase accurate
  TCCR2A = _BV(COM2B1) | _BV(WGM20);
  TCCR2B = _BV(CS20);
  TIMSK2 = _BV(TOIE2);
#endif
}


i cant believe that the leonardo doesnt support the audio-functions that the uno does?!?
does anybody have any idea?
thanks for your help.

Magician

I think,  leonardo doesn't have timer2. This is a problem with a library, that doesn't support AtMega32u4

jn-wp

thanks for you quick answer, but any idea how to fix it?
can i get the auduino-code running on leonardo? is there perhaps a work-around for the code?
would be very nice if there is any help to find...

DuaneB

There is an easy but time consuming work around which is to port the code.

No idea how technical you are but if your upto it you need to find one 8 bit and one 16 bit timer on the Leonardo and then port the existing timer code based on the UNO to use the equivalent Leonardo timers.

How technical are you ?

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

jn-wp

unfortunalety i am not an arduino expert.  :(
thats why i am asking here in this forum...
i just searched the code to find the answer, but i think it is in the avr/io.h or in the avr/interrupt.h library?!?
in the code itself i cant find anything that would match to it...

do you have some more help?


Go Up