Skip to main content

DA1469x USB with button interrupt

DA1469x

5 months ago

Posted by AdamShier 35 points 6 replies
0 upvotes

Hi,

I'm using the SDT example, and have a problem with the button interrupt when the usb is plugged in. The code has been modified so it still runs as normal when the usb is plugged in.

However, when the usb is plugged into a computer for a few minutes, the button interrupt stops occurring. Everything else in the code is running as usual. The button is configured as a wakeup interrupt as usual in the SDT code.   

This only occurs when we have

#define dg_configUSE_USB_ENUMERATION (1)

If that is disabled (ie if we only use the usb for charging, not for SUOUSB or RETARGET) then this no longer occurs. It also only occurs when the usb is plugged into a computer, not when it is plugged into an outlet directly, so it seems to a problem related to the power/usb states. 

Thanks.

5 months ago

PM_Dialog

Hi Adam,

Thanks for your question. Let me check this and I'll get back to you.

Regards, PM_Dialog

4 months ago

PM_Dialog

Hi AdamShier,

Apologies for the delay. So, are you using the KEY1 (P0_6) as a wake-up source and the wake-up controller is configured with that pin? Is my understanding correct?

What is the state of the pin when the USB is plugged in? Keep in mind that when the VBUS(USB) is plugged in, the system is not going to sleep and remains active all the time.

Thanks, PM_Dialog

4 months ago

AdamShier 35 points

The button is P1_4, I believe that is the same as the SDT example. It is configured as the wakeup source for the wake up controller using the wkup_init calling 

        hw_wkup_init(NULL);
        hw_wkup_set_debounce_time(63);
        hw_wkup_register_key_interrupt(button_interrupt_cb, 1);

        hw_wkup_configure_pin(HW_GPIO_PORT_1, HW_GPIO_PIN_4, 1, HW_WKUP_PIN_STATE_LOW);
        hw_wkup_enable_irq();
 

Which again is all the same from the SDT example.The button is not pressed when the usb is plugged in.

What's interesting is that the button does still work for the first few minutes, then stops working, so something seems to change with the controller or power state. 

4 months ago

PM_Dialog

Hi AdamShier,

Since that the USB is attached to your PC, keep in mind that when the VBUS(USB) is plugged the DA1469x is not going to sleep and remains active all time. Additionally, when the system is being changed, it will not go to sleep as soon as the USB is unplugged. Probably this might be the reason when wake-up pins is not working when the USB is plugged I, as the chips is already in active mode.

Thanks, PM_Dialog

4 months ago

AdamShier 35 points

I understand what you are saying, but if that was the case, I don't understand why the behavior would be different depending on if the USB is plugged into my computer or plugged into an outlet. Both scenarios do call sys_usb_process_attach, which sets the chip to active mode. 

If the USB is plugged into my computer, the button will stop working after a few minutes. If the issue was the interrupt not working because the device is not going to sleep, I would expect it to stop working right away. 

If the USB is plugged into an outlet, the button will continue to work forever, which tells me the interrupt does still work when the device is always awake. 

The one thing that is different between it being plugged into an outlet vs a computer is the usb_cdc_task (usb_flash_task) is running when the USB is plugged into my computer, whereas it is not when the USB is plugged into an outlet. 

3 months ago

PM_Dialog

Hi AdamShier,

Apologies foir my late response. In the initial post you mentioned that the code is modified so it still runs as normal when the usb is plugged in. Can you please share the modifications you have done, so that we can check ?

Thanks, PM_Dialog