Pages: [1]   Go Down
Author Topic: auduino-synth on leonardo  (Read 998 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2573
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

unfortunalety i am not an arduino expert.  smiley-sad
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?

Logged

Pages: [1]   Go Up
Jump to: