STM32F446 I2S stuck on Busy
Hi,
I've been trying to get I2S to work without using the HAL to get to know the MCU a bit more. I configured the Peripheral as mentioned in the reference manual, but whenever I write to the SPI->DR the status is stuck on busy.
This is my init function
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN; // enable GPIOA Port CLK; PA4 I2S1-WS; PA5 I2S1-CK; PA7 I2S1-SD
GPIOA->MODER |= GPIO_MODER_MODE4_1
| GPIO_MODER_MODE5_1
| GPIO_MODER_MODE7_1;
GPIOA->MODER &= ~(GPIO_MODER_MODE4_0 | GPIO_MODER_MODE5_0 | GPIO_MODER_MODE7_0);
GPIOA->AFR[0] |= (GPIO_AF5_SPI1 << GPIO_AFRL_AFSEL4_Pos);
GPIOA->AFR[0] |= (GPIO_AF5_SPI1 << GPIO_AFRL_AFSEL5_Pos);
GPIOA->AFR[0] |= (GPIO_AF5_SPI1 << GPIO_AFRL_AFSEL7_Pos);
RCC->APB2ENR |= RCC_APB2ENR_SPI1EN; // enable I2S Peripheral CLK
SPI1->I2SPR |= SPI_I2SPR_I2SDIV & 47u; // set I2S Prescaler to 47
SPI1->I2SPR &= ~SPI_I2SPR_ODD; // set I2S ODD to 0
SPI1->I2SCFGR &= ~SPI_I2SCFGR_CKPOL; // set Clock Polarity to LOW when IDLE
SPI1->I2SCFGR |= SPI_I2SCFGR_I2SMOD; // set Mode to I2S
SPI1->I2SCFGR |= SPI_I2SCFGR_I2SCFG_1; // set Mode to I2S Master Transmit
SPI1->I2SCFGR &= ~SPI_I2SCFGR_DATLEN; // set Data Length to 16 Bit
SPI1->I2SCFGR |= SPI_I2SCFGR_CHLEN; // set Channel Length to 32 Bit
SPI1->I2SCFGR &= ~SPI_I2SCFGR_I2SSTD; // set Channel to Philips Standard
// SPI1->CR2 |= SPI_CR2_TXEIE;
// NVIC_EnableIRQ(SPI1_IRQn);
SPI1->I2SCFGR |= SPI_I2SCFGR_I2SE; // enable I2SIn my main i simply check if TXE is set and then write a new value to the DR but since it never clears there is nothing happening there either.
What am I doing wrong?
