7 years, 1 month ago.

I2S Full Duplex

Hi I am using a TLV320 with the Nucleo-F401RE and want to set up I2S in full duplex mode.

I have set things up do that SPI2 recieves and I2S2ext transmits. However nothing comes out of I2S2ext. (I have tried swapping input and output and in this case nothing come into I2S2ext.) As far as I can see everything is set correctly for I2S2ext to work, but it doesn't appear to do anything at all.

I am not using interrupts or DMA at this stage, as I thought I get the basic tx/rx working first.

I have the following registers set.

SPI2 Registers CR1: 00000000 CR2: 00000000 SR: 000001c7 I2SCFGR: 00000d00 I2SPR: 00000002

SPI2ext Registers CR1: 00000000 CR2: 00000000 SR: 0000018e I2SCFGR: 00000c00 I2SPR: 00000002

GPIOA Registers AFR[0]: 00007700 AFR[1]: 00000000 MODER: a80004a0 PUPDR: 64000050

GPIOB Registers AFR[0]: 00000000 AFR[1]: 55550044 MODER: aa0a1280 PUPDR: 550f30c0

I am setting things up with: void Init() { RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN; RCC->APB1ENR |= RCC_APB1ENR_SPI2EN;

uiValue = GPIOB->AFR[1]; DBG(SerialPort, "Value: %08x", uiValue); Reset the the 4 MSB: uiValue &= 0x0000FFFF; Configure PB_12..15 to AF5: uiValue |= 0x55550000; DBG(SerialPort, "Value: %08x", uiValue); GPIOB->AFR[1] = uiValue;

configure PB_12..15 to AF uiValue = GPIOB->MODER; uiValue &= 0x00FFFFFF; uiValue |= 0xaa000000; DBG(SerialPort, "Value: %08x", uiValue); GPIOB->MODER = uiValue;

uiValue = GPIOB->OSPEEDR; Clear the bits: uiValue &= (GPIO_OSPEEDER_OSPEEDR12_0 | GPIO_OSPEEDER_OSPEEDR13_0 | GPIO_OSPEEDER_OSPEEDR14_0 | GPIO_OSPEEDER_OSPEEDR15_0); Set speed: uiValue |= GPIO_OSPEEDER_OSPEEDR12_0 | GPIO_OSPEEDER_OSPEEDR13_0 | GPIO_OSPEEDER_OSPEEDR14_0 | GPIO_OSPEEDER_OSPEEDR15_0; Set the register: GPIOB ->PUPDR = uiValue;

SPI2 set to slave rx SPI2->I2SPR = 0x2; SPI2->I2SCFGR = SPI_I2SCFGR_I2SMOD | SPI_I2SCFGR_I2SCFG_0;

slave tx I2S2ext->I2SPR = 0x0002; I2S2ext->I2SCFGR = SPI_I2SCFGR_I2SMOD; }

and then starting it with void Start () { I2S2ext->I2SCFGR |= SPI_I2SCFGR_I2SE; SPI2->I2SCFGR |= SPI_I2SCFGR_I2SE; }

Any help gratefully received.

Tim

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.
Be the first to answer this question.