DMA HALFWORD and SAI_DATASIZE_24;
Hi, I'm trying to use SAI_DATASIZE_24; with the Audio_playback_and_record application demo for the STM32f769i_Discovery.
The demo uses DMA to copy data from the SAIx to the recorder buffer in 16bit.
I tried changing the data size in the DMA to WORD from HALFWORD but the just get a hard fault !
#define AUDIO_OUT_SAIx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_WORD // was HALFWORD 16bit ? now 32bit ?
#define AUDIO_OUT_SAIx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_WORD // was HALFWORD 16bit ? now 32bit ?
is there anything else I must do to enable 32bit DMA transfer ?
I can't change this from 0xFFFF // 16bit to 32bit since
#define DMA_MAX_SZE 0xFFFFFFFF
as you can see in the SAI_Handle_Structure_definition its a max of uint16_t transfer size?
uint16_t XferSize; /*!< SAI transfer size */
/** @defgroup SAI_Handle_Structure_definition SAI Handle Structure definition
* @brief SAI handle Structure definition * @{ */typedef struct __SAI_HandleTypeDef{ SAI_Block_TypeDef *Instance; /*!< SAI Blockx registers base address */SAI_InitTypeDef Init; /*!< SAI communication parameters */
SAI_FrameInitTypeDef FrameInit; /*!< SAI Frame configuration parameters */
SAI_SlotInitTypeDef SlotInit; /*!< SAI Slot configuration parameters */
uint8_t *pBuffPtr; /*!< Pointer to SAI transfer Buffer */
uint16_t XferSize; /*!< SAI transfer size */
uint16_t XferCount; /*!< SAI transfer counter */
DMA_HandleTypeDef *hdmatx; /*!< SAI Tx DMA handle parameters */
DMA_HandleTypeDef *hdmarx; /*!< SAI Rx DMA handle parameters */
SAIcallback mutecallback; /*!< SAI mute callback */
void (*InterruptServiceRoutine)(struct __SAI_HandleTypeDef *hsai); /* function pointer for IRQ handler */
HAL_LockTypeDef Lock; /*!< SAI locking object */
__IO HAL_SAI_StateTypeDef State; /*!< SAI communication state */
__IO uint32_t ErrorCode; /*!< SAI Error code */
}SAI_HandleTypeDef;the application recorder code was setup for 24bit 8 channels and works in TDM8 16bit.
So , should I hack the SAI HAL to work with 32 bit ?
Or does it not matter how the data is sent over DMA ?
There is also this
#define AUDIODATA_SIZE 2 /* 16-bits audio data size */
should I just change this to;
#define AUDIODATA_SIZE 4 /* 32-bits audio data size */
or
#define AUDIODATA_SIZE 3 /* 24-bits audio data size */
the data is sent out over DMA with ...
/* Update the Media layer and enable it for play */
HAL_SAI_Transmit_DMA(&haudio_out_sai, (uint8_t*) pBuffer, DMA_MAX(Size / AUDIODATA_SIZE));