Question
STM8S003F PD4 doesn't work as GPIO
Posted on February 27, 2014 at 14:44
Hi all!
I am using STM8S003F microcontroller with UART in async mode. I want to use UART1_CK pin as regular GPIO in push-pull mode. This pin is PD4. When peripherals are configured as below:PD_DDR_DDR4 = 1; // Pin PD4 (EN) is output
PD_CR1_C14 = 1; // Pin PD4 is set to P-P mode. PD_CR2_C24 = 1; // Pin PD4 can run up to 10 MHz.UART1_CR3_CKEN = 1;
and byte is transmitted via UART, I see clock meander appearing on PD4 on each byte transmission. Then I disable UART clock output by writing:UART1_CR3_CKEN = 0;
After that pin PD4 goes low, and writingPD_ODR_ODR4 = 1;
gives nothing. High logic level doesn't appear on PD4 pin. What's wrong with my code? What else should I check? #stm8s003f3 #pd4 #push-pull