WeActStudio / ArduinoCore-AT32F4

31 stars 12 forks source link

EXINT does not work hanging up/crashing MCU #17

Closed ShaggyDog18 closed 2 years ago

ShaggyDog18 commented 2 years ago

I use External Interrupts at pins PA4, PA5, PA8 and PA15, falling edge. They all hanging up the MCU even with empty ISR callback function. Each of the above pins configured for EXINT is crashing MCU at the moment interrupt happens. I did not test other pins, however, I guess, the outcome would be the same since the issue is somewhere in NVIC config.

I attach EXINT by attachInterrupt function:

attachInterrupt( TIMING_PIN, Timing_ISR_1, FALLING );

Timing_ISR_1 is either very simple or even empty like:

void Timing_1_ISR(void){
   //timing_1_flag = true;
}

Please, check it up and fix ASAP. Thank you!

Test code: press onboard key to crash the MCU

#define KEY_PIN  PA0

void Timing_1_ISR(void);

void setup() {
  pinMode( LED_BUILTIN, OUTPUT );
  pinMode( KEY_PIN, INPUT ); 

  attachInterrupt( KEY_PIN, Timing_1_ISR, FALLING ); 
}

void loop() {
  static uint32_t blinkTimer = 0;
  uint32_t now = millis();

  if( now - blinkTimer >= 500 ) {
    blinkTimer = now;
    togglePin(LED_BUILTIN);
  }
}

void Timing_1_ISR(void){
 //togglePin(LED_BUILTIN);
}
WeActStudio commented 2 years ago

fix

ShaggyDog18 commented 2 years ago

Thank you! works now!