Author Topic: GPIO interrupts in CH582M MCU  (Read 537 times)

0 Members and 1 Guest are viewing this topic.

Offline tankistTopic starter

  • Newbie
  • Posts: 1
  • Country: pl
GPIO interrupts in CH582M MCU
« on: March 17, 2024, 08:55:54 pm »
I've got CH582M MCU and I need to use GPIO interrupts. But unfortunately I can't manage with it. Here is my code:

Code: [Select]
#define INT_PIN     GPIO_Pin_18

int main()
{
    SetSysClock(CLK_SOURCE_PLL_80MHz);
    // LED init
    GPIOB_ModeCfg(GPIO_Pin_4, GPIO_ModeOut_PP_20mA);
    GPIOB_SetBits(GPIO_Pin_4);
    // Input GPIO init
    GPIOB_ModeCfg(INT_PIN, GPIO_ModeIN_PU);
    GPIOB_ITModeCfg(INT_PIN, GPIO_ITMode_FallEdge);
    // Interrupt init
    PFIC_ClearPendingIRQ(GPIO_B_IRQn);
    PFIC_EnableIRQ(GPIO_B_IRQn);
    while(1);
}

// Interrupt handler
__INTERRUPT __HIGH_CODE void GPIOB_IRQHandler()
{
    GPIOB_ClearITFlagBit(INT_PIN);
}

Could anybody suggest what is wrong? I've never caught an interrupt. I can't find any GPIO interrupt example for that MCU.
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: GPIO interrupts in CH582M MCU
« Reply #1 on: March 24, 2024, 04:12:34 pm »
Follow the example from section #3 here:

https://www.cnblogs.com/risc5-ble/p/17915503.html

Post your updates.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf