2024-03-24 09:33 AM
Hello,
STM8S208RB microcontroller. Pins PA4 and PA5 do not work in push-pull mode. Why? I haven't tried it in other modes. It's not a microcontroller issue because I tested it on two different microcontrollers. Pins are shown in the datasheet (see figure bellow).
I tested the robotic functionality using this code:
main()
{
PA_DDR = 0b01111110;
PA_CR1 = 0b01111110;
PA_CR2 = 0b00000000;
PA_ODR = 0b00000000;
while (1)
{
delay_miles(2000);
PA_ODR = 0b01111110;
delay_miles(2000);
PA_ODR = 0b00000000;
}
}
Solved! Go to Solution.
2024-03-25 12:12 AM
The answer to why PA4 and PA5 did not work is in the UM2364 manual in section 6.8 USART communication
(see figure below).
2024-03-24 12:04 PM
The problem is only with PA4 and PA5?
Try with other pins.
PA4 and PA5 are UART1 RX and TX pins. If UART1 is enable it controls these pins.
2024-03-24 12:10 PM - edited 2024-03-24 12:12 PM
Works well with other pins. As far as I understand, after the reset the UART1 is turned off, but I didn’t turn it on in software. PA4 and PA5 are always logically 0, checked with an oscilloscope.
2024-03-24 12:42 PM
Maybe bootloader is active and it left UART1 enable. Check UART1 registers or disable UART1.
2024-03-24 01:01 PM
I checked it in the debugger and UART1 is turned off. I also need to say that I am using a NUCLEO-8S208RB board.
2024-03-25 12:12 AM
The answer to why PA4 and PA5 did not work is in the UM2364 manual in section 6.8 USART communication
(see figure below).