This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use the PORT event

HI ,all ! I have a question about PORT event function.

as the 4 channels of GPIOTE (channel0 to channel3 ) have been used for other usage.

i need to use a general IO to detect the falling edge signal, the signal is a 50Hz square wave.

How should i do ~~

Parents
  • Quax64, thank you very much for your reply

    I use the function you suggested " nrf_gpio_cfg_sense_input ", but the GPIO PORT event function still can't work normally, The program code is as follows:

    void ApplyIO_Init(){
    nrf_gpio_cfg_sense_input(PIN_ZERO_INT, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
    nrf_gpio_cfg_sense_input(PIN_SPEED,    NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
    
    NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Enabled << GPIOTE_INTENSET_PORT_Pos;
    
    //---------------------------------------------------------------------------------
    nrf_gpio_cfg_output(PIN_FAN);
    nrf_gpio_cfg_output(PIN_ION);
    nrf_gpio_cfg_output(PIN_BUZ);
    
    nrf_gpio_cfg_output(PIN_NTC_EN);
    nrf_gpio_cfg_output(PIN_LED1);
    nrf_gpio_cfg_output(PIN_LED2);
    nrf_gpio_cfg_output(PIN_LED3);
    
    //---------------------------------------------------------------------------------
    nrf_gpio_cfg_input(KEYB_D, NRF_GPIO_PIN_NOPULL);
    nrf_gpio_cfg_input(PIN_NTC_AD, NRF_GPIO_PIN_NOPULL);
    

    }

    void GPIOTE_IRQHandler(void){
    u32 pin;
    if(NRF_GPIOTE->EVENTS_PORT){
    	NRF_GPIOTE->EVENTS_PORT = 0;
    	//---------------------------------
    //	pin = nrf_gpio_pin_read(PIN_SPEED);
    	PortISR();
    }
    

    }

    However, when 50Hz square-wave signal to the actual IO (name is "SPEED") , GPIOTE PORT event is not trigger

    Where is the problem?

  • Did you enable the interrupt in main()?

    NVIC_EnableIRQ(GPIOTE_IRQn);
    
Reply Children
No Data
Related