Hello, I want to read audio data from ADC using I2S of STM32F411 microcontroller. I want to use DMA to do so. But I have no idea how to configure it. I am using RTIC v2 with stm32f4xx_hal crate.
I have tried this code:
let i2s = DualI2s::new(
ctx.device.SPI2,
ctx.device.I2S2EXT,
(ws,ck,NoPin::new(),sd,sdext),
&_clocks
);
let i2s_config: DualI2sDriverConfig<Master, Transmit, Receive, Philips> = DualI2sDriverConfig::new_master()
.direction(Transmit, Receive)
.standard(Philips)
.data_format(DataFormat::Data32Channel32)
.request_frequency(crate::common_peri::I2S_SAMPLE_RATE);
let mut I2SInput = DualI2sDriver::new(i2s,i2s_config);
I2SInput.ext().set_rx_dma(true);
// configure DMA for I2S
I2SInput.ext().set_error_interrupt(true);
I2SInput.ext().set_rx_interrupt(true);
let i2s_buffer = cortex_m::singleton!(: [u8; 2048] = [0; 2048]).unwrap();
let streams = StreamsTuple::new(ctx.device.DMA2);
let I2SDma=Transfer::init_peripheral_to_memory(
streams.0,
I2SInput,
i2s_buffer,
None,
DmaConfig::default()
.memory_increment(true)
.fifo_enable(true)
.fifo_error_interrupt(true)
.transfer_complete_interrupt(true)
);
but I am getting error: the trait PeriAddress
is not implemented for stm32f4xx_hal::i2s::stm32_i2s_v12x::driver::DualI2sDriver<DualI2s<stm32f4xx_hal::pac::SPI2>, stm32f4xx_hal::i2s::stm32_i2s_v12x::driver::Master, stm32f4xx_hal::i2s::stm32_i2s_v12x::driver::Transmit, stm32f4xx_hal::i2s::stm32_i2s_v12x::driver::Receive, stm32f4xx_hal::i2s::stm32_i2s_v12x::driver::Philips>