2019-11-29 02:58 AM
Hi,
I am having following problem. I am reading all the GPIO pins of portB when I receive an interrupt. The interrupt rate is 625KHz and I am storing this data for 20ms.
The problem is I have data losses every 1ms. I think this happens because of the SysTick interrupt.
My code is really simple. I only activate one GPIO pin for interrupts and the whole PORTB as an Input. I am not enabling the other perpiherals.
Does anyone have an idea how can I solve this problem? I need to store data without data losses.
Kind regards
Ozan
2019-11-29 06:50 AM
Try thinking about it for ~ 10 minutes and you'll get an idea.
-- pa
2019-11-29 07:36 AM
SysTick should be fairly brief, how much blocking is it doing?
You can *change* the priorities if they don't suit you. Be aware that SysTick / HAL_IncTick() needs to be functioning with high priority and preemption otherwise HAL_Delay() / HAL_GetTick() will have deadlocking issues in interrupt/callback context because the counter ceases to advance.
The CPU can saturate with interrupts if the loading gets too high.
Consider using TIM/DMA to sample GPIO at a paced sample rate.
2019-11-29 07:50 AM
It seems it is periodic and occurs every ms. It blocks the occurrence of GPIO interrupt for about 4us. I have already tried to change the priority of SysTick interrupt but this blocking still occurs. I couldn't figure what else can cause this.
2019-11-29 09:22 AM
Can increase latency as it pushes/pops context.
If GPIO interrupt is critical, it would need to preempt others.
Lowest latency/jitter would be achieved by DMA
2019-11-30 01:23 AM
I tried to use DMA but I think I am doing something wrong. I configured DMA generator with external request signal with CubeMX. However, I am doing something wrong I guess. I cannot observe any interrupt and data. Probably I am doing something wrong. I will be glad if you have some examples for this.
2019-12-07 10:36 AM
> ... I think I am doing something wrong. ... I am doing something wrong I guess. ... Probably I am doing something wrong. ...
Your "MCU" has memory problems!
2019-12-07 01:37 PM
Assuming you're using STM32WB and CubeMX, not really converging with anything I'm using. I don't have the resources/bandwidth to write sample code.
Perhaps review the HAL examples ST provides, and see if the logic/behaviour can be deduced from the Reference Manual.
For commercial designs engage with the FAE assigned to your account.