AnsweredAssumed Answered

i.MX28 (i.MX286) and SGTL5000 audio recording issue

Question asked by Gianluca Renzi on May 27, 2015
Latest reply on Jul 30, 2015 by Gianluca Renzi

Hello to everybody out there!

 

Now a little preamble:

- In the last 4 years I developed 4 boards running iMX28 (imx280 and imx286) all running linux (3.12.1) running on top of a Debian Wheezy 7.8 armel distro.

Everything is working fine and our boards are using Ethernet, SDIO, LCD (where applicable), Touchscreen, Audio Output, CAN Bus, I2C, UART....) until now.

Last year we are asked to deploy a board with EARPHONE OUT, LINE IN/OUT and MIC IN all connected to the SGTL5000 as in IMX28EVK evaluation board.

 

Just to be clear: the OUTPUT (LineOUT or EarPhone) is WORKING GREAT!

 

In the bootlets code I am using the VCC_5WALL configuration as our board is running from power-outlet connector (i.e. no battery)

 

In the bootloader code (I am using Barebox 2013.02) I am configuring the GPIO 3.20, GPIO 3.21. GPIO 3.22, GPIO 3.23 and GPIO 3.24 as primary function i.e.: SAIF0_MCLK, SAIF0_LRCLK, SAIF0_BITCLK, SAIF0_SDATA0 and finally SAIF1_SDATA0.

 

When booting linux this board has a device-tree dts file with:

 

    apbx@80040000 {
   saif0: saif@80042000 {
   pinctrl-names = "default";
   pinctrl-0 = <&saif0_pins_a>;
   status = "okay";
   };

 

   saif1: saif@80046000 {
   pinctrl-names = "default";
   pinctrl-0 = <&saif1_pins_a>;
   fsl,saif-master = <&saif0>;
   status = "okay";
   };

 

and in the i2c section:

 

            i2c0: i2c@80058000 {

                pinctrl-names = "default";

                pinctrl-0 = <&i2c0_pins_a>;

                clock-frequency = <400000>;

                status = "okay";

 

                sgtl5000: codec@0a {

                    compatible = "fsl,sgtl5000";

                    reg = <0x0a>;

                    VDDA-supply = <&reg_3p3v>;

                    VDDIO-supply = <&reg_3p3v>;

                    clocks = <&saif0>;

                };

 

Because I am not using any VDDD i.e. it is left floating.

 

Finally in the latter section I have:

 

 

    sound {

        compatible = "fsl,imx28-evk-sgtl5000",

                 "fsl,mxs-audio-sgtl5000";

        model = "imx28-evk-sgtl5000";

        saif-controllers = <&saif0 &saif1>;

        audio-codec = <&sgtl5000>;

    };

 

 

With the same configuration in mind I rewrote the dts file for the IMX28EVK board too, and the bootlets code and bootloader Barebox are almost equal.

 

The Operating System (Debian Wheezy) is loaded from uSD Card in both systems and the kernel is the same, and the dtb file is loaded from bootloader, i.e. the bootloader knows about which board is running on, and select the device tree blob accordingly. When booting it select the correct dtb for the board itself... but the kernel and the OS are the same!

 

Well, when I type on IMX28EVK (iMX287):

 

arecord -t wav -d 5 -d hw:0,1 -f S16_LE -c 2 /tmp/sample.wav

 

the GPIO 3.26 (SAIF1_SDATA0) has a lot of data running, but after 5 seconds ( ... -d 5 above) it stops, it closes the file /tmp/sample.wav and returns no error.

 

Here is the configuration of the kernel drivers for audio:

 

Alsa Play APLAY version:

# aplay --version
aplay: version 1.0.25 by Jaroslav Kysela <perex@perex.cz>
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: mxssgtl5000 [mxs_sgtl5000], device 0: HiFi Playback sgtl5000-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

Alsa Record ARECORD version:

# arecord --version
arecord: version 1.0.25 by Jaroslav Kysela <perex@perex.cz>
# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: mxssgtl5000 [mxs_sgtl5000], device 1: HiFi Capture sgtl5000-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

Here is the udev version:

# udevadm --version

175

 

When running the same command in the other board (with iMX286) I have 10 seconds of nothing, then this error:

reading from pcm (alsa arecord/aplay):

 

arecord: pcm_read:1801: read error: Input/output error
 From the source of 1.0.25 aplay/arecord:

1790           r = readi_func(handle, data, count);
1791           if (test_position)
1792                   do_test_position();
1793           if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
1794                   if (!test_nowait)
1795                           snd_pcm_wait(handle, 100);
1796           } else if (r == -EPIPE) {
1797                   xrun();
1798           } else if (r == -ESTRPIPE) {
1799                   suspend();
1800           } else if (r < 0) {
1801                   error(_("read error: %s"), snd_strerror(r));
1802                   prg_exit(EXIT_FAILURE);
1803           }
So the readi_func is failing. It seems there is a timeout or similar on
my board. On both boards (IMX28EVK and my board) I can clearly see
with a oscilloscope a signal on the SAIF1_SDATA0 (I2S_DOUT from
sgtl5000) during recording, so can I suppose the hardware configuration
of the pinmux is correct (on the .dts file)? I am using the same
pinout like on the EVK so no changes are needed to adapt to our board.
When arecord ends the SAIF1_SDATA0 line becomes high as normal.
When playing an audio file the line SAIF0_SDATA0 is oscillating during
all audio-playing-time as normal.
Playing with bootloader, I can clearly see all lines moving at my
command @ sgtl5000 pins, so I can exclude an defective soldering ball
between SoC and sgtl5000 itself.

Can I suppose NOT HAVING ANY HARDWARE ISSUE? Isn't it?

If someone is having/had a similar issue please feel free to contact me asap.

 

gianlucarenzi@eurek.it

 

Best Regards,

Outcomes