PCM Sound Output for my Atmega2560

Hi there,

I recently started a project to implement a Code Excited Linear Predictive (CELP) decoder on Atmega2560, which can store approximately 3 minutes on compressed voice (4.8kbps at 8kHz sampling) on 256kbyte flash Atmega2560.
I don't want to add DAC hardware chip for sound output, so I downloaded the PCMAudio code at Arduino Playground - PCMAudio
for 8 bit PWM playback for testing on my Arduino Mega2560. But unfortunately it doesn't work. I checked the running of the code, the interrupt rountine seemed working but just didn't have any PWM signal output from Pin 11.
The orignal code was designed for Atmega168 not Atmega2560. I wonder if this is the problem of malfunctioning.
I am not familar with programming the timers on AVR processor, so please help if I need to modify the code for running on Atmega2560, or point me to other code for PCM sound output (using PWM) that can run on Atmega2560.

Thanks in advance

The library probably uses a specific timer for the output, so check which timers work on which pins.

I had the same issue with the SimpleSDAudio library when moving from the 328P to 1284P. Sound output is on different pins due to the timer differences between the chips. It works fine though when the correct pins are used for the output.

Thanks Tack,

Yeah, I checked the pin mapping diagram of Arduino Mega2560, OC2A is actually mapped to pin 10 not pin 11 in the original code.
So it works now.

I am working on porting the 4.8kbps CELP decoder on Mega2560 now, would be interested to share the code when I finished.


Hi StanleyAudio,

The same problem exists in the bounty. Could you please tell me how you fixed it?

The same problem exists in the bounty.

You don't say

And don't resurrect 5 year old threads.
As these guys are registered as Guests, then they quit this forum long ago and will not be contactable.
Please read this:-
How to use this forum