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)?
View full article