Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpio/uart pin use conflict on cozylife smartswitch (ln882h / ln-02) #1461

Open
notzed opened this issue Dec 12, 2024 · 0 comments
Open

gpio/uart pin use conflict on cozylife smartswitch (ln882h / ln-02) #1461

notzed opened this issue Dec 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@notzed
Copy link

notzed commented Dec 12, 2024

Describe the bug

The ln822h port initialises uart0 and uart1 at some point and seems to use them for logging and/or stdio.

uart0 tx/rx uses GPIO A2/A3 (pin 2/3)
uart1 tx/rx uses GPIO B9/B8 (pin 25/24)

While it doesn't seem to affect basic operation, pin 24 is used as a GPIO input for the one button on this device. It also prevents the 3 other pins being used for gpio in a hacked device.

Firmware:

Additional context

I couldn't work out how to disable any output to these ports. But one fix is to ensure the alternative function is disabled in the pin setup functions so the pin is in the expected state since hal_gpio_init() doesn't do it. This is already done for pwm setup.

src/hal/ln882h/hal_pins_ln882h.c:My_LN882_Basic_GPIO_Setup ->

static void My_LN882_Basic_GPIO_Setup(lnPinMapping_t *pin, int direction) {
	gpio_init_t_def gpio_init = {
		.dir = direction,
		.pin = pin->pin,
		.speed = GPIO_HIGH_SPEED
	};

	hal_gpio_pin_afio_en(pin->base, pin->pin, HAL_DISABLE);
	hal_gpio_init(pin->base, &gpio_init);
}
@openshwprojects openshwprojects added the bug Something isn't working label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants