Teensy Audio Adaptor with Maix Bit (micropython)

Status
Not open for further replies.

rcmz

Member
Hello, I'm trying to get a Teensy Audio Adaptor board (rev D) to work with a Maix Bit (a RISC V board !).

The Maix Bit uses micropython and comes with an I2C module, which has a scan function.
This scan function works without issue with an SSD1306, but returns nothing for the Teensy Audio Adaptor.

Am I missing some steps before being able to communicate with the Audio Adaptor with I2C ?

I have read here (http://iot-bits.com/interfacing-audio-codec-esp32/) that "Initialize MCLK first,
I2S second and I2C last. This is because many codecs will be non-responsive to I2C commands without MCLK."
So I have hooked up and configure I2S but still no response. Although I'm not sure what settings I should use for
the I2S.

Also, I am using the ground pin that is next to the 0 pin (and not the one next to the 3V pin), from what
I have gathered this correct thing to do.

If you have any idea or documentation,
Thanks
 
Also, I am using the ground pin that is next to the 0 pin (and not the one next to the 3V pin), from what
I have gathered this correct thing to do.

If you have any idea or documentation,
Thanks
IIRC, the original revision A-C audio boards for the Teensy 3.x processors, used the analog ground (the ground between the 3.3v pin and the VIN pin) for the audio stuff, and used the ground on the other side (next to pin 0) for the micro SD card reader and the flash memory pads. When Paul created the revision D audio board, he kept the same pinout, even though on a Teensy 4.0, both ground pins are the same. So you should connect both ground pins.
 
The SGTL-5000 wants a clocksignal. Without, it does not respond to I2C.
Yes, not the usual way, but its designed like this.
Ok, it does not make much sense anyway to not give it a clock...
This is only mentioned in the small print!

Quote:
Notes
1.
The SGTL5000 has an internal reset that is deasserted 8 SYS_MCLK cycles after all power rails have been brought up. After this time, communication can start.
Page 9, Datasheet.
(No, not bold, not cursive and not underlined ;) ) And yes, 8 SYS_MCLK cycles means, it must be present..

Edit: Oh, no, its mentioned in larger letters on page 13, too! (Exact the same sentence, copy&paste)
 
Last edited:
Thanks for you feedback ! I have connected the two ground pins together, I have reconfigured the I2S, and I have tried reading from I2C address 0x0A but still no luck T_T
I am using 44100hz for the I2S clock (well the Maix Bit corrects it to 44010Hz) and 100khz for the I2C clock (I have also tried 400khz).
The problem could not come from the fact that I have hooked up SPI ? (judging from the Audio Adaptor schematic the SPI is only connected to the SD and mem chip)
 
Ok, it must be present before you try to communicate via I2C.
That should work.
If not, it's an issue with the wiring.
 
Well, I think I'll buy a teensy to test my audio adaptor (in case I have killed it during on of my manipulations)
 
If you read anything in a datasheet, its the notes section!! All sorts of gotchas lie in wait there.
 
The MCLK pin must pulse at least 8 times before you attempt I2C communication. This is required for all boards. Even on Teensy, if you cold boot and then run the Wire library Scanner example, you'll get no response from the SGTL5000 chip if MCLK hasn't pulsed 8 times. But if you run any audio library program first, which turns on the 11.3 MHz clock to MCLK, and then upload the Scanner example (doing a warm reboot) the SGTL5000 will respond because it heard MCLK pulses while the other program was running. But then if you power cycle, that exact same Scanner program will run and get no response after a cold boot because Scanner doesn't send any pulses on the MCLK pin.
 
Ah, this is an interesting detail. So, MCLK does not need be present. SSGTL5000 just needs the reset toggles.
Well...exactly what the Datasheet says, but I did not expect this :)

That's what's confusing about datasheets: Sometimes you have to take them very literally. In the same datasheet elsewhere, however, imagination is required.... then, other parts are just wrong.

Had this some weeks ago with the Teensy LC CPU reference manual.. and countless times with the other reference manuals.
 
Ok I have some good news ! Instead of using the I2S module to generate the master clock, I used a PWM signal at 11.3mhz with 50% duty cycle, and the audio adaptor responded to the I2C scan ! So the issues comes from the Maix Bit I2S master clock :p
Thanks for you help !
 
Well, the mystery deepens...
I have purchased an oscilloscope, and I can now see that the I2S MCLK pin of the Maix Bit does outputs a 22.5MHz clock.
But the audio board still does not respond to I2C ! The strange thing is that if I generate a 22.5Mhz clock with the PWM function, then the audio board responds.
Could it be something related to the quality/stability of the signal ?

I have dug up the Maix code for I2S, and the MCLK management is not really implemented. For example the MCLK frequency does not change when you set the sample rate.
Instead, you have to set it manually using a PLL frequency and threshold value. I tried to find documentation related to PLL and thresholds but I didn't find much.
Maybe you guys have some tips ?
 
Status
Not open for further replies.
Back
Top