STM32F429 read from PIN to DMA
Hello everyone, I have a board.STM32F429I DISCO1, I want to read, say, two bytes of parallel data from port A{15:0}, into the DMA buffer, every time a rising edge of some signal comes to the microcontroller from the outside.
How exactly can this be implemented ?
Can I , Configure DMA to transfer data from the GPIO port to a memory buffer ?
because I dont see that , in CubeMX may support direct GPIO to memory transfer for this use case ?
but can I manually handle this , ? for example
#define BUFFER_SIZE 1
uint16_t dma_buffer[BUFFER_SIZE];
void MX_DMA_Init(void) {
....................................................
DMA_HandleTypeDef hdma;
hdma.Instance = DMA1_Stream0;
hdma.Init.Channel = DMA_CHANNEL_0;
hdma.Init.Direction = DMA_PERIPH_TO_MEMORY; ????????????????????????
hdma.Init.PeriphInc = DMA_PINC_DISABLE;
hdma.Init.MemInc = DMA_MINC_ENABLE;
hdma.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
..................................................................
}
.................................................................................
HAL_DMA_Start(&hdma, (uint32_t)&GPIOA->IDR, (uint32_t)dma_buffer, BUFFER_SIZE);
.........................................................................................................
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if (GPIO_Pin == GPIO_PIN_0) { // Assuming PB0 is the EXTI line
Start_DMA(); }
}
