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

button_leds_init() function is clashing with mpu9250

Hi,

I'm working on nrf51822 and mpu9250 imu sensor.i'm facing a problem,my buttons function i.e buttons leds int and mpu9250 are not working together either one is working at a time,i'm unable to find the problem.please help me..

thanks in advance.

  • Hi Martin,sorry for the late reply below is code i'm using to initiate the GPIOTE for MPU

                ret_code_t err_code;
    	err_code = nrf_drv_gpiote_is_init();
    	APP_ERROR_CHECK(err_code);
    	nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false); 
    	config.pull = NRF_GPIO_PIN_PULLUP;
    	err_code =	nrf_drv_gpiote_in_init(int_param->pin, &config, int_param->cb);	
    	APP_ERROR_CHECK(err_code);
    	nrf_drv_gpiote_in_event_enable(int_param->pin, true);
    

    please check it and let me know if any mistakes in the above lines .... Many thanks for your cooperation.

  • In your code nrf_drv_gpiote_is_init() will return an error if the GPIOTE is already initialized and your application will hang or reset in APP_ERROR_CHECK(). If you do it like this:

    uint32_t err_code;
    if(!nrf_drv_gpiote_is_init())
    {
        err_code = nrf_drv_gpiote_init();
    }
    

    as is suggested here you will simply skip the initialization if it is already done before.

  • Hi Martin, The changes that you suggested those are working for me. thanks for your support.

Related