hasseb
Posts: 17
Joined: Wed Dec 24, 2014 3:03 pm

Audio output

Wed Dec 24, 2014 3:15 pm

I have a problem with the analog PWM audio output. I can not get audio signal out from the GPIO pins 40 or 45. The connection is similar to the Raspberry Pi and the schematics can be found from the attachment.

What have I done:

1. Tested the R-Pi Troubleshooting: http://elinux.org/R-Pi_Troubleshooting
2. Tested that the pins are connected properly, by pulsing them with Python. The pins are connected correctly, because I can hear sound by pulsing GPIO pins 40 and 45.
3. I have measured with oscilloscope, that there are no signal. I carried out the test with the Compute Module IO board and with my self designed board, no sound in neither case.
4. I tested the sound with Raspberry Pi B+. The sound works fine.
5. I haven't mess any software. The tests were carried out with fresh Raspbian installations.

Has anyone else met similar issues?

BR,
Hans Baumgartner
http://store.hasseb.fi
Attachments
audio.png
audio.png (30.96 KiB) Viewed 4357 times
Last edited by hasseb on Wed Dec 24, 2014 7:38 pm, edited 2 times in total.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1610
Joined: Sat Sep 10, 2011 11:43 am

Re: Audio output

Wed Dec 24, 2014 5:26 pm

You will have trouble with this because the alternate setting for the B+ and the compute module are not the same...

http://www.raspberrypi.org/documentatio ... uration.md

From this page you'll see that we can alter the way the pins are configured at boot time (i.e. the pulls and alternate settings)

If you have a look at this

http://www.raspberrypi.org/documentatio ... t-blob.dts

This is the default configuration we use for the binary blob set up, and as you can see the configuration for the compute module is different to the B+ (specifically to avoid us driving pins that you've wired up differently!) What you need to do is set up pins 40 and 45 in the dts for the compute module (pins_cm section) the same as they are done with the B+ and that should solve your problem

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

hasseb
Posts: 17
Joined: Wed Dec 24, 2014 3:03 pm

Re: Audio output

Wed Dec 24, 2014 7:19 pm

Thank you very much and merry christmas, audio works now. I should have asked before, I spend something like two weeks and plenty of euros trying to find out what's wrong.

By the way, how does the kernel knows which revision of the board I'm using? At least there are no pull-up or -down resistors to specify the hardware version. Is there something hidden inside the BCM2835?

I have a working board for compute module with LAN9512. The schematics are available from http://hasseb.fi/pi/

BR,
Hans Baumgarter
http://store.hasseb.fi

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1610
Joined: Sat Sep 10, 2011 11:43 am

Re: Audio output

Thu Dec 25, 2014 9:19 am

The board revision is kept in OTP and programmed at manufacture time...

you can check the revision using

vcgencmd otp_dump

I believe it is row 31 (should be 0x11 or something...)

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

Luxonis-Brandon
Posts: 2
Joined: Tue Sep 03, 2019 3:33 pm

Re: Audio output

Tue Sep 03, 2019 3:56 pm

Hi there,

Thanks for the helpful post here! So we're working with a Compute Module 3B+ and running into the same issue.

We made our own carrier board, which connects GPIO pin40 and pin41 to a 3.5mm jack through a line driver and a filter, per the recommended schematics for the 3B+ io board.

And we also copied the pin config from the Raspberry Pi 3B+ section of the dt-blob.dts, but we're still not getting any audio output from the 3.5mm jack, even w/ raspi-config forcing audio to the 3.5mm jack.

Running speaker-test, we do get output over HDMI when raspi-config audio settings are set to auto or HDMI. But when they're set to 3.5mm, we still get nothing.

Any ideas? We're currently at a loss.

Thanks in advance,
Brandon

aBUGSworstnightmare
Posts: 2329
Joined: Tue Jun 30, 2015 1:35 pm

Re: Audio output

Wed Sep 04, 2019 3:48 am

Wow .. 5 years necro posting :D

Just for the sake of asking the question: you've compiled your own dt-blob.bin?
What is the output of 'raspi-gpio get'?

Luxonis-Brandon
Posts: 2
Joined: Tue Sep 03, 2019 3:33 pm

Re: Audio output

Thu Sep 05, 2019 1:19 am

Thanks for chiming in! And heh; I'dever heard the term 'necro posting' before. :-) I'm presuming what it means, and if that presumption is correct - excellent use!

Anyways, I meant to circle back earlier today - the problem was actually a hardware one. The wrong driver IC got populated. The proper IC is a NC7WZ16P6X 'push-pull' driver for outputting the PWM into the filter which then goes out the 3.5mm jack.

But instead a NC7WZ07P6X was populated (it looks identical), which is an open-drain driver... so it could never pull high. So actually the dtoverlay technique (and dt-blob.bin) technique that I was trying were both independently working, it's just this wrong hardware line driver was preventing any signal from getting out of the board. Doh! (So it sure seemed like the config wasn't working!)

For anyone who comes to this in the future (maybe 5 years from now! Winkey face!), here's what I added to config.txt under /boot/ on the Raspberry Pi to get this to work:

Code: Select all

# Set the audio lines on GPIO40 and GPIO41 pins
dtoverlay=pwm-2chan,pin=40,func=4,pin2=41,func2=4
This is the simplest/easiest way to get it to work, and is courtesy of these lovely folks:
https://www.acmesystems.it/CM3-HOME_microsd

So this is a bit easier than doing a custom device tree (https://www.raspberrypi.org/documentati ... w-guide.md) or dt-blob.bin (https://www.raspberrypi.org/documentati ... uration.md) as you don't have to do any of the
'sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob.dts' stuff... you can just `sudo leafpad config.txt`, add those lines, save, reboot and enjoy!

For the sake of completeness - and so to answer your question - at the bottom is the output of `raspi-gpio get` after I changed config.txt with this overlay call-out (and also making a custom dt-blob.bin for Raspberry Pi camera connection, which works, which is cool, but is also completely unrelated to this and I'm only mentioning it in case someone notices that part and says 'hey! Why are GPIO0 and GPIO1 configured for I2C?!' (They're configured that way because we wired the camera I2C to those ports on our hardware... which we'll be open-sourcing once we verify it all))

Anyways, thanks again!

-Brandon

Code: Select all

BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=4 alt=0 func=SDA0
GPIO 1: level=1 fsel=4 alt=0 func=SCL0
GPIO 2: level=1 fsel=0 func=INPUT
GPIO 3: level=1 fsel=0 func=INPUT
GPIO 4: level=1 fsel=0 func=INPUT
GPIO 5: level=0 fsel=1 func=OUTPUT
GPIO 6: level=1 fsel=0 func=INPUT
GPIO 7: level=1 fsel=0 func=INPUT
GPIO 8: level=1 fsel=0 func=INPUT
GPIO 9: level=0 fsel=0 func=INPUT
GPIO 10: level=0 fsel=0 func=INPUT
GPIO 11: level=0 fsel=0 func=INPUT
GPIO 12: level=0 fsel=0 func=INPUT
GPIO 13: level=0 fsel=0 func=INPUT
GPIO 14: level=1 fsel=4 alt=0 func=TXD0
GPIO 15: level=1 fsel=4 alt=0 func=RXD0
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
GPIO 19: level=0 fsel=0 func=INPUT
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=0 fsel=0 func=INPUT
GPIO 24: level=0 fsel=0 func=INPUT
GPIO 25: level=0 fsel=0 func=INPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT
BANK1 (GPIO 28 to 45):
GPIO 28: level=0 fsel=0 func=INPUT
GPIO 29: level=0 fsel=0 func=INPUT
GPIO 30: level=0 fsel=0 func=INPUT
GPIO 31: level=0 fsel=0 func=INPUT
GPIO 32: level=0 fsel=0 func=INPUT
GPIO 33: level=0 fsel=0 func=INPUT
GPIO 34: level=1 fsel=0 func=INPUT
GPIO 35: level=1 fsel=0 func=INPUT
GPIO 36: level=1 fsel=0 func=INPUT
GPIO 37: level=0 fsel=0 func=INPUT
GPIO 38: level=0 fsel=0 func=INPUT
GPIO 39: level=0 fsel=0 func=INPUT
GPIO 40: level=0 fsel=4 alt=0 func=PWM0
GPIO 41: level=0 fsel=4 alt=0 func=PWM1
GPIO 42: level=0 fsel=0 func=INPUT
GPIO 43: level=0 fsel=0 func=INPUT
GPIO 44: level=0 fsel=0 func=INPUT
GPIO 45: level=0 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3

Return to “Compute Module”