No Sound :-(

Fixed :slightly_smiling_face:

Write dedicated code to do it.

Seconded. The timer code of mbed library has a lot of overhead.

So something along the line of the way the audio playing timer is set up? of different?

The reason why the audio interrupt was made is because its about 5-10 times more efficient than using the default mbed interrupt

1 Like

Hmmm, even overclocking isn’t helping much, I’ve read a few places that analogin is very slow. I’ll look at that tomorrow.

As I’ve said, I wouldn’t use a timer interrupt for this. I would use a timer to generate a hardware trigger to start an ADC conversion. The ADC would be set to generate an interrupt when the triggered conversion was complete and its ISR would (perhaps condition and) echo the conversion result to the audio hardware.

If you use a timer interrupt to start the ADC, you then have to wait for the conversion to complete (which, because it takes a fair amount of time, you don’t want to do inside an interrupt service routine). This means you need to poll for conversion complete or still have an end of conversion interrupt.

You would set up the timer to run continuously such that it generates ADC hardware triggers at a rate of about 50kHz. This way, the echoing of the radio output to the audio hardware is done automatically “hands off” in the background while the regular foregroud code can do whatever it likes (like changing radio stations, adjusting the volume, etc.) without worrying about it.

2 Likes