Skip to main content

USB pin as gpio not working

2 months ago

USB pin as gpio not working

Posted byjagath5275 points 1 reply
0 upvotes

Hello

I am using Da1469 mcu.

Here i am trying to use 3 pin as gpio in this P1_5 is normal gpio which is working fine and i able to get toggle.

But in pin p0_14 and p0_15 which are usb pins if i configure as gpio i am not getting any toggle.

hw_sys_pd_com_enable();
hw_gpio_set_pin_function(HW_GPIO_PORT_1, HW_GPIO_PIN_5, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO);
hw_gpio_pad_latch_enable(HW_GPIO_PORT_1, HW_GPIO_PIN_5);

hw_gpio_set_pin_function(HW_GPIO_PORT_0, HW_GPIO_PIN_14, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO);
hw_gpio_pad_latch_enable(HW_GPIO_PORT_0, HW_GPIO_PIN_14);

hw_gpio_set_pin_function(HW_GPIO_PORT_0, HW_GPIO_PIN_15, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO);
hw_gpio_pad_latch_enable(HW_GPIO_PORT_0, HW_GPIO_PIN_15);

hw_sys_pd_com_disable();
while(1){

hw_gpio_set_active(HW_GPIO_PORT_1,HW_GPIO_PIN_5);
hw_clk_delay_usec(300000);
hw_gpio_set_inactive(HW_GPIO_PORT_1,HW_GPIO_PIN_5);
hw_clk_delay_usec(300000);

hw_gpio_set_active(HW_GPIO_PORT_0,HW_GPIO_PIN_15);
hw_clk_delay_usec(300000);
hw_gpio_set_inactive(HW_GPIO_PORT_0,HW_GPIO_PIN_15);
hw_clk_delay_usec(300000);

hw_gpio_set_active(HW_GPIO_PORT_0,HW_GPIO_PIN_14);
hw_clk_delay_usec(300000);
hw_gpio_set_inactive(HW_GPIO_PORT_0,HW_GPIO_PIN_14);
hw_clk_delay_usec(300000);
}

Thank you
jagath

2 months ago

PM_Dialog

Hi Jagath,

According toAN-B-066: Hardware Design Guidelines, section 5.3 Digital I/O Pins , page 18 :

“P0_14 and P0_15 (USB pins): when these are to be used in GPIO mode, USBPAD_REG[USBPAD_EN] must be set. These GPIOs can be supplied solely by the V30 rail. Allowed output levels are the V30 voltage and 0 V, 1.8 V output is not possible. If the 1.8 V rail would be selected as the supply for P0_14 and P0_15, a leakage current of 150 µA is to be expected. Moreover, these two GPIOs should not be used in sleep mode because the USBPAD_REG belongs to the system power domain and is powered off in all sleep modes. It means that these pins do not support state retention during power down. “

So, P0_14 and P0_15 are USB pins and these pins can only be used with 3V power, the V30 rail. Not with the 1.8V (V18P) rail. The available levels at these pins are only 0V and 3V. To use them as GPIOs, the USBPAD_REG[USBPAD_EN] must be set before configuring them.

val = 0;

val = GPREG->USBPAD_REG;

REG_SET_FIELD(GPREG, USBPAD_REG, USBPAD_EN, val, 1);

GPREG->USBPAD_REG = val;

Thanks, PM_Dialog