ADC Audiosampeling

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Murkur
Posts: 1
Joined: Sun Mar 08, 2015 1:30 pm

ADC Audiosampeling

Post by Murkur » Sun Mar 08, 2015 1:45 pm

Hi

I just got my Micropython board and I want to be able to triangulate an audio signal at 40kHz. To do that i need to sample 3 ADC pins each one has to have a sampling frequency of +80kHz. Now I have only been able to sample at a proximity 8kHz using adc.read() function. I have seen some posts here on the forum regarding this where it is said that the maximum sampling frequency for the board is around 40khz but the processor is rated to be able to sample at more than a 1MHz using DMA. As I understand the py software dos not use the DMA capability of the processor is there any way for me to implement that some how to be able to sample faster?

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: ADC Audiosampeling

Post by blmorris » Tue Mar 10, 2015 1:29 pm

@Murkur - I'm curious what you are trying to do. Are you trying to sample a signal that has frequency components around 40kHz? If so, should we assume that you are using some kind of ultrasonic transducer?
Only asking because 40kHz is not really an 'audio' frequency, no matter what any self-proclaimed 'audiophile' might tell you ;)
I'm also not really sure what you mean by 'triangulating' the audio signal. Maybe you are trying to use all three ADC's in interleaved mode to oversample? Again, this shouldn't really be necessary; as you saw from the data sheet, the ADC hardware is capable of 1 MHz sampling, but the ADC class in MicroPython doesn't yet implement DMA to support such high sample rates. This isn't a strict limitation; SPI already implements DMA. The ADC is a fairly complicated peripheral with lots of options and uPy only supports a subset at this time, but if you have the inclination to implement the support in C then you can put in the pull request.
Alternately, if you have the inclination for low-level hacking but not the C programming skills, the hardware configuration registers are directly accessible from within uPy through the stm module. I could provide some pointers to get you started in that direction if you are interested.
-Bryan

Post Reply