0

10.1" LCD with HDMI and audio but no audio...
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: 10.1" LCD with HDMI and audio but no audio...

by blake3 on Sun Jun 07, 2015 1:06 pm

Thanks for the response Andrewsi.

While I have next to zero pi experience (I'm on day 7 or so), I am wondering about those ALSA sound drivers. Looking through forums about it, it seems like there are a lot of people experiencing HDMI audio issues on a variety of platforms, with a variety of screens, all relating back to ALSA:

https://bbs.archlinux.org/viewtopic.php?id=119151
http://ubuntuforums.org/archive/index.p ... 70228.html
http://crunchbang.org/forums/viewtopic.php?id=2310
https://www.raspberrypi.org/forums/view ... =66&t=7107

I'm just beginning to fall down this rabbit hole (two hours in), but have you been here before? There's no need for me to try and duplicate the efforts of someone who clearly knows more on the topic than I do.

Thanks,
Blake

blake3
 
Posts: 23
Joined: Thu May 28, 2015 10:41 am

Re: 10.1" LCD with HDMI and audio but no audio...

by andrewsi on Sun Jun 07, 2015 1:52 pm

As I think I mentioned in one post, the guy who wrote me from the screen manufacturer (and who then would no longer follow up) seemed to imply that the EDID data could be written in such a way as to make the audio work normally. I'm pretty convinced that the problem is the Realtek chip or the firmware for it, rather than the Pi itself or the ALSA drivers, but without more access to the data sheet of the chip, etc., this mystery is likely to remain unsolved. Better to just go with something that works, like the USB dongle, (mostly because the audio quality is much better than the pi's analog jack) and be done with it.

andrewsi
 
Posts: 47
Joined: Wed Jan 26, 2011 6:48 pm

Re: 10.1" LCD with HDMI and audio but no audio...

by blake3 on Sun Jun 07, 2015 8:54 pm

Andrewsi wrote:Possible fix found on RPi forum: http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=24679:

You can create a custom CEA HDMI mode 65 by putting explicit timings in the config.txt as follows:
hdmi_timings=1280 0 72 128 200 800 1 3 6 22 0 0 0 60 0 83500000 5
hdmi_group=1
hdmi_mode=65


So where does the hdmi_mode=65 come from? Is this a custom mode you made? RPiConfig doesn't list it as a mode (http://elinux.org/RPiconfig). Did you first specify a custom mode (https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=24679), and then implement it in the config.txt? If so, do you set the custom mode from the command line or directly in the config file, or other?

Appreciate it,
Blake
Last edited by blake3 on Sun Jun 07, 2015 8:59 pm, edited 1 time in total.

blake3
 
Posts: 23
Joined: Thu May 28, 2015 10:41 am

Re: 10.1" LCD with HDMI and audio but no audio...

by andrewsi on Sun Jun 07, 2015 8:57 pm

Yes, I specified a custom mode: See earlier in the thread. Then to implement the timing hack, you switch to mode 4 (720p) then back to the custom mode.

andrewsi
 
Posts: 47
Joined: Wed Jan 26, 2011 6:48 pm

Re: 10.1" LCD with HDMI and audio but no audio...

by blake3 on Mon Jun 08, 2015 10:05 pm

Well after reading through this thread and the "custom HDMI modes" page on the raspberrypi.org forums a bunch more times, I was still not sure if I had implemented a custom mode (very new to R-Pi). Then I read this page: http://tarnusdrinkscoffee.blogspot.com/2013/02/raspberry-pi-display-resolution-tip.html, which details instructions I'd seen and followed a dozen times elsewhere.

But doing it again I typed
Code: Select all | TOGGLE FULL SIZE
/opt/vc/bin/tvservice -m DMT
into terminal and got a list of DMT modes. (I'm not completely sure how this list which seems shorter, compares to the edid.dat file.) I already knew 27 and 28 didn't work with sound, but for no reason, I thought I'd try some others. I started with mode 85 at the bottom of the list. It worked! A DMT mode with the wrong aspect, but with sound!

From there I tried another, mode 82. Again, sound. Of course, I thought it was just dumb luck, so I went back to mode 27. Choppy sound. Back to mode 82. Sound. So some of the modes do seem to work.

Then I thought to look through other modes at non-native resolutions (1280X800) but with the same aspect ratio and Hz (don't know if it matters, but hey why not?). A list of modes is here: http://elinux.org/RPi_Configuration. First one I tried: mode 47, (1440x900, also 16:10) @60Hz displayed very nice, and with sound!

I'll keep testing this and post more if anything changes, but it really seems like this is a viable option. The screen looks much much better in these DMT modes than the CEA ones, and the sound, so far, is working through multiple reboots and reverts.

My /boot/config.txt file on a RPi 2B 1GB RAM (ID#2358) w/ latest Raspbian:
Code: Select all | TOGGLE FULL SIZE
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=800

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=47

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
# config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
arm_freq=1000

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README
core_freq=500
sdram_freq=500
over_voltage=2

blake3
 
Posts: 23
Joined: Thu May 28, 2015 10:41 am

Re: 10.1" LCD with HDMI and audio but no audio...

by blake3 on Tue Jun 09, 2015 10:53 pm

So actually, (of course), upon turning the system on today, there's no sound. Also, I was able to get a CEA mode 65, but with Andrewsi's variables, it gives me a blank (as in blue) screen. Perhaps the two monitors are slightly different, who will really ever know? Also, I tried Jwatte's solution from another thread, and also a no-go.

At this point I feel like I've done my due diligence. While it may not technically be broken, it is advertised as an "HDMI 4 PI" screen with audio, with a tutorial on how to use it to make a video looper with audio on the sales page. This is what I bought it (and the pi itself and speakers) to do, but unfortunately it seems like sound is out of the question. Can an Adafruit tech rep acknowledge this post, perhaps providing any other insight/ideas?

Thanks.

blake3
 
Posts: 23
Joined: Thu May 28, 2015 10:41 am

Re: 10.1" LCD with HDMI and audio but no audio...

by blake3 on Fri Jun 12, 2015 11:57 pm

So I know I've said it before (and will probably say it again), but I think I've got this to work. In the last few days I've been down the rabbit hole of deciphering EDIDs and have come out the other side feeling like I have a somewhat better understanding of how this all works. Let's take a journey together and learn about EDIDs and hdmi_timings shall we?! All of the following is my own opinion and understanding of what's going on. It is probably not completely accurate. I am not an expert, but I am here to help you.

Background: DMT modes are meant for computer monitors while CEA modes are meant for television displays. When connecting to the 10.1" display, CEA mode has always delivered audio reliably. The problem is the bad picture quality. This is because the 10.1" screen was most likely originally manufactured to be a computer or tablet monitor and not a television. You can read why I think that here: https://en.wikipedia.org/wiki/Graphics_display_resolution#1280x800. Andrewsi had the idea to trick the screen's internal firmware by delivering it a CEA mode, but one that was in a DMT resolution. Why would we want to do this? Because the driver board that came with the screen has an audio amplifier built right in (an NS4263 chip, google it to know more) and we want to use it. How will this be accomplished? With a custom resolution using hdmi_timings! But the page that describes hdmi_timings is hard to understand and has lots of variables (https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=24679). How do we know what to write in? What we are looking to do is create the perfect CEA timing for our 1280x800pixel screen-- a mode that does not yet exist, but that we will figure out. Andrewsi did this already. Unfortunately his values didn't work for my screen. Perhaps our screens are different. Here's what I did and hopefully this explanation will help you figure out values that work for your screen.

FYI, I'm using a Pi 2 B, running the latest Raspbian. My 10.1" monitor says the following on the back:
HSD101PWW1 Hannstar
Rev: 2 -A00 ED1.0 6 A0


Boot up your pi and "startx" to get to your desktop. Click terminal and type "tvservice -d myedid.dat" to copy your monitors EDID information to a file called myedid.dat. Locate the file. If you haven't opened any folders, the .dat file will probably end up in your /home/pi folder. Do not parse this file into a .txt with the edidparser command.

(July 21st, 2015 EDIT: I left this part out previously: Download Hex Friend [see posts below] and open the .dat file in it. Select the hex code, copy, and then go to http://www.edidreader.com/ [see directly below] and paste it into the text window.)

Go to http://www.edidreader.com/ and upload your .dat file and hit parse. This reader shows you what all the hex in your edid dat file actually means. You can figure this out yourself by going to http://en.wikipedia.org/wiki/Extended_Display_Identification_Data. This wiki article will tell you what each byte and bit of the hex string actually represents. Using a Hex to Binary converter such as http://www.binaryhexconverter.com/hex-to-binary-converter you can actually (I did this) go through the dat file, counting hex bytes, converting them to binary, and then count out the bits to figure out what is what. For instance, looking on the wiki page, you can see that the "timing descriptor 1" for your screen is between bytes 54 and 71 (counting from the beginning of the dat file, including byte 54 and 71). Within this are 18 bytes (0 through 17). Hex byte 17 can be converted to binary to give you 8 bits (7 is the first and 0 the last). Bits 2 and 1 of the 17th byte of the timing descriptor between bytes 54 and 71 of the overall EDID for example, will give you the vertical and horizontal sync polarity of your screen, two variables in the hdmi_timings command right there! See this isn't so hard.

So let's go over the individual pieces of what is needed for hdmi_timings:
Code: Select all | TOGGLE FULL SIZE
hdmi_timings=<h_active_pixels> <h_sync_polarity> <h_front_porch> <h_sync_pulse> <h_back_porch> <v_active_lines> <v_sync_polarity> <v_front_porch> <v_sync_pulse> <v_back_porch> <v_sync_offset_a> <v_sync_offset_b> <pixel_rep> <frame_rate> <interlaced> <pixel_freq> <aspect_ratio>

We need to fill in all these variables with information gleaned from the EDID dat file we took from the display. We know a couple already. Some of them are available to you using the edidparser linked to above. Upload your dat file and then click the "detailed timing descriptor 1" link. Why the first one and not a different one? Because the horizontal and vertical active pixels matched the desired screen resolution of 1280 x 800. I'll refer to "detailed timing descriptor 1" as DTD1 now.

h_active_pixels = your horizontal pixels = 1280 (located in DTD1)

h_sync_polarity = hex byte 17, of the bytes between 54 and 71 inclusive in the dat file, bit 1. For me this bit read "1", or positive H-sync polarity, known using the http://en.wikipedia.org/wiki/Extended_Display_Identification_Data page. I downloaded a hex reader for my mac called HexFriend (http://ridiculousfish.com/hexfiend/) which helped me search for the right hex byte quickly, then used http://www.binaryhexconverter.com/hex-to-binary-converter to convert to binary and find the 1 or 0.

h_front_porch = I had a lot of trouble figuring out what front porch was, until I found this page http://www.vesa.org/vesa-standards/standards-faq/ which had the following:
Q: Is the following true? Horizontal sync offset = Horizontal front porch, if Horizontal border = 0
A: Yes. Ref.: Section 3.10.2
Well good thing "horizontal sync offset" is listed under our DTD1 from the edidreader! For me this was 110.

h_sync_pulse = listed in DTD1. For me this was 40.

h_back_porch = this one was a little harder because there is no "back porch" term listed in the DTD1 settings. A google search for "horizontal back porch" brought me to this page: https://en.wikipedia.org/wiki/Horizontal_blanking_interval which discusses front porch, back porch, and sync pulse. There's this line:
back porch – blank while moving right again, before the start of the next scanline. Colorburst occurs during the back porch, and unblanking happens at the end of the back porch.
Through negation this sorta implies that the back porch is where the "blanking" happens. If you click back porch it takes you to the "analog television" wiki article which also has the line (while searching for mentions of back porch):
a short burst of subcarrier, known as the color burst, is transmitted during the back porch (re-trace blanking period)
which also implies that the back porch is for blanking. And what do you know anyway, "horizontal blanking" is listed in the DTD1 settings of the edidreader. For me this value was 160.

You can see how we are building up a CEA setting specific for our own screen.

v_active_lines = your vertical pixels = 800 (DTD1)

v_sync_polarity = same method as h sync polarity. using EDID wiki as a guide, find the 2nd bit of the 17th hex byte of the timing descriptor section as discussed above. Use HexFriend to find the bit, the convertor to convert to binary, and the wiki to interpret. For me this was 1 (which means positive polarity).

v_front_porch = "vertical sync offset" from the DTD1. For me this was 5.

v_sync_pulse = listed in DTD1. For me this was 5.

v_back_porch = "vertical blanking" in DTD1. For me it was 23.

v_sync_offset_a = I couldn't find any mention of what this was or really figure this one out. But Andrewsi's timings and every timing I found while googling had this set to 0, so my value was too.

v_sync_offset_b = same as above. My value was 0.

pixel_rep = whether or not the hdmi sends the same pixels twice. A little googling found this post in another forum by Andrewsi himself: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=24679&start=50. He writes:
As for pixel_rep: In effect, I think this is telling the display controller whether each pixel needs to be sent twice. The reason for this is that audio in HDMI is sent in-between frames of video and how much audio can be squeezed in is dependent on the pixel clock. As there are some lower resolution modes in HDMI (e.g. 640x480 interlaced like old SDTV), there wouldn't be enough available bandwidth to fit some of the higher-bandwidth compressed audio modes into the stream (e.g. AC3, DTS), so the HDMI spec defines some modes where the pixel clock runs twice as fast, but where each pixel is sent twice, resulting in the same effective video resolution but then the clock runs fast enough to jam the audio in there.

At first I set this to zero (as did Andrewsi). But then I thought, "hey its all about the audio" so I set it to 1 just to be on the safe side. I'm not sure if it makes a difference.

frame_rate = This I took to mean the refresh rate of the screen. In the edidreader under "CEA data block" and then under "video data block" I noticed that the native frequency, listed as "field rate" for this screen is 60 Hz. My value (and Andrewsi's) was 60.

interlaced = back to the hex bit reader, edid wiki, and hexadecimal to binary converter for that byte 17. Interlaced is bit 7 this time. Or you can look under "interlaced" of the edidreader's DTD1 settings. mine said "interlaced = false" so my value was 0.

pixel_freq = this is equal to "pixel clock" on the DTD1 in edidreader. for me this said 74.25 Mhz, so my value was 74250000.

aspect_ratio = this one was actually listed in the orignal forum post on custom hdmi timings https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=24679:
HDMI_ASPECT_4_3 = 1
HDMI_ASPECT_14_9 = 2
HDMI_ASPECT_16_9 = 3
HDMI_ASPECT_5_4 = 4
HDMI_ASPECT_16_10 = 5
HDMI_ASPECT_15_9 = 6
HDMI_ASPECT_21_9 = 7
HDMI_ASPECT_64_27 = 8

1280x800 is a 16:10 aspect ratio. My value was 5.

And there are your variables. So this leaves me with the following in my /boot/config.txt file:

Code: Select all | TOGGLE FULL SIZE
hdmi_timings=1280 1 110 40 160 800 1 5 5 23 0 0 1 60 0 74250000 5
hdmi_group=1
hdmi_mode=65

which when saved and rebooted, actually delivers sound. However the screen picture has a black border around it and doesn't look to be the right aspect ratio. To fix the aspect, we uncomment "framebuffer_width" and "framebuffer_height". Like this in the config.txt:
Code: Select all | TOGGLE FULL SIZE
#uncomment to force a console size. By default it will be display's size minus
#overscan.
framebuffer_width=1280
framebuffer_height=800

Save, rinse, and reboot.

Now we get sound and a picture with a uniform black border around the edges (with the correct aspect ratio). We must uncomment "disable_overscan" like this:
Code: Select all | TOGGLE FULL SIZE
#uncomment this if your display has a black border of unused pixels visible
#and your display can output without overscan
disable_overscan=1

Save, and reboot, and that should do it. You should now have a custom CEA mode in your config that boots your screen in a 1280x800 CEA mode which support sound and looks good. To test, I pop in a thumb drive with some media and go to the terminal:
Code: Select all | TOGGLE FULL SIZE
omxplayer /media/thumbdrivename/video.mp4
or
Code: Select all | TOGGLE FULL SIZE
omxplayer -o hdmi /media/thumbdrivename/othervideo.m4v
etc., where the probably optional "-o hdmi" specifies the audio out device as HDMI.

So far this has worked with .mp3, .mp4, and .m4v files (the only ones I've tested so far), short sound files to full length movies, through multiple reboots, and continued working after powering off the Pi and monitor for a whole day and then trying again. So while I'm fairly certain it's stable, I've said it before and I'll say it again, I'm no expert. And unlike Andrewsi's hack of the /etc/profile file described earlier in this thread, I do not have anything modified in the /etc/profile. No messing around with switching between multiple resolutions while playing sound files on startup.

I hope this helps you.

Adafruit should address this compatibility issue.

And sorry for the long post.

Blake



~~Updates~~

Still working three days later, and through three long overnight power offs of both the pi and screen, with multiple files played multiple times over several reboots.
Last edited by blake3 on Tue Jul 21, 2015 6:22 pm, edited 7 times in total.

blake3
 
Posts: 23
Joined: Thu May 28, 2015 10:41 am

Re: 10.1" LCD with HDMI and audio but no audio...

by andrewsi on Sat Jun 13, 2015 12:06 am

When I get a little time tomorrow I'll try your settings and see whether it makes a difference on my board. Nice detective work on your part from the Web sources- I actually have some professional experience with HDMI video generation.

andrewsi
 
Posts: 47
Joined: Wed Jan 26, 2011 6:48 pm

Re: 10.1" LCD with HDMI and audio but no audio...

by adafruit2 on Wed Jun 17, 2015 2:32 pm

Hiya thanks for the in detail work. To be honest, we have no idea how any of this works in detail, and we're still puzzled by why it works great with Xbox, windows, macs...but not Pi. but if its just generating a new EDID then that's something thats not too tough to do (and there's tools to help with it!) - we'll investigate this

one thing im not clear about - just so that i can replicate this:

* are you creating a new EDID or are you just forcing the HDMI timings in /boot/config?

adafruit2
Site Admin
 
Posts: 18251
Joined: Fri Mar 11, 2005 7:36 pm

Re: 10.1" LCD with HDMI and audio but no audio...

by blake3 on Wed Jun 17, 2015 3:18 pm

The latter. There is no real way that I know of to create a new EDID for the driver board's firmware. (To qualify that statement, I did see EDID programmers on ebay direct from China that update the EDID through the VGA port, but honestly that's not really realistic for the average end user.) What Andrewsi and I did was change the config.txt file of the Pi to allow it to output HDMI signals in such a way as to give the existing flawed EDID exactly what it was looking for. I did this by downloading the EDID values, and then creating a custom Timing output for the Pi (using "hdmi-timings") to output a timing mode the driver board wanted to receive.

In other words, it wants a CEA timing that doesn't exist, but that can be forced by manually modifying the hdmi output of the Pi.

I think the hdmi_timings code you need to create will be specific to your screen (or at least the driver board) and what EDID it has, which is why I went through the explanation of how to get those values for other users.

And to further update: This is still working for me many days later after many reboots and power offs.

But really, after reading through the forums, it seems like a lot of people have had these issues (which only show symptoms when trying to use sound), and that there should be a guide to help people through it. It was fairly difficult to figure it out as a first-time Pi user.

Blake

blake3
 
Posts: 23
Joined: Thu May 28, 2015 10:41 am

Re: 10.1" LCD with HDMI and audio but no audio...

by adafruit2 on Wed Jun 17, 2015 4:09 pm

OK, we'll try it out & add this to our tutorial/guide for sure! thank you so much for your help :)

adafruit2
Site Admin
 
Posts: 18251
Joined: Fri Mar 11, 2005 7:36 pm

Re: 10.1" LCD with HDMI and audio but no audio...

by dracos on Tue Jul 21, 2015 4:22 pm

I'd like to throw in that the custom mode 65 blake3 came up with works as-is for the 7 inch LCD with HDMI and audio (PID 1726). Although disable_overscan didn't do anything with that mode and I had to set all the overscan values to -48 to fill the display area.

The 7 inch screen has model number HSD070PWW1, which was similar enough to the 10.1 screen (just the size part is different) that I suspected it would work without too much trouble.

@blake3:

I was prepared to have my EDID decoded on edidreader.com, but I didn't see any way to upload the dat file, just a textarea.

dracos
 
Posts: 4
Joined: Sun Nov 16, 2014 7:58 pm

Re: 10.1" LCD with HDMI and audio but no audio...

by blake3 on Tue Jul 21, 2015 4:38 pm

What I might actually have done (I'm on a different computer at the moment) is used the pi to save the .dat file, transfered it to my computer, used a hex viewer program like Hex Friend (http://ridiculousfish.com/hexfiend/) to open it, and then copy/pasted it into edidreader.com. I'm pretty sure that would work. I'll check later if that's true and edit this post if necessary, but I'm fairly certain that was the work flow.

Glad you got your display working.

Blake

P.S. My display is still working correctly (though I am still having occasional power turn-on issues with the display-- mentioned in either this or other threads).

EDIT: The above is correct, I pulled the .dat into Hex Friend, then did a select all/copy and a paste into edidreader.com. I will edit the instructions to reflect this.
Last edited by blake3 on Tue Jul 21, 2015 6:19 pm, edited 1 time in total.

blake3
 
Posts: 23
Joined: Thu May 28, 2015 10:41 am

Re: 10.1" LCD with HDMI and audio but no audio...

by dracos on Tue Jul 21, 2015 5:49 pm

The greater feat seems to be getting audio to work with my BeagleBone Black at 1280x800. Took me months to find time to figure out how to get it to use native resolution (it insisted on 1280x720) and therefore not wrap the display 4 pixels vertically (the bottom of the panel was at the top of the screen; row #5 is where xdotool mousemove 0, 640 put the cursor.

I had to add this line to /boot/uboot/uenv.txt:

Code: Select all | TOGGLE FULL SIZE
kms_force_mode=video=HDMI-A-1:[email protected]

dracos
 
Posts: 4
Joined: Sun Nov 16, 2014 7:58 pm

Re: 10.1" LCD with HDMI and audio but no audio...

by inestbht on Fri Jul 31, 2015 12:40 am

finally got audio to work with the following settings:

hdmi_group=2
hdmi_mode=85

## Value hdmi_group=CEA hdmi_group=DMT
## ------------------------------------------------------------------
## 85 720p 60Hz

inestbht
 
Posts: 1
Joined: Fri Jul 31, 2015 12:37 am

Please be positive and constructive with your questions and comments.