Author Topic: 8051 interrupt in interrupt  (Read 2474 times)

0 Members and 1 Guest are viewing this topic.

Offline blueskullTopic starter

  • Supporter
  • ****
  • !
  • Posts: 367
  • Country: cn
  • BA7LKP
8051 interrupt in interrupt
« on: October 15, 2020, 09:34:04 am »
Quick question: during an ISR is being executed (from interrupt to RETI), can THE SAME interrupt be raised and served and interrupting the current ISR?

I ask this because I know there is this interrupt priority system in 8051, where higher level interrupts can interrupt a lower level ISR, and another interrupt of the same level or lower level interrupts cannot. But there's no clear way stating whether the same interrupt can interrupt its own ISR.

I observed this on CH552, and I'd like to know if this is normal in 8051, or should I call WCH and report a silicon bug.
 

Online Jeroen3

  • Super Contributor
  • ***
  • Posts: 4613
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: 8051 interrupt in interrupt
« Reply #1 on: October 15, 2020, 09:42:28 am »
Only if you change the priority inside said interrupt I suspect.
There are two interrupt levels. Default all interrupts are the same. Only higher interrupt priority can nest.
 

Offline Wilksey

  • Super Contributor
  • ***
  • Posts: 1329
Re: 8051 interrupt in interrupt
« Reply #2 on: October 15, 2020, 10:43:58 am »
I would suspect it depends on when you clear the interrupt but you could get into a sticky mess if you do not use priorities.
 

Online Jeroen3

  • Super Contributor
  • ***
  • Posts: 4613
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: 8051 interrupt in interrupt
« Reply #3 on: October 15, 2020, 11:24:36 am »
I would suspect it depends on when you clear the interrupt but you could get into a sticky mess if you do not use priorities.
Interrupt flags are latched until RETI.
 

Online PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3398
  • Country: au
Re: 8051 interrupt in interrupt
« Reply #4 on: October 16, 2020, 02:08:15 am »
I observed this on CH552, and I'd like to know if this is normal in 8051, or should I call WCH and report a silicon bug.
What exactly did you observe ?

Until a RETI occurs, the same interrupt should not be possible to re-enter.

Usually, that RETI is at the end of the interrupt, but in very rare and special cases, with extreme care when using assembler, you can call an early RETI, which resets the interrupt state engine, but continues one longer/rare fork of the interrupt code. 
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1559
  • Country: us
  • Very dangerous - may attack at any time
Re: 8051 interrupt in interrupt
« Reply #5 on: October 16, 2020, 03:22:16 am »
I am not touching the USB interrupt enable in the ISR and everything works as expected. Debugging is with blocking bit-bang UART at 3 Mbps.
« Last Edit: October 16, 2020, 03:29:43 am by oPossum »
 
The following users thanked this post: blueskull


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->