2022-05-04 01:50 PM
When using an EXTI input to trigger a DMA request, there is only the possibility to trigger on falling or rising edged of the input. But my peripheral has only an output which is active when data are ready for read or write. This output is static and stays ON as long as data are available (fifo in the peripheral has data) and goes off when no data available. How cab I use the STM32 DMA which such a peripheral.
2022-05-04 03:27 PM
Perhaps via a TIM CHx input source? ie TIM latches CNT to CCRx, with side effect of DMA trigger
2022-05-05 12:27 AM
Show us, how do you handle this peripheral without DMA.
JW
2022-05-05 01:01 AM
On the STM side I'm using an 8-bit FMC –SRAM interface. On the peripheral there is a small FIFO.
So far I read the data with the CPU but would like to do that with the DMA.
This is my read function:
void SCSI_Read_FIFO (uint8_t *Data, int Len)
{
screg_t *FIFO_Status = &SCSI_regs->FIFO_Status;
screg_t *FIFO_Data = &SCSI_regs->FIFO;
while (Len > 0) {
while (*FIFO_Status == 0) {
continue;
}
*Data++ = *FIFO_Data;
--Len;
}
}
The peripheral chip has an output which is ON when data available.
It works something like described in this article under DMA Level request:
2022-05-05 02:16 AM
The STM32 does not use the DMA unit ("cell") described in article you linked into.
I know of no way to feed a GPIO directly into DMA's trigger input in STM32 (I don't know everything about STM32, though).
Conventionally, I would try to solve this by using a timer set to run freely with a relatively short period, and trigger DMA transfers upon update (overrun); I would use the Status signal from the peripheral connected to TIMx_CH1 pin and into Slave-mode controller of TIM used in Gated mode. The timer's period would need to be longer than the longest DMA transfer latency to avoid spurious transfer, this limiting the potential throughput.
Maybe this is a case to use DMAMUX in anything than trivial mode, but I don't know it and there don't appear to be many users who do use it (this is one of the few related threads), so there's no body of knowledge out there.
JW