2013-08-08 12:17 PM
I faced a critical problem of i2s of STM32.
I'm developing a simple system for i2s level meter.MCU - STM32F103RCT6 with external X-tal(12MHz), 72MHz of running clock Inpit Audio - 48KHz, 16bits, stereo i2s digital audio (MCU pin : WS, SD, SCK used)Using the ST library,First, I set RCC like this,SystemInit (); // set system clock - 72MHz...RCC_APB1PeriphClockCmd( RCC_APB1Periph_I2C1 | RCC_APB1Periph_SPI2, ENABLE ); // I2S...then, I set I2Ss port,NVIC_InitTypeDef NVIC_InitStructure; /* SPI2 IRQ channel configuration */NVIC_InitStructure.NVIC_IRQChannel = SPI2_IRQn;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;NVIC_Init(&NVIC_InitStructure); SPI_I2S_DeInit(SPI2); /* I2S peripheral configuration */I2S_InitStructure.I2S_Standard = I2S_Standard_Phillips;I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16bextended;I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable;I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_48k;I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;/* I2S2 configuration */I2S_InitStructure.I2S_Mode = I2S_Mode_SlaveRx;I2S_Init(SPI2, &I2S_InitStructure);/* Enable the I2S2 */I2S_Cmd(SPI2, ENABLE);/* Enable the I2S2 RxNE interrupt */SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_RXNE, ENABLE);After that, I read i2s register, when i2s audio of simple tone signal was connected,the maximum value was changed intermittently.10 results of test are belowtest 0 : 3592test 1 : 3592
test 2 : 3592test 3 : 0test 4 : 3592test 5 : 32177test 6 : 4095test 7 : 32177test 8 : 63test 9 : 3592( expected value of I2S is 3592)I guess this problem is about init i2s port or clock,so I did almost change options.(changed Dataformat, Mode, CPOL, AudioFreq...)but it was not effective.Would you help me if you have an experience of i2s?Thanks for all,Frank #slave #stm32 #i2s
2013-08-09 12:52 AM
Did you read errata sheet? There is HUGE BUG in ALL STM32 micros. In slave mode WS (Frame sync) signal is ignored. You must enable I2S peripheral BEFORE any incoming transmission (stream). Why ST can't correct this!? 5 years and nothing changed }:
2013-08-09 09:58 PM
Thank you so much!
2013-08-13 01:06 PM
Does this bug also apply to the I2Sxext interfaces for full duplex mode? I think you have to run those in slave mode even if the I2Sx interface is in master mode.
2015-01-06 08:06 PM
Hello Frank,
I am working on a project now. I have designed an interface to convert AES/EBU digital and Analog audio inputs to I2S. I am working with a frequency of 192kHz. I want to test the designed systems with Nucleo STM32 Evaluation boards.I am having some difficulties with the coding. Please , i would appreciate if you can help meBest regardsDan