2018-11-02 02:18 AM
Dear all,
I am using STM8S103F2 in one of my design. I have two main missions in the code.
1- Convert analog signal into digital and do some action according to voltage level.
2- Catch an external interrupt in both falling and rising edges.
I realized microcontroller misses some of rising or falling edges even interrupt is enabled. Actually, it catches most of edges but it also misses. (ADC and EXTI are active.). Then I realized when EXT interrupt comes at the same time with ADC interrupt or when program is in the ADC ISR, EXTI is missed. (I added some debug features to the code. When ADC Interrupt comes one of outputs is set and when RETI from ADC ISR the output pin is cleared. Similarly, when EXTI is serviced, another pin is set and reset. I gave a signal from signal generator 500Hz and 10% duty cycle) I attached two screenshots from scope. Second graph is zoomed view of first graph. Yellow signal is taken from Port D pin 6 which is used for EXTI. Pink one is taken from one of output which is set and reset when ADC interrupt serviced and return from ADC ISR. Blue one is set and reset according to EXTI.
As far as I know from other microcontroller manufacturers that if two interrupts come at the same time, higher priority interrupt is serviced first then second will be serviced. I also read the user manual of STM8S. It explains concurrent and nested interrupt. My case is concurrent and it explains same an operation principle with other microcontrollers what I know. However practical result is not fit with theory. When I close ADC ISR in the code, all of rising and falling edge are driven EXT ISR without any missing edge.
Is there any one can explain how to solve this issue?
Thanks in advance
Regard
2018-11-04 02:34 AM
Is there anyone help me?
2018-11-11 11:06 PM
Hi All,
The mystery is clarified by ST Tech Support. It is kind of hardware bug and please check Errata Sheet of STM8S103F2.
I used Port D as EXTI source and I also used ADC with interrupt. If I use PortA/B or C It wouldn't cause any problem but unlucky I used Port D.
Regards,