<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92338/gpiote-function-disabled</link><description>In my project, button ,charge state check and ACC sensor Interrupt pin, use GPIOTE; when The device is charging, keep this state one night,n ot unplugging the charger.when i d ouble click on the button, The motor will vibrate,that&amp;#39;s ok. but when i d ouble</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Oct 2022 13:15:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92338/gpiote-function-disabled" /><item><title>RE: GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/thread/392633?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2022 13:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d606a16-5389-4db4-b362-eb09d73cee9c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;From the code you posted I see you are enabling pin interrupts for a &amp;quot;CHARGE_PIN&amp;quot; and &amp;quot;CHARGE_DONE_PIN&amp;quot;. Is one of these connected to the button you mentioned?&lt;/p&gt;
&lt;p&gt;Regads,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/thread/390901?ContentTypeID=1</link><pubDate>Mon, 17 Oct 2022 07:08:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e56b5c00-b45e-47de-8363-dd76d1a076f4</guid><dc:creator>ethan-l</dc:creator><description>&lt;ul&gt;
&lt;li&gt;
&lt;p class="src grammarSection highlight" data-group="1-1"&gt;Yes, the motor vibrates when you double click；however,When I turn on log, I don&amp;#39;t get the problem.It&amp;#39;s an odd question,&lt;span&gt;So I would like to ask if there is any situation where the device can work normally, but only GPIOTE can not work .&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/thread/390055?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 13:52:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3df18ff-8580-4ff0-8aa2-c29869497d81</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have some additional questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;My understanding is that&amp;nbsp;motor_work_on() will be called when you double click the button? Where is it called from?&lt;/li&gt;
&lt;li&gt;Can you use a debugger and see where you program is stuck when you try to double click again and nothing works? Does the program go into&amp;nbsp;&lt;span&gt;motor_work_on() when you double click and &amp;quot;nothing works&amp;quot;?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Have you checked if there is any information from the logger module? What is the last printed log before it stops?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/thread/389969?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 10:18:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d2860cb-db63-4ee3-86a5-f2116552af18</guid><dc:creator>ethan-l</dc:creator><description>&lt;p&gt;that is my&amp;nbsp;&lt;span&gt;charging&amp;nbsp; check code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (!nrf_drv_gpiote_is_init()) {
        APP_ERROR_CHECK(nrf_drv_gpiote_init());
    }

    nrf_drv_gpiote_in_config_t charge_in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    charge_in_config.pull                       = NRF_GPIO_PIN_PULLUP;

    APP_ERROR_CHECK(nrf_drv_gpiote_in_init(CHARGE_PIN, &amp;amp;charge_in_config, charge_evt_handler));
    APP_ERROR_CHECK(nrf_drv_gpiote_in_init(CHARGE_DONE_PIN, &amp;amp;charge_in_config, charge_evt_handler));

    nrf_drv_gpiote_in_event_enable(CHARGE_PIN, true);
    nrf_drv_gpiote_in_event_enable(CHARGE_DONE_PIN, true);

    APP_ERROR_CHECK(app_timer_create(&amp;amp;m_charge_timer,APP_TIMER_MODE_SINGLE_SHOT,charge_cb));
    
    
    
    ////////////////
    
    static charge_cb(void *pcontex){

    
        if(!nrf_gpio_pin_read(CHARGE_PIN)){
            if(nrf_gpio_pin_read(CHARGE_DONE_PIN)){
                NRF_LOG_ERROR(&amp;quot;charging \n\r&amp;quot;);
                app_led_handle(LED_CHARGEING,LED_PIN_NUMBER_2);
            }
        }
        else{
            if(!nrf_gpio_pin_read(CHARGE_DONE_PIN)){
                NRF_LOG_ERROR(&amp;quot;charge over\n\r&amp;quot;);
                app_led_handle(LED_CHARGE_OVER,LED_PIN_NUMBER_3);
            }
            else{
                NRF_LOG_ERROR(&amp;quot;charge stop\n\r&amp;quot;);
                app_led_handle(LED_CHARGE_IDEL,LED_PIN_NUMBER_2);

            }
        }

        nrf_drv_gpiote_in_event_enable(CHARGE_PIN, true);
        nrf_drv_gpiote_in_event_enable(CHARGE_DONE_PIN, true);

        NRF_LOG_ERROR(&amp;quot;charge pin leval is %d\n\r&amp;quot;,nrf_gpio_pin_read(CHARGE_PIN));
        NRF_LOG_ERROR(&amp;quot;charge done pin leval is %d\n\r&amp;quot;,nrf_gpio_pin_read(CHARGE_DONE_PIN));

}


static void charge_evt_handler(nrf_drv_gpiote_pin_t irqPin, nrf_gpiote_polarity_t irq_action){
    
    NRF_LOG_ERROR(&amp;quot;trigger pin is %d, action is %d\n\r&amp;quot;,irqPin,irq_action);

    nrf_drv_gpiote_in_event_disable(CHARGE_PIN);
    nrf_drv_gpiote_in_event_disable(CHARGE_DONE_PIN);

    APP_ERROR_CHECK(app_timer_start(m_charge_timer,APP_TIMER_TICKS(50),NULL));

}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;that is my&amp;nbsp;motor vibration code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void motor_work_on(void)
{
    switch (m_motor_drv) {
        case MOTOR_DRV_LEVEL:
            nrf_gpio_cfg_output(m_motor_msg.motor_pin);
            NRF_LOG_INFO(&amp;quot;MOTOR WORK \n\r&amp;quot;);
            MOTOR_ON(m_motor_msg.motor_pin);
            APP_ERROR_CHECK(app_timer_start(motor_level_timer,
                                            APP_TIMER_TICKS(m_motor_msg.motor_time),
                                            NULL));
            break;

        case MOTOR_DRV_PWM: {
            static nrf_pwm_values_wave_form_t pwm_values[] = {
                { 625, 0, 0, 6250 },  
                { 11, 0, 0, 11 }
            };

            if (m_motor_state == MOTOR_STATE_ADV_TRIGGER) {
               
                static nrf_pwm_sequence_t pwm_seq = {
                    .values.p_wave_form = pwm_values,
                    .length             = NRF_PWM_VALUES_LENGTH(pwm_values),
                    .repeats            = 5, 
                    .end_delay          = 0
                };

                APP_ERROR_CHECK(nrf_drv_pwm_simple_playback(&amp;amp;m_pwm_motor,
                                                            &amp;amp;pwm_seq, 1, NRF_DRV_PWM_FLAG_STOP));
            } else {
                static nrf_pwm_sequence_t pwm_seq = {
                    .values.p_wave_form = pwm_values,
                    .length             = NRF_PWM_VALUES_LENGTH(pwm_values),
                    .repeats            = 9, 
                    .end_delay          = 0
                };

                APP_ERROR_CHECK(nrf_drv_pwm_simple_playback(&amp;amp;m_pwm_motor,
                                                            &amp;amp;pwm_seq, 1, NRF_DRV_PWM_FLAG_STOP));
            }
        }
        break;

        default:
            break;
    }
}

void mt_motor_drv_init(uint8_t pin, motor_drv_t motor_drv)
{
    m_motor_msg.motor_pin = pin;
    m_motor_drv = motor_drv;
    nrf_gpio_cfg_output(m_motor_msg.motor_pin);

    switch (m_motor_drv) {
        case MOTOR_DRV_LEVEL:
            APP_ERROR_CHECK(app_timer_create(&amp;amp;motor_level_timer,
                                            APP_TIMER_MODE_SINGLE_SHOT,
                                            motor_level_timeout_handller));
            break;

        case MOTOR_DRV_PWM: {
            nrf_drv_pwm_config_t const pwm_config = {
                .output_pins = {
                    m_motor_msg.motor_pin,
                    NRF_DRV_PWM_PIN_NOT_USED,
                    NRF_DRV_PWM_PIN_NOT_USED,
                    NRF_DRV_PWM_PIN_NOT_USED
                },
                .irq_priority = APP_IRQ_PRIORITY_LOW,
                .base_clock   = NRF_PWM_CLK_125kHz,
                .count_mode   = NRF_PWM_MODE_UP,
                .load_mode    = NRF_PWM_LOAD_WAVE_FORM,
                .step_mode    = NRF_PWM_STEP_AUTO
            };

            APP_ERROR_CHECK(nrf_drv_pwm_init(&amp;amp;m_pwm_motor, &amp;amp;pwm_config, motor_pwm_cb_handler));
        }
        break;

        default:
            break;
    }

    m_motor_state = MOTOR_STATE_IDLE;
    NRF_LOG_INFO(&amp;quot;[%04d] Motor init.\r\n&amp;quot;, __LINE__);
    APP_ERROR_CHECK(app_timer_create(&amp;amp;motor_polling_timer,
                                    APP_TIMER_MODE_SINGLE_SHOT,
                                    motor_polling_timeout_cb));
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;thank you,&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/thread/388365?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2022 13:16:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb563888-4bd3-4f3e-b2be-480e9332c4ac</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you show how you setup the GPIOTE for the charging and the vibration part? Preferably, can you share your code and elaborate a bit more on the charging and the vibration part?&lt;/p&gt;
&lt;p&gt;I can make this case private first if you prefer it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;thank you,&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/thread/388235?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2022 01:46:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15367982-ad50-4436-9193-31e979ca4a22</guid><dc:creator>ethan-l</dc:creator><description>&lt;p&gt;thans for your help,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; in my&amp;nbsp;&lt;span&gt;application,&amp;nbsp;&amp;nbsp;double click on the button can&amp;nbsp;trigger the motor vibration.on the second time the motor doesn&amp;#39;t vibrate means my button function disabled.&amp;nbsp;&lt;/span&gt;I have verified &lt;span&gt;&amp;nbsp;my button does&amp;#39;t work. t&lt;/span&gt;his only happens when I&amp;#39;m charging and&amp;nbsp;&lt;span&gt;n&lt;/span&gt;&lt;span&gt;ot unplugging the charger. becaue&amp;nbsp;in my&amp;nbsp;application, charge also use GPIOTE to indicate&amp;nbsp;charging,full charge state.in fact, t&lt;/span&gt;hese questions are all related to GPIOTE,and only GPIOTE had problems.&lt;span&gt;I don&amp;#39;t know why this happened.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE function disabled</title><link>https://devzone.nordicsemi.com/thread/388029?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 11:15:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19393fb4-58af-4ca9-83b3-919f23e44527</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]The motor will vibrate,that&amp;#39;s ok. but when i&amp;nbsp;&lt;span&gt;d&lt;/span&gt;&lt;span&gt;ouble click again, sonmething wrong happend,my device can normal&amp;nbsp;broadcast,but my button, and charge state check ... al&lt;/span&gt;l functions related to GPIOTE are disabled[/quote]
&lt;p&gt;You need to share more detailed information regarding your application. I&amp;#39;m not totally sure what clicking the button does, can you elaborate?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My understanding is that you expect the motor to vibrate once click the button, and that it works once but on the second time the motor doesn&amp;#39;t vibrate? Is my understanding correct?&amp;nbsp; Have you tried debugging your application and see if the program reacts when the button is pressed?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>