Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 1 month ago.
Why does 9600 baud work but not 300 on F401RE
Hi,
new guy here. I've been messing with the board for the whole day and i just can't get it to report to com at 300 baud. i need it for a university project and the baud must be at 300 ( to be compatible with other equipment).
Okay so: I set the APB prescaler to /8 so that i would be able to go to the low low 300, then i configure USART2 to asynchronus, for 300 baud, 8bits with parity then i leave parity to none ( i actually need odd) because if i do 9600 without parity - it works. if i do it with parity it doesn't. stop bits - 1 data direction - receive and trasmit. oversampling - 16
the code it needs to process is really primitive:
main part
uint8_t data[20]= "Hello World\n\r"; while (1) { HAL_UART_Transmit(&huart2, data, 20, 100); }
this is the code and the results when set to 300 ( tera is also configured for 300) :
i must be missing something basic, anyone have any idea? i've tried on both IAR and Keil.
Hello Tadas,
Long time ago Eric helped me on this issue. Try following code in main() then set your serial at that low baud rate. Mine was 1200 for a sensor.