2014-02-27 05:44 AM
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-pull2014-02-27 06:32 AM
I am not experienced, but check if it is needed to disable UART ( not just turning its clock off ) to cancel its control over the connected pins
2014-02-27 07:15 AM
The problem is that I need the UART =) In my circuit PD4 is intended for driving ENABLE pin of RS485 chip.
2014-03-03 11:36 AM
It seems that's because of TIM2_CH1, which could be mapped to PD4. Investigation is in process =)
2014-03-11 03:59 AM
Solved. TIM2_CH1 output is mapped to PD4 by default. I had to remap this output to PC5 by setting AFR0 option bit.