i2cdetect cannot detect codec board with i2cdetect on either I2C-1 or 6 via:
a) mini-breakout board + usb cables for power/console + bi-directional/i2c friendly level shifters (tried both https://www.sparkfun.com/products/12009 Sparkfun and https://www.adafruit.com/product/757 Adafruit) = empty i2cdetect table
b) Sparkfun I2C https://www.sparkfun.com/products/13034 block (includes level shifters) + Sparkfun Base https://www.sparkfun.com/products/13045 block (for power/console via usb cables) = "lost arbitration" messages which I haven't spent much time looking into
I am trying to dust off all of Sergey's audio related work (http://www.malinov.com/Home/sergey-s-blog/inteledison-simplei2saudiosetup blog, /thread/75433 forum post) and get Edison working with a MikroeElektronika's Audio Codec Proto board (https://shop.mikroe.com/add-on-boards/audio-voice/audio-codec-proto MIKROE-506) that is based off of the WM8731 (https://d3uzseaevmutz1.cloudfront.net/pubs/proDatasheet/WM8731_v4.9.pdf datasheet). Edison should be communicating to the Codec board via I2C for control and SPI for data.
I have verified the codec board works by hooking it up to an Arduino Uno like this project https://github.com/soundspotter/ArduinoUNO_AudioCodecMikroe506 here, which uses both I2C and SPI. I can hear the sine tone from the example with the headphones. Using the Arduino Wire library, I http://playground.arduino.cc/Main/I2cScanner scan the Arduino I2C bus and it always find the codec board.
Other things I've tried to rule out anything:
- I2C on Edison w/mini-breakout with and without level shifters can i2cdetect other I2C sensors (e.g. https://www.sparkfun.com/products/12918 MCP4725 DAC)
- Edison + Sparkfun Base Block + Sparkfun ADC https://www.sparkfun.com/products/13770 block can i2cdetect
- Sparkfun https://www.sparkfun.com/products/12942 Bus Pirate can always find the codec board with it's http://dangerousprototypes.com/blog/bus-pirate-manual/i2c-guide/ I2C 7bit address brute force search in any setup I've tried above in this post (found using both 100khz and 400khz I2C speed)
Searching I2C address space. Found devices at:
- Bus Pirate I2C Sniifer when I run i2cdetect looks ok but there is nothing found by i2cdetect back on Edison:
Any key to exit
- Pull up resistors - I've tried combinations of 1k external pullups and/or modifying the internal ones (/thread/59604 here) in the /sys/kernel/debug/gpio_debug/gpio*
- Also have tried various gpio export/etc as mentioned in the I2C section of the Edison Arduino Board guide (even though I do no have that board)
- Tried/thread/56148 configuring Edison I2C speeds (default was 'fast', but tried 'std' with no luck, WM8731 should support up to fast/400khz)
- Wrote test C programs using the MRAA library to try to 'talk' to this codec board with no luck
I feel like the only things I haven't tried is to either get the Arduino breakout board and/or power the mini-breakout board via external power supply. My I2C SDL/SCL lines at their longest are 40cm (2x20cm, connecting thru level shifter).
I reached out to Sergey (SergeyK) directly and he never did connect up Edison to this codec board. He re-used his own custom audio board (which I am shopping around from different PCB/A places). In the post, he mentions hooking up multiple power supplies to the codec board, which is only necessary if you're not using level shifters. He was a great help and gave fast, detailed replies to my emails but troubleshooting something funky like this wasn't going to get done over email.
Thanks for any help,
Using default firmware
root@edison:~# uname -a
Linux edison 3.10.98-poky-edison+ # 1 SMP PREEMPT Mon Jun 6 14:32:08 PDT 2016 i686 GNU/Linux
The WM8731 doesn't respond to i2cdetect commands. I think its mentioned in the datasheet that the device is write only. I had the same issue before.
Well now things are making some sense. I knew it had to be something obvious! I had tried i2cget commands also, but that'd be doing the same thing (trying to READ)...Thanks vinu_gk!
The datasheet does say:
The WM8731/L is a write only device and will only respond to the R/W bit indicating a write.
If WM8731 only supports write requests, I did try the i2cdetect -q option but Edison i2c does not support SMBus Quick Write. I'm not sure there is anything else to try there with that command. I guess i2cset commands will tell me if the codec is connected and powered correctly.
When I try to run Sergey's i2cset commands to initialize, it's a bit flaky where some work and some don't. I believe this has something to do with the high voltage levels that are coming from my level shifters. The WM8731 can only handle 3.6V and my scope is telling me I can peak that pretty easily. That being said, I still cannot hear audio playback with my headphones - no matter turning the volume all the way up (0x7f).
In another thread (/thread/111754 https://communities.intel.com/thread/111754), SpiderKenny suggests I rebaseline my firmware to Sergey's old one. I will have to give that a try...but in the meantime, does anyone know what could have changed with the audio subsystem or the dummy codec or something from firmware edison-src-ww18-15.tgz to iot-devkit-prof-dev-image-edison-20160606-patch.zip besides maybe the IoT stuff on top?
I've been exchanging posts with SpiderKenny in his thread that I referred to earlier ( ).
I rebuilt the firmware image off ww18-15 with Sergey's WM8731 patch and enabled it in the boot param 'audio_codec_name'. After configuring the ALSA settings, I feel like I'm closer but still not operational.
Here's my latest post there (/message/457392# 457392 https://communities.intel.com/message/457392# 457392), the whole thing is flaky. Some boots will complain of the -517 error, while sometimes it will complain of the -121 error....BUT then there are times where it DOES NOT COMPLAIN. I can actually use aplay or mpg123 to play to hw:1,0 (default:CARD=wm8731audio) - but I do not hear any audio from the codec board 3.5mm headphone jack. So software thinks it's working, but hardware doesn't seem to be.
Thanks to several people offline ( SergeyK, SpiderKenny, vinu_gk, squaredn) - I finally was able to play audio (still need to test recording). The bottom line is I should've 'listened' to the blogs and posts exactly before insisting I should be able to connect this another way. Level shifters DO NOT work here no matter what I tried - you HAVE to use different power supplies from Edison to power the WM8731 chip.
The solution? Use a combination of both of Sergey's posts (http://www.malinov.com/Home/sergey-s-blog/inteledison-simplei2saudiosetup one, http://www.malinov.com/Home/sergeys-projects/audio-block-for-intel-edison two)
- I rebuilt the firmware image off ww18-15 with Sergey's WM8731 patch and enabled it in the boot param 'audio_codec_name'.
- Using AlexT's repo, install mpg123 and download a sample mp3 like the one from https://archive.org/details/testmp3testfile here
- Modify the codec board like this picture (thanks squaredn!). This isn't my picture, I broke off the top of the inductor trying to cut/lift the L2 leg. It's a little flaky playing the audio but it works. Sergey told me I could remove the inductor if I needed to get more reliable but this inductor is in a circuit to improve audio quality. I need to test with and without it to see what I'm going to do for my situation.
SpiderKenny, I know the WM8731 http://www.mouser.com/ds/2/76/WM8731_v4.9-532414.pdf datasheet on page 6 says DCVDD/Core typically runs at 1.5V - but it can support 3.6V MAX! I figured this is what MikroElektronika was reading too when they designed the board the way they did - only one VCC pin of 3.3V. What is this newbie missing? Level shifters should have worked??? I'll take the win here, but have to get to the bottom of why these didn't work.
I tied pin 1 and 27 to 1.8 V and pin 14 to +3v3 (for audio)
But you are right that Level shifters should have worked.
Which ones did you use?
(I've found that the Edison uses weak pull-ups and the type of level shifters which don't need a direction pin get confused with which direction to pass the signals.
For example on an RS232 port I was using the internal pull up of the Receive line in an FTDI CMOS Cable was strong enough to make the level shifter to think that the line was input rather than output.)
I'm surprised you didn't also put pin 8 to +3v3 HPVDD, it also is listed as an 'Analogue Supply' in that same table I reference on page 6.
I tried two bi-directional sets from Adafruit (https://www.adafruit.com/product/757 https://www.adafruit.com/product/757) and Sparkfun (https://www.sparkfun.com/products/12009 https://www.sparkfun.com/products/12009).
Did you even try to manipulate the Edison internal pull-ups via command line (e.g. ) like it says in the Arduino Breakout guide? (I don't have the Arduino Breakout for Edison, but it has a lot of good reference info there). The internal pull ups can be configured as 2, 20 or 50 kohm (w/I2C pins capable of 910 ohms). I only ever tried adding external resistors (only tried 2.2kohm I think) on the I2C SDA and SCL lines thru the level shifters. I never tried any other lines or stronger resistors.
There was this Arduino <-> Codec Board project on Github (https://github.com/soundspotter/ArduinoUNO_AudioCodecMikroe506 https://github.com/soundspotter/ArduinoUNO_AudioCodecMikroe506). This is what I used to verify my codec board worked. Now that I got things working with Edison, I referenced back to the project. He has you hook up 220ohm series resistors between the ADC/DACLRC lines. Do you think this is the combination of pins and resistor strength to use Edison w/Codec Board as-is? I am still learning the actual math/etc behind all of this circuitry.
joe_nastiTurns out I just forgot to mention pin 8 :-)
Here's a partial schematic of my board:
And an image of the actual board:
(Forgive the crude hand soldering - this was a prototype hand built by me, including hand soldering the 70 Pin header!)
Thanks for sharing, Kenny...I really need to step my soldering game up for those fine-pitched parts....any secret for getting the 70-pins connected and verified working?
joe_nasti Yeah - I clean the pads with isopropyl alcohol, then put a small amount of solder on one corner pad. (eg, pad 1)
I then slide the part into place, and solder down the one pad. Don't worry at this stage if you short it to neighbouring pads. Then align the part and solder the diagonally opposite pad. (eg, pad 70).
Then put some good quality flux all over all the pads. Drag a small blob of molten solder along all the pads. Using flux and a clean soldering tip you can wick away any shorts. Use a microscope or magnifying glass to check the connection.
This works well for me, the magic is the flux, it helps keep the solder going only where it is mean to. The flux in multi-core solder won't do it. You can use multi-core solder, but you'll still need extra flux. I use a gel-type tacky flux rather than a liquid flux pen.