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.

AM4378: McASP bit clock frequencies for SiI9022 HDMI transmitter

Part Number: AM4378
Other Parts Discussed in Thread: TLV320AIC3106

Hello,

We are planning to use AM4378 processor with SiI9022 HDMI transmitter on a custom board with video and audio output.

The TI AM437x GP EVM, which we have, uses the same HDMI transmitter so that we were trying to test the circuit before we built our custom PCB.

We successfully played audio on the EVM trough the TLV320AIC3106 codec in the LCD display mode. However, in this case I believe, the TLV320AIC3106 codec is in master mode and generates the appropriate audio clocks from the 12.000 MHz external oscillator connected to its MCLK input.

When we switched the EVM to HDMI mode, we were able to see the video output on the TV screen but there was no audio. The same 12.000 MHz external oscillator clock is provided to the SiI9022 MCLK input but it does not look like the SiI9022 can operate in master mode. We have NDA with Lattice and obtained all technical information about the part but could not find anything about setting it up in master mode.

Maybe we have not setup something correctly on the EVM but it looks like the SiI9022 cannot operate in master mode and the AM437x McASP cannot generate accurate audio clocks from the main 24 MHz oscillator. (The 12 MHz external oscillator is also not suitable for the McASP nor it is connected to the McASP high speed clock input/output pin AHCLKx)

Is my conclusion that the EVM cannot play audio through the SiI9022 HDMI port accurate?

Please let me know if any of the options below is not correct or if there is a better or simpler solution.

1. Use external 24.576 MHz oscillator connected to the AM4378 AHCLKX pin and the SiI9022 MCLK pin.

The required audio clocks are calculated as follows (assume 48 kHz Fs):

Bit-clock = 2 slots * 32 bits per slot * 48 kHz = 3.072 MHz (each frame has two slots)

Master Clock = 128 (may also be others like 192, 256, etc.) * 48 kHz = 6.144 MHz.

Then 24,576 kHz / 4 (HCLKXDIV divider) =  6.144 MHz (MCLK) / 2 (CLKXDIV divider) =  3.072 MHz Bit-clock

2. (Preferred) Use XDMA_EVENT_INTR1 pin (Ball C24) of AM4378 processor that can be configured as CLKOUT2 providing output clock from EXTDEV PLL via EXTDEV_PLL_CLKOUT, with very flexible frequency output and connect it to the AM4378 AHCLKX pin and SiI9022 MCLK pin.

The PLL output frequency formula is – (Fin / (N + 1))* M/M2 = (24 MHz / 50) * 128/10 = 6.144 MHz audio clock. (may also be higher and divided down in the McASP module)

(N – 0 - 255, M – 2 - 4095, M2 – 1 - 127) AM4378 Technical Reference Manual, rev. H, pages 273, 285, 287.

  • Hi Kris,
    I'm checking the the team that worked on that EVM.
    Regards, Bill
  • Hi Kris,
    I have located someone from the team that has worked on audio for the AM437x GP EVM. Audio on the HDMI is supported with Linux build 2018LTS and 2019LTS. Based on the comments I received when HDMI is selected in these Linux builds the audio should be working. 
    Regards ,
    Bill

  • Hi Bill,

    So we installed PROCESSOR-SDK-LINUX-AM437X (v05.03, 07-APR-2019, kernel ver v.4.14.79) and booted successfully.

    We selected the HDMI successfully and when we played the audio-videos clips, no audio come from the TV.

    We have tried all apps in the Multimedia screen. (see the attached photos)

    Can you explain how the McASP and SiI9022 are setup to produce sound? As I mentioned above, I cannot understand how it will work with the implemented hardware circuit.

    Can you also give us the configuration of the EVM that produces audio and video through the HDMI port?

  • Hi Kris,

    I'm trying to get someone from the software team to joint the thread. Until then they suggested adding the following statement to your uEnv.txt file in the /boot partition. 

    fdtfile=am437x-gp-evm-hdmi.dtb

    That statement should override the Linux device tree file loaded by default.

    Regards, Bill

  • Yes we have done that. Here is an excerpt from our uEnv.txt file:

    # This uEnv.txt file can contain additional environment settings that you

    # want to set in U-Boot at boot time.  This can be simple variables such

    # as the serverip or custom variables.  The format of this file is:

    #    variable=value

    # NOTE: This file will be evaluated after the bootcmd is run and the

    #       bootcmd must be set to load this file if it exists (this is the

    #       default on all newer U-Boot images.  This also means that some

    #       variables such as bootdelay cannot be changed by this file since

    #       it is not evaluated until the bootcmd is run.

    optargs=video=HDMI-A-1:800x600

     

    # Uncomment the following line to enable HDMI display and disable LCD display.

    fdtfile=am437x-gp-evm-hdmi.dtb

  • Hi Kris,

    I took a AM437x GPEVM with PSDK5.03 and using the create-sdcard.sh, I formatted my SD card. As Bill mentioned in the previous post, I modified the uEnv.txt file in the boot partition.

    Next, I ran the AAC decode and MPEG4+AAC decode examples and was able to hear output coming from my monitor. As an experiment, I am wondering if you could please connect a laptop to the monitor and play music. This will ensure the audio functionality of the monitor.

    Regards,
    Krunal
  • We run the latest SDK 5.03 and we are not getting any sound from the TV. We have tested the TV sound and it works fine.

    When we programmed the SDK 5.03 and run it, the matrix browser didn't come up automatically so that we had to start it manually. The picture quality is lower that when we run the SDK that came with the EVM. It looks like the new SDK code may have problems communicating over I2C with the SiI9022 HDMI transmitter.

    In any case, when we run the matrix browser manually, we were able to run the AAC decode and MPEG4+AAC but there is still no audio. Here is the output from the Linux console:

    am437x-evm login: root

    root@am437x-evm:~# /usr/bin/matrix_browser http://localhost:80/

    Using Wayland-EGL

    wlpvr: PVR Services Initialised

    Non-blocking swap buffers not supported. Subsurface rendering can be affected.

    Non-blocking swap buffers not supported. Subsurface rendering can be affected.

    Non-blocking swap buffers not supported. Subsurface rendering can be affected.

    Using the 'xdg-shell-v5' shell integration

     

    The Wayland connection broke. Did the Wayland compositor die?

    root@am437x-evm:~#

    root@am437x-evm:~# [  141.525820] omap_i2c 4802a000.i2c: controller timed out

    [  144.645776] omap_i2c 4802a000.i2c: controller timed out

    [  147.765806] omap_i2c 4802a000.i2c: controller timed out

    [  150.885816] omap_i2c 4802a000.i2c: controller timed out

    [  154.005774] omap_i2c 4802a000.i2c: controller timed out

    [  157.125773] omap_i2c 4802a000.i2c: controller timed out

    [  157.338776] davinci-mcasp 4803c000.mcasp: Sample-rate is off by 400 PPM

    ^C

    root@am437x-evm:~# [  181.925767] omap_i2c 4802a000.i2c: controller timed out

    [  185.045764] omap_i2c 4802a000.i2c: controller timed out

     

    root@am437x-evm:~# uname -r

    4.14.79-ge669d52447

    Here is the TV monitor output when we run the AAC decode: (no sound is heard)

    Keep in mind, that the sound works in LCD mode, although it is produced by the TLV320AIC3106 codec.

  • Hi Kris,

    I am wondering if you please share the following information:

    1. AM437x GPEVM Board Rev?
    2. Type the following command in the EVM, aplay -l, and share the output
    3. Please share any custom SW modifications made to the PSDK Linux 5.03 (I doubt you should have changes since you are using a TI board)

    I am not able to replicate the same error on my test setup and I am trying to figure out the delta's between our setup. I have even tried running the command "aplay /usr/share/sounds/alsa/Front_Center.wav" and I am able to hear sound coming from my TV monitor.

    Regards,
    Krunal
  • Sticker says “Rev: 1.5B “

    root@am437x-evm:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: HDMI [HDMI], device 0: davinci-mcasp.0-hdmi-hifi hdmi-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    No other changes than uncommenting the fdtfile=am437x-gp-evm-hdmi.dtb lins in the uEnv.txt file.

    Here is the output from the last command that you mentioned:
    root@am437x-evm:~# aplay /usr/share/sounds/alsa/Front_Center.wav
    Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
    [ 66.055183] davinci-mcasp 4803c000.mcasp: Sample-rate is off by 400 PPM
    And no audio is comming out from the TV.

  • Hi Kris,

    I have tried a second board and I am still not able to replicate your problem. I am wondering if you have another board that you could perform the same experiment on.

    Also, please probe the following pins while running the command "aplay /usr/share/sounds/alsa/Front_Center.wav":

      

    R207 should be 12MHz and please share the your observations for R213 and R211.

    Regards,

    Krunal

  • Here are the oscilloscope screen captures for the pins above:

    Master Clock (HDMI_AUDMCLK) - 12 MHz

    Bit rate clock  (HDMI_AUDBCLK) - 1.412 MHz

    Frame/Word Sync Clock (HDMI_AUDFSX) - 44.2 kHz

    Audio Data - Looks like a valid data.

    Here were the problems is:

    The the frame clock is meant to be 44.1 KHz but the exact value is not possible from the internal 24 MHz oscillator. The McASP is using the 24 MHz oscillator because the 12 Mhz external oscillator is not fed to the processor McASP module.

    The bit rate clock is for two 16 bit slots (32 times the sampling rate), which is someout outdated frame.

    44.1 kHz x 32 = 1.4112 MHz, which is the measured clock and can be derived from 24 MHz - 24 MHz / 17 = 1.411 MHz

    The McASP manual says that 32 bit slots should be used even with 16 bit payload. In that case the bit clock cannot be derived with the available even dividers from 24 MHz.

    The measured bit rate clock and frame sync would have worked in this case but the 12 MHz master clock is not correct. The SiI9022A part requires (quoted from the datasheet):

    "A separate master clock signal that is coherent with the I2S inputs is required for HDMI time-stamping purposes. Coherent means that this clock signal and the I2S inputs must have been created from the same clock source."

    In addition, there are specific frequencies required and for the 44.1 KHz :

    The provided 12 MHz clock is neither coherent nor any of the frequencies in the 44.1 kHz column.

  • I forgot to mention that e have two TI AM437x EVMs that we have been testing this issue on. Until Friday, both EVMs were unsuccessful in playing HDMI sound with multiple different LCD TVs.

    On Friday, I decided to test with all different TI AM437x SDK versions. During one of the multiple trials, the sound came on unexpectedly and I could hear it clearly from the TV.

    I couldn’t find any difference in the setup, so that I restarted the EVM and the sound was no longer working again. I kept testing and found that very infrequently the sound will come through, regardless of the SDK I am running on.

    Once the sound is working, it will work on any audio or audio-video sample I try. However, if I disconnect the HDMI cable or reboot the EVM the sound stops working and takes multiple reboot or connect/disconnect cycles to get it working.

    During one of the rare occurrences of HDMI sound working, I removed the resistor R207, disconnecting the 12 MHz oscillator from the SiI9022A MCLK. This did not have any effect and the sound continued to play as before. This is not surprising, in my opinion, because this oscillator is completely incoherent to the bit-rate and frame clocks.

     

    In summary, the SiI9022A I2S audio apparently works without the MCLK but the TI AM437x EVM HDMI audio circuit appears to be working one out of a 30-40 reboot cycles.

    Any ideas?

  • Hello,

    Could you please share your Linux boot logs in a text file (when the audio is not working) because I would like to compare against my board? Also, please confirm what type of HDMI cable are you using. Once you removed the resistor R207, I am wondering if you are consistently able to hear audio coming out of the TV monitor.

    As an experiment, you could connect your laptop to the monitor and play a known wave file. If audio works, please copy the wave file to the SD card directory "rootfs/home/root". After booting the board, please try playing the wave file using the command "aplay <name_of_file>".

    Regards,
    Krunal