2020-06-30 11:21 AM
Hi,
I have error (Write/Read Transfer Error) when I'm using JPEG decoder via DMA
HAL_JPEG_Decode_DMA(hjpeg ,(uint8_t *)JPEGSourceAddress ,CHUNK_SIZE_IN ,(uint8_t *)FrameBufferAddress ,CHUNK_SIZE_OUT);
I don't get any interrupts from JPEG but from MDMA I get Transfer Error Interrupt:
- mdma_jpeg_in I get HAL_MDMA_ERROR_WRITE_XFER
hdma->Instance.CISR = 0x1
hdma->Instance.CESR = 0xC0
hdma->Instance.CSAR = 0x30000400
hdma->Instance.CDAR = 0x52003040
- mdma_jpeg_out I get HAL_MDMA_ERROR_READ_XFER
hdma->Instance.CISR = 0x1
hdma->Instance.CESR = 0x44
hdma->Instance.CSAR = 0x52003044
hdma->Instance.CDAR = 0x70119800
JPEGSourceAddress (0x30000400) in RAM_D2
FrameBufferAddress (0x70119800) in SD_RAM
HAL_JPEG_MspInit is copied from examples
/* JPEG MDMA Init */
/* JPEG_INFIFO_TH Init */
hmdma_jpeg_in.Instance = MDMA_CHANNEL_JPEG_IN;
hmdma_jpeg_in.Init.Request = MDMA_REQUEST_JPEG_INFIFO_TH;
hmdma_jpeg_in.Init.TransferTriggerMode = MDMA_BUFFER_TRANSFER;
hmdma_jpeg_in.Init.Priority = MDMA_PRIORITY_VERY_HIGH;
hmdma_jpeg_in.Init.Endianness = MDMA_LITTLE_ENDIANNESS_PRESERVE;
hmdma_jpeg_in.Init.SourceInc = MDMA_SRC_INC_BYTE;
hmdma_jpeg_in.Init.DestinationInc = MDMA_DEST_INC_DISABLE;
hmdma_jpeg_in.Init.SourceDataSize = MDMA_SRC_DATASIZE_BYTE;
hmdma_jpeg_in.Init.DestDataSize = MDMA_DEST_DATASIZE_WORD;
hmdma_jpeg_in.Init.DataAlignment = MDMA_DATAALIGN_PACKENABLE;
hmdma_jpeg_in.Init.BufferTransferLength = 32;
hmdma_jpeg_in.Init.SourceBurst = MDMA_SOURCE_BURST_32BEATS;
hmdma_jpeg_in.Init.DestBurst = MDMA_DEST_BURST_16BEATS;
hmdma_jpeg_in.Init.SourceBlockAddressOffset = 0;
hmdma_jpeg_in.Init.DestBlockAddressOffset = 0;
if (HAL_MDMA_Init(&hmdma_jpeg_in) != HAL_OK) {
Error_Handler();
}
__HAL_LINKDMA(jpegHandle, hdmain, hmdma_jpeg_in);
/* JPEG_OUTFIFO_TH Init */
hmdma_jpeg_out.Instance = MDMA_CHANNEL_JPEG_OUT;
hmdma_jpeg_out.Init.Request = MDMA_REQUEST_JPEG_OUTFIFO_TH;
hmdma_jpeg_out.Init.TransferTriggerMode = MDMA_BUFFER_TRANSFER;
hmdma_jpeg_out.Init.Priority = MDMA_PRIORITY_VERY_HIGH;
hmdma_jpeg_out.Init.Endianness = MDMA_LITTLE_ENDIANNESS_PRESERVE;
hmdma_jpeg_out.Init.SourceInc = MDMA_SRC_INC_DISABLE;
hmdma_jpeg_out.Init.DestinationInc = MDMA_DEST_INC_BYTE;
hmdma_jpeg_out.Init.SourceDataSize = MDMA_SRC_DATASIZE_WORD;
hmdma_jpeg_out.Init.DestDataSize = MDMA_DEST_DATASIZE_BYTE;
hmdma_jpeg_out.Init.DataAlignment = MDMA_DATAALIGN_PACKENABLE;
hmdma_jpeg_out.Init.BufferTransferLength = 32;
hmdma_jpeg_out.Init.SourceBurst = MDMA_SOURCE_BURST_32BEATS;
hmdma_jpeg_out.Init.DestBurst = MDMA_DEST_BURST_32BEATS;
hmdma_jpeg_out.Init.SourceBlockAddressOffset = 0;
hmdma_jpeg_out.Init.DestBlockAddressOffset = 0;
if (HAL_MDMA_Init(&hmdma_jpeg_out) != HAL_OK) {
Error_Handler();
}
Why MDMA has no access to JPEG registers?