I need to use UART module of STM32F4 discovery kit. I have been going through the documentations but am unable to get the UART module running.
Here is the configuration instance. For simplicity, i have disabled all the callbacks.
Code: Select all
static UARTConfig uartcfg = {
NULL, /* End of Transmission buffer callback */
NULL, /* Physical end of transmission callback */
NULL, /* Receive buffer filled callback */
NULL, /* Char received while out of the UART_RECEIVE state */
NULL, /* Receive error callback */
9600, /* Baudrate */
0, /* cr1 register values */
0, /* cr2 register values */
0 /* cr3 register values */
};
Setting TX and RX pins mode:
Code: Select all
/* PD5 == USART2 TX PIN ; PD == USART2 RX PIN */
palSetPadMode(GPIOD, 5 , PAL_MODE_ALTERNATE(7));
palSetPadMode(GPIOD, 6 , PAL_MODE_ALTERNATE(7));
Code: Select all
/* UART 2 Initialization and stuff */
uartStart(&UARTD2, &uartcfg);
Continuously transmit a string with 500mSec breaks.
Code: Select all
while(1)
{
uartStartSend(&UARTD2,13,"Started\n");
chThdSleepMilliseconds(500);
}
Can someone please point out the mistake(s) I am making.
The device is working. There is an led that keeps blinking, indicating that the program is executing fine.