I’m trying to read a buffer from bus system using stm32F4, on falling interrupt. The problem is I need to process the data in main loop, and I don’t need any latency, The falling interrupt, occurs at 500ns, and I don’t want to miss any data. So disabling enabling an interrupt wouldn’t be beneficial here.
I’m looking for a way to reduce latency, and not miss any interrupt.
Here is my approach:
In Main Loop:
while (1)
{
if(iowr_set)
{
iowr_set = 0;
for (int i = 0; i < BUFFER_SIZE; i++)
{
processData(aRxBuffer[i]);
}
}
}
Interrupt:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if (GPIO_Pin == GPIO_PIN_6) { // IORD
HAL_SRAM_Read_16b(&hsram1, (uint32_t *)(SRAM_BANK_ADDR + WRITE_READ_ADDR), aRxBuffer, BUFFER_SIZE);
iowr_set = 1;
}
}
Declarations:
#define BUFFER_SIZE ((uint32_t)0x0100)
#define WRITE_READ_ADDR ((uint32_t)0x0800)
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
SRAM_HandleTypeDef hsram1;
FMC_NORSRAM_TimingTypeDef SRAM_Timing;
/* Read/Write Buffers */
volatile uint16_t aRxBuffer[BUFFER_SIZE];