2024-03-02 08:06 AM
Hi,
I do not grasp the STM8S103 interrupt priority philosophy. Each Io-port can be assigned to 1 out of 4 priority levels called level 0, 1, 2 and 3 page 68/467 of the RM0016 reference manual meaning highest number is handled first. I connect a slow square wave to ports D pin 4 (PD4) and to port A pin 1 (PA1). Each corresponding low going edge interrupt handler sends character ‘D’ or ‘A’ through a software uart to my serial monitor. So each few seconds I see ‘AD’ or ‘DA’ appear in my monitor depending on interrupt priority settings. Setting port A/D to level 0/1 shows ‘DA’, even so with 1/2 and 2/3, that's okay. But setting 0/3 and 3/0 shows ‘AD’. What does it mean on page 68 at level 3 = “software priority disabled”? Does it mean lowest priority? Why does setting 3/0 not send ‘DA’ as port A priority is disabled (level 3) and port D priority is set to level 0?
2024-03-04 10:48 AM
Does it mean lowest priority?
Level 3 = "software priority disabled" because it is the highest priority level. And you can't use level 0 (see RM0016 page 69).
Why does setting 3/0 not send ‘DA’ as port A priority is disabled (level 3) and port D priority is set to level 0?
Level 3 is the highest level, so have priority over other levels. Setting 3/0 is the same as 3/3 because 0 can't be used. In this case MCU uses hardware priority and PA1 have priority over PD4.
2024-03-10 08:02 AM
I understand it now.
Thanks!