Page 1 of 1

Using PA9/10 for UARTD1

Posted: Tue Jan 28, 2014 12:56 pm
by Th3Link
Hi,
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);
  }
}

Re: Using PA9/10 for UARTD1

Posted: Tue Jan 28, 2014 1:31 pm
by Giovanni
Hi,

It is because PA9 and P10 are already wired on the Discovery, see the schematic.

Giovanni

Re: Using PA9/10 for UARTD1

Posted: Tue Jan 28, 2014 2:07 pm
by Th3Link
Oh, haven't seen this. I've taken a look to the STM32F4DISCOVERY USB_OTG_FS Schematic (Sheet 5).
PA9 is the VBUS_FS, I understand it as supply for the EMIF02-USB03F2. But when PC0 is high, the supply is disabled. If I measure PC0 it is high. When UART TX is inactive PA9 is high, thats why the led flashs, right?
I think the problem is at R59 which is 0 Ohm. Do you think, it is wise to remove R59 or replace is with more resistance?

Re: Using PA9/10 for UARTD1

Posted: Tue Jan 28, 2014 2:15 pm
by Giovanni
You should simply use another UART, there are 6 of them.

Giovanni

Re: Using PA9/10 for UARTD1

Posted: Tue Jan 28, 2014 2:30 pm
by Th3Link
Yes, it do ;) the problem is just that it is already on a board. But PC10/11 seems to close enought for some beautiful cuts and bridges ;)
Thank you