STM32F4 I2S with DMA connected to Audio Codec, converting long to float
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-08-19 4:54 AM
Posted on August 19, 2013 at 13:54
Hi,
I have the I2S running on STM32F4 with DMA and Interrupt connected to a 24 bit AD/DA codec, which works fine. I receive/transmit the 64 bit frame based on 4 DMA transfers between SPIx->DR and Memory.Unfortunately the order of the Hi and Lo short (16 bit) is vice versa and I need to exchange the 16 Bit values to get a 32 bit Long, containing the 24 bit Audio in a correct order, to convert them via 'vcvt.s32.f32' and 'vcvt.f32.s32' to float and back.Is there a possiblity to receive/transmit the 16 bit values in a correct order, without manually exchanging them? I'm not sure if the DMA FIFO could be an option, or how to configure this function correctly.cheersmig #stm32f4-i2s-dma-24bit-codec
Labels:
- Labels:
-
I2S
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-08-19 5:11 AM
Posted on August 19, 2013 at 14:11
No. The DMA used in STM32s is rather dumb and does not support endian swap of any kind.
Fortunately, the ARM core implements barrel shift (maybe except the Cortex-M0(+), which is not the case here), i.e. halfword swap is only one instruction (in ''true'' ARMs (i.e. non-Thumb), it would be probably zero, as barrel shifts there are generally performed as part of other instructions, e.g. memory load). OTOH, you might find out that you need a full endian swap, i.e to swap the order of bytes in the word. Luckily, there's a single instruction in ARM for that, too (REV). JWOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-11 5:52 PM
Posted on February 12, 2015 at 02:52
I am working with a similar project using 24 bit audio codec. Could you please share your code? Thanks.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-12 1:06 AM
Posted on February 12, 2015 at 10:06
Have a look at the I2S examples in the Standard Peripheral Library, start from there and modify it to your particular application.
JW