I'm working on a Project were an xbee module over UART is used. The Board is the STM32F407-Discovery. During development I used UARTD1 on PB6/7. Since this pins are used for CAN, I changed to PA9/10 but only rubbish came out.
I reduced toe problem to the UART example where I got the same result. When I use PB6/7 I get "0123456789ABCDEF" over an external FTDI USB chip. On PA9/10 I get "00 B0 FD FF FF FF 00 00" (Hex). I also observed that LD7 is flashing which is normally only on when I use the USB Serial interface. Any Ideas?
Thank you,
Code: Select all
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the UART driver 2, PA2(TX) and PA3(RX) are routed to USART2.
*/
uartStart(&UARTD1, &uart_cfg_1);
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
/*
* Normal main() thread activity, in this demo it does nothing.
*/
while (TRUE) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
/*
* Starts both a transmission and a receive operations, both will be
* handled entirely in background.
*/
uartStopReceive(&UARTD1);
uartStopSend(&UARTD1);
uartStartReceive(&UARTD1, 16, buffer);
uartStartSend(&UARTD1, 16, message);
}
chThdSleepMilliseconds(500);
}
}