asrlora / asr_lora_6601

44 stars 19 forks source link

gpio_set_iomux() freeze #10

Open barbiani opened 6 months ago

barbiani commented 6 months ago

Hi,

We are trying to use GPIO7 as push-pull pin, but the cpu freezes while doing so.

Currently, firmware flash is done via serial port. No SWD in use.

Thank you for any tips.

gpio_t *gpiox = GPIOA;

gpio_init(gpiox, GPIO_PIN_7, GPIO_MODE_OUTPUT_PP_HIGH);
gpio_set_iomux(gpiox, GPIO_PIN_7, 0); // hangs here
gpio_write(gpiox, GPIO_PIN_7, GPIO_LEVEL_HIGH);
gpio_write(gpiox, GPIO_PIN_7, GPIO_LEVEL_LOW);
xunyueli commented 2 months ago

gpio06&gpio07 are configured as SWD by default and need to be disabled before they can be used for general IO

0x0fe commented 1 month ago

@xunyueli yeah, that is the point of the question, since it is not documented anyway would you mind to tell how to disable the SWD at runtime so that A6 and A7 can be used normally? Thanks.

xunyueli commented 3 weeks ago

@xunyueli yeah, that is the point of the question, since it is not documented anyway would you mind to tell how to disable the SWD at runtime so that A6 and A7 can be used normally? Thanks. Eg: rcc_enable_peripheral_clk(RCC_PERIPHERAL_GPIOA, true); gpio_set_iomux(GPIOA, GPIO_PIN_6, 0); gpio_set_iomux(GPIOA, GPIO_PIN_7, 0);