Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: PWM Source to ADC Input

  1. #1
    Member capricorn one's Avatar
    Join Date
    Oct 2014
    Location
    Los Angeles
    Posts
    51

    PWM Source to ADC Input

    Curious if anyone has a working solution for this:

    I have a 16-bit PWM audio source coming from a display unit (unfilitered) and I want to plug it into the ADC input of the teensy using the AudioInputAnalog object of the Audio library. My source is a 3.3V PWM waveform coming from a 74LVC1G08 driver chip. There's a circuit example for converting PWM to Line Out as well as a circuit for Line In to ADC for the teensy, so I could obviously put the two together to achieve what I want. I'm just wondering if I can get away with less components, seems like some of them (10uF i.e.) will be redundant.

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,598
    Another, perhaps more efficient approach could be to feed the PWM directly into a digital pin of the teensy and using the newest improved FreqMeasureMulti library v0.22 (don't let you fool by the name, it allows really to capture each single pulse and the pauses in-between with a 20.48ns resolution) to get the digital values back without losing quality by first converting the PWM to analog and then analog to digital.

  3. #3
    Member capricorn one's Avatar
    Join Date
    Oct 2014
    Location
    Los Angeles
    Posts
    51
    Yeah, I agree, that would be more efficient and elegant and somewhat lossless, but it's not supported in the Audio library as far as I know? Unless someone has already written an object to handle this, I suppose it would be pretty straight forward.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,727
    I'm curious what sends a 16 bit PWM audio signal? What frequency does it use?

  5. #5
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,598
    That's an excellent question. Having 16bit audio PWM at 44100 samples/s would require a pulse clock of about 2.9GHz...

  6. #6
    Member capricorn one's Avatar
    Join Date
    Oct 2014
    Location
    Los Angeles
    Posts
    51
    Hmm... good point about the clock, I'm basing it off of what the webpage says here for the Diablo processor which drives some of the 4D systems displays. See here :

    http://www.4dsystems.com.au/product/DIABLO16/

    It does say on the website 16-bit PWM audio, but I agree, after thinking about this, maybe that's not really 16 bit? Or maybe since it's a GPU it's capable of doing that somehow?

    Also, I realize on most of the displays, this audio output is filtered to analog, but I'm using the pin output, which has no filtering.

    Oh, and the for the frequency, you can actually set that as one of the internal functions from 4k to 65k, according to this :

    http://www.4dsystems.com.au/productp...ons_R_1_16.pdf

    see Snd_Pitch(pitch) function.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,727
    Out of curiosity, I did a little searching. I found this thread.

    http://forum.4dsystems.com.au/forum/...-audio-quality

    Looks like the this chip's PWM audio output is probably only 8 bits. Sure, their marketing info says it's 16 bits, but that's really not technically feasible (for a variety of reasons). I'd put a lot more trust in the support reply #2 on that thread, admitting it's only 8 bits and low quality. Reply #10 is also interesting, getting a bit defensive when pressed for technical details, but admitting "if you use a 16bit file only the high 8 bits will be used" seems to sum things up nicely.

    I'm sure they probably have some twisted logic for claiming it's 16 bits. Perhaps supporting 16 bit WAV files (by discarding the low 8 bits) makes it 16 bits?

  8. #8
    Member capricorn one's Avatar
    Join Date
    Oct 2014
    Location
    Los Angeles
    Posts
    51
    Wow, thanks for finding that Paul!

    Going to have to make some changes to my design in that case, 8 bits definitely won't do. Should have known that was too good to be true, thanks for doing the digging.

    -Colin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •