i.MX RT1064 Custom Board – SGTL5000 Codec Not Responding Over I2C Hi, I have designed a custom PCB using the MIMXRT1064 processor and the SGTL5000 audio codec. For the SGTL5000 circuit, I followed the standard/reference SGTL5000 schematic. The connections between the RT1064 and SGTL5000 are as follows: LPI2C1_SCL → GPIO_AD_B1_00 LPI2C1_SDA → GPIO_AD_B1_01 SAI1_MCLK → GPIO_AD_B1_09 SAI1_RXD → GPIO_AD_B1_12 SAI1_TXD → GPIO_AD_B1_13 SAI1_RX_BCLK → GPIO_AD_B1_11 SAI1_RX_LRCLK → GPIO_AD_B1_10 I have attached the relevant part of my schematic as well. My main problem is that after flashing the firmware, I am not receiving any I2C ACK from the SGTL5000. I measured the following voltages: SCL = approximately 3.3 V SDA = approximately 3.3 V MCLK = approximately 1.6 V For debugging, I wrote a function that temporarily changes the I2C pins to GPIO, generates 9 clock pulses, performs a bit-banged I2C address scan, and then restores the pins back to LPI2C1. static void i2c_hw_debug(void) { gpio_pin_config_t in = { kGPIO_DigitalInput, 0, kGPIO_NoIntmode }; IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_00_GPIO1_IO16, 0U); IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_01_GPIO1_IO17, 0U); IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_00_GPIO1_IO16, 0x00B0U); IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_01_GPIO1_IO17, 0x00B0U); gpio_pin_config_t out_init = { kGPIO_DigitalOutput, 1, kGPIO_NoIntmode }; GPIO_PinInit(GPIO1, 16, &out_init); GPIO_PinInit(GPIO1, 17, &in); for (int i = 0; i < 9; i++) { GPIO_PinWrite(GPIO1, 16, 0U); SDK_DelayAtLeastUs(10U, SystemCoreClock); GPIO_PinWrite(GPIO1, 16, 1U); SDK_DelayAtLeastUs(10U, SystemCoreClock); } PRINTF("Scanning I2C addresses...\r\n"); for (uint8_t addr = 0x03; addr <= 0x77; addr++) { if (bb_probe(16, 17, addr)) { PRINTF("ACK found at 0x%02X\r\n", addr); } } IOMUXC_SetPinMux( IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, 1U); IOMUXC_SetPinMux( IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, 1U); } How can I initialize the SGTL5000 codec with the MIMXRT1064, and why am I not receiving an ACK from the codec even though all the hardware connections and configurations appear to be correct? Thanks. Re: i.MX RT1064 Custom Board – SGTL5000 Codec Not Responding Over I2C Hi @Anushka_SS,
I would suggest basing your application on the evkmimxrt1064_sai example code instead. This code exemplified the integration of the RT1064 and a WM8960 codec. That said, we do also provide the fsl_sgtl5000.c/.h driver files, which can be imported as a component to the project, and enabled by simply changing the codec used by undefining CODEC_WM8960_ENABLE and defining CODEC_SGTL5000_ENABLE instead. The SGTL5000 driver files have the necessary routines to properly initialize and use this codec.
Let me know if this helps, and if you require any further assistance.
BR, Edwin. Re: i.MX RT1064 Custom Board – SGTL5000 Codec Not Responding Over I2C Thank you. I have already done this: a fresh project using the SDK's fsl_sgtl5000 driver with CODEC_SGTL5000_ENABLE. The problem occurs before the driver initializes: the SGTL5000 NAKs its address (0x0A and 0x2A, LPI2C status 902). Verified at run time: Audio PLL = 786.432 MHz, SAI1 MCLK = 12.288 MHz (read back from the CCM registers), LPI2C clock = 10 MHz. I am using GPIO_AD_B1_00/01 for LPI2C1 and GPIO_AD_B1_09 for MCLK. The SGTL5000 module is connected to my custom RT1064 board with jumper wires. Can you suggest what else to check on the hardware side (pad settings, MCLK signal integrity, anything specific to the RT1064)? Re: i.MX RT1064 Custom Board – SGTL5000 Codec Not Responding Over I2C I have both the RT1064 and the SGTL5000 codec on my custom board. I tested each chip independently: the SGTL5000 with a Teensy 4.1, and the RT1064 with an external PJRC SGTL5000 audio shield. Both work fine on their own, but when I connect them together by soldering their pins, it doesn't work, and I get this output: === SGTL5000 bring-up test === I2C scan (Teensy style)... Scan done: 0 device(s) Audio PLL = 786432000 Hz SAI1 mux=2 prediv=3 div=15 -> MCLK = 12288000 Hz (expect 12288000) LPI2C clock = 10000000 Hz (expect 10000000) -- try 1 -- CHIP_ID @0x A: status=902 id=0x 0 0 CHIP_ID @0x2A: status=902 id=0x 0 0 -- try 2 -- CHIP_ID @0x A: status=902 id=0x 0 0 CHIP_ID @0x2A: status=902 id=0x 0 0 -- try 3 -- CHIP_ID @0x A: status=902 id=0x 0 0 CHIP_ID @0x2A: status=902 id=0x 0 0 SGTL5000 not answering. Stop. The voltages I'm measuring are: SCL: 3.2 V SDA: 3.2 V MCLK: 1.5–1.6 V Re: i.MX RT1064 Custom Board – SGTL5000 Codec Not Responding Over I2C Update: MCLK testing results The RT1064 board and the codec board are two separate boards, connected with jumper wires. I tested the codec using MCLK from two different sources, with the same RT1064 I2C firmware. Test 1: MCLK from the RT1064 (SAI1_MCLK, GPIO_AD_B1_09, 12.288 MHz) A DC multimeter on the MCLK pin reads about 1.57 V (supply about 3.1 V). Slow bit-bang I2C (~1 kHz): the codec ACKs, but CHIP_ID reads 0xBFFF / 0xA01F instead of 0xA011. LPI2C at 5, 10, 20, 50 and 100 kHz: NAK at every speed (status 902). With a weak MCLK pad setting (0x1008), the codec doesn't answer at all and the MCLK pin reads about 0 V. Different MCLK pad drive settings made no difference. Test 2: MCLK from a Teensy 4 (pin 23) RT1064 MCLK jumper wire disconnected from the codec board. Teensy MCLK connected to the codec board's MCLK pad, Teensy GND connected to the codec board's GND. RT1064 still drives I2C (SCL/SDA) through jumper wires. RT1064 LPI2C at 100 kHz: CHIP_ID = 0xA011 and CODEC_Init OK. A DC multimeter on the Teensy MCLK reads about 1.7 V (3.3 V supply). Conclusion so far The codec board, its power supplies, the I2C wiring and the I2C firmware all work. The problem is only the MCLK coming from the RT1064 board. The DC level looks normal on a multimeter, but the codec behaves as if the 12.288 MHz clock arriving from the RT1064 is not usable.
記事全体を表示