Can this pin:USBP/P2_2 control the LED as general gpio?

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
xuguodong
Offline
Last seen:1 month 1 week ago
Joined:2020-06-04 13:34
Can this pin:USBP/P2_2 control the LED as general gpio?

Hi Dialog,

I want to turn on/off the led. So connect USBP/P2_2 to red led.

We only have this pin available. Can this pin:USBP/P2_2 control the LED?

Thanks.

Device:
PM_Dialog
Offline
Last seen:2 days 9 hours ago
Staff
Joined:2018-02-08 11:03
Hi xuguodong,

Hi xuguodong,

According to DA14683 datasheet and section 32.5 SPECIAL I/O CONSIDERATIONS :

" To use P1_1 or P2_2 in GPIO mode, USBPAD_REG[USBPAD_EN] must be set. However, the allowed levels on this pins are 0V and the voltage on V33 rail. If 1.8V is selected as the pin supply, then a current of 150 uA is to be expected. Moreover, these pins should not be used in sleep modes because the USBPAD_REG will be powered off (belongs to the peripheral power domain). "

Both can be used with the 3.3V supply rail only, so both cannot be powered in sleep mode.

Additionally, when these pins are used as GPIOs make sure that USB logic is deactivated.

#define dg_configUSE_USB_ENUMERATION (0) #define dg_configUSE_USB (0)

Thanks, PM_Dialog

xuguodong
Offline
Last seen:1 month 1 week ago
Joined:2020-06-04 13:34
Hi Dialog,

Hi Dialog,

USBPAD_REG[USBPAD_EN] must be set.

Can you support the code?

Thanks.

PM_Dialog
Offline
Last seen:2 days 9 hours ago
Staff
Joined:2018-02-08 11:03
Hi xuguodong,

Hi xuguodong,

Yes, USBPAD_REG[USBPAD_EN] must be set. You could do it in your application code.

Thanks, PM_Dialog

xuguodong
Offline
Last seen:1 month 1 week ago
Joined:2020-06-04 13:34
USBPAD_REG[USBPAD_EN] must be

USBPAD_REG[USBPAD_EN] must be set.

can you give me the above example code.

PM_Dialog
Offline
Last seen:2 days 9 hours ago
Staff
Joined:2018-02-08 11:03
Hi xuguodong,

Hi xuguodong,

To use P1_1 or P2_2 in GPIO mode, USBPAD_REG[USBPAD_EN] must be set.

REG_SET_BIT(CRG_PER, USBPAD_REG, USBPAD_EN);

Additionally, when these pins are used as GPIOs make sure that USB logic is deactivated.

#define dg_configUSE_USB_ENUMERATION (0)

#define dg_configUSE_USB (0)

Then, you should configure them in the SW as normal GPIOs.

xuguodong
Offline
Last seen:1 month 1 week ago
Joined:2020-06-04 13:34
Hi Dialog,

Hi Dialog,

After applied the follow code, The battery charge detection function has failed.

#define dg_configUSE_USB_ENUMERATION (0)

#define dg_configUSE_USB (0)

PM_Dialog
Offline
Last seen:2 days 9 hours ago
Staff
Joined:2018-02-08 11:03
Hi xuguodong,

Hi xuguodong,

If the P1_1 or P2_2 in GPIO mode, then the USB logic is deactivated.

Thanks, PM_Dialog