This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Starterware/TM4C123GH6PZ: Sound problem with dual SPI I2S simulation software spma042b

Part Number: TM4C123GH6PZ
Other Parts Discussed in Thread: DIT4096, PCM3060

Tool/software: Starterware

Hi people,

I implemented the software example SPMA042b on my Tiva C and I can play files from my SD card so far but the ouput sound is scratchy... it sounds like an old vinyl disc.

I tried the amplifier with a PCM3060 as source and the sound is perfect so I think the amplifier and the connection is okay. The I2S BLCK and LRCLK is generated by a DIT4096. MLCK is a 12,288MHz oscillator which also supply the Tiva C XIN pin. The audio files have 48kHz sample rate with 16 bit. The core runs with 80MHz so I changed the SoundPlayContinue() call time linear to the time in the example.

I tried changing the SPI modes and frequencys, the sound format from I2S to left-justified tried different bit numbers and interrupt times, which SoundPlayContinue() is called, but nothing helps. I also disabled any other funktions so the MCU runs free between the calls.

Had someone the same problem or some hints which could be the problem ?

Thanks Alex

  • Are you getting the correct sound, but with pops and scratches, or are you only getting noise? If the first case, do you have the I/O pins showing the CPU loading? You may need to increase the frequency of the timer interrupt to prevent the SPI FIFOs from getting empty. (I am not sure why they used a timer interrupt to check the FIFO buffers. It makes more sense to use the FIFO half full/empty interrupt instead.)
  • Hi Bob,

    thanks for you help.

    I get the correct sound but with scratches. No I didn't checked the CPU loading but I let the player run in an infinite loop so the CPU does nothing else. If this doesn't work I'm screwed because I can't neither set the CPU clock to more than 80MHz nor do less than nothing while the playback is running.

    In my opinion the timer calls are only checks if the main audio buffer is empty and than refill it or do nothing. I tried increasing the timer frequency to a more than 100 times high value than the original value was but theire is no change in the audio output.

    Thanks
    Alex
  • Feel your pain. Have you attempted to measure and/or characterize those "scratches?" Perhaps - if they, "repeat w/some regularity" that may point to their source - or allow you to take some proper filter/signal limiting action.

    As always - "Single Board Anomalies" are a possibility - repeat this test across other boards.

    Power supply "near its limit" may also cause/contribute (I'd retest - using the "cleanest, clearly over-rated, supply available.")

    Vendor's Bob provided "FIFO" detail - perhaps you can experiment by (deliberately) violating/breaking that FIFO - and noting, "How - or even if - that impacts that scratching."

    Often firm/I "find" that, "Being able to CAUSE the fault" (i.e. Fault ON DEMAND!) proves invaluable in its eradication!

    it often proves wise to use multi-channel scope to "examine everything" which may correlate w/those, "scratch event(s)."    Don't neglect a search for "other/outside Noise/Power events" which may source those scratches - as well...

  • I played a sine test file which has frequencys from 20Hz to 20kHz and it seems the scratches are more likly to appear with lower frequencys, more other their are some ranges where no noises appears. In the higher frequency range the noises are also higher and in my opinion they are some fundamental wave from the main frequency.  Conclusion: The freqeuncy cahnge with which the disortion appears increases with the main frequency and the disortions freqeuncy depends also on the main frequency.

    Is it possible to upload a soundfile ?

    The PCM3060 is on the same board so the same power supply connection and amp provide clear sound but not with the I2S output from the Tiva.

    How can i manipulate the FIFOs ? The DMA coppies the data from the buffer to the FIFOs so I can't manipulate the data.

  • You are silent as regards:

    • repeated the test exercise upon (other) boards
    • any measurement data (ideally scope traces) with regard to the "scratches"
    • the adequacy of (both) your 3V3 & 5V0 supplies

    Yours (must) be a custom pcb - and (any) 24 bit device (which describes PCM3060) demands skilled/thoughtful board layout.   In addition - page 40 of the PCM3060 manual details 3 sample schematics - most illustrating both high & low-pass filters - which should reduce (or eliminate) the issue you note.    Have you followed/implemented any of those schematics?    Of (very) special note - a 400Hz (external) High-Pass Filter is shown - have you included that in your pcb implementation?

    In a (very) quick scan of that device's spec - I noted - and now  quote - (from Fig 27, Pg22:)

    "During undefined data, it may generate some noise in audio signal.    Also, the transition of normal to undefined data and undefined or zero data to normal creates a discontinuity in the data on the analog and digital outputs, which may generate some noise in the audio signal."     *** This is most telling - is it not?   (appears to explain (some) noise generation - bears investigation - at minimum...)

    Here now is the signal timing chart which further details & clearly illustrates:

    We don't (yet) know if you've fallen victim to those "Undefined Data" time-slots - this (may) have been the issue which Vendor's Bob (earlier) touched upon w/the MCU's (incomplete fill) of the SPI FIFO.

    Would not your scope monitoring of, "ADC DOUT" AND "DAC Vout" help to determine if your "scratches" overlap those, "Undefined Data" time-slots?

    And there's (still) MORE w/in the device's 49 pg. manual - there exists a, "High-Pass Filter" ("HPF" software controlled) which defaults to "OFF!"   (find upon Pg 29, Table 3)   You noted such - & ordered that HPF "ON" - did you not?

    Deep dive into the MCU's SPI FIFO is the province of vendor support - my skill/talent (if any) centers upon general/logic-based, "Tech Problem Identification & Correction."

  • Hei cb1_mobile

    thanks for your help but the PCM3060 is NOT the problem. It's the working I2S source on my board. I have issues with the output of the Tiva.

    The amplifier I use is the STA326 from ST, maybe it helps someone.

  • Alexander Ahrens said:
    the PCM3060 is NOT the problem.

    Uncertain why you respond in that manner - my presentation of the Codec's timing chart highlighted those "time-slots" which make the Codec "vulnerable" to noise.   I placed "no blame" on any device - instead offered a methodology to glean greater insight... 

    Is it not your job to monitor those 2 Codec signal lines ("ADC DOUT" AND "DAC Vout") and determine if the MCU is "meeting" the Codec's specification?    Such seems a useful effort - and (appears) to have been bypassed...