Interrupts from ADC halts all other processes

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

I'm trying to use an ADC to  sample audio from a mic (50 ksps) and store it in an array. The issue I'm having is that the interrupt I have connected to eoc seems to get called so often that the while(1) loop in main.c seems to halt altogether. I feel like the PSoC 5's processor should be fast enough to not have this issue, but am not sure what I'm doing wrong. 

   

Any suggestions on what could be wrong or what could be a better approach to recording audio?

   

thanks,

   

-Hayden

0 Likes
3 Replies
Anonymous
Not applicable

 I guess I'm okay with it since within the interrupt I can stop converting once I've reached my target number of samples. Now I'm just confused about how fast it reaches that point.

   

I've configured the ADC to 10,000 SPS and it's set to halt once it's taken 50,000 samples, or what I'd assume would be 5 seconds worth. But for some reason it finishes after half a second. Am I missinterpreting what SPS stands for or does the ADC call EOC at a faster rate than the SPS it is set to?

0 Likes
rotec_264361
Level 2
Level 2

Hayden,

   

Did you ever consider to use the DMA? That would be a lot faster than interrupts.

   

Which memory are you using to store your samples? If you use a 10-bit ADC and try to store 50000 samples you will definitely run out of internal memory and that can result in unexpected behavior.

   

If you store the data to external memory, that write operation could be your bottleneck from your first question.

   

Just some thoughts, Rob

0 Likes
Anonymous
Not applicable

Yeah you're probably right that a DMA makes more sense. I will try using that instead. 

   

As for how much audio I'm storing, it would be nice if I could keep something like 5-10 seconds of low quality audio. Besides keeping the sampling rate as low as possible do you have any other suggestions for how to store this much 8-bit audio?

   

Thanks!

0 Likes