Page 1 of 1

STM32L4R5ZI-NUCLEO144 and serial driver

Posted: Thu Aug 08, 2019 10:32 am
by sntnjrg
Hi,

I have a STM32L4R5ZI-NUCLEO144 board. Printed on the board I can see that next to some pins are printed TX and RX. Those pins are associated with USART 3. If I use those pins, I can read through a serial device. The problem is when I want to use USART 2 (for example). In this case, I can't read correctly from the device.

CODE - USART 3:

Code: Select all

  static const SerialConfig c = {57600, 0, USART_CR2_STOP1_BITS, 0};
  sdObjectInit(&SD3);
  sdStart(&SD3, &c);
  palSetPadMode(
      GPIOD,
      8U,
      PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_HIGH | PAL_STM32_OTYPE_PUSHPULL);
  palSetPadMode(
      GPIOD,
      9U,
      PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_HIGH | PAL_STM32_OTYPE_PUSHPULL)


OUTPUT - USART 3:

Code: Select all

$C159.5P-0.1R-1.7T23.5Ax-0.002Ay-0.031Az1.042*3D
$C160.3P-0.1R-1.7T23.5Ax-0.002Ay-0.031Az1.043*30
$C159.2P-0.1R-1.7T23.5Ax-0.003Ay-0.031Az1.043*3A
$C160.5P-0.1R-1.7T23.5Ax-0.003Ay-0.031Az1.043*37
$C160.7P-0.1R-1.7T23.5Ax-0.003Ay-0.031Az1.043*35
$C158.9P-0.1R-1.7T23.4Ax-0.002Ay-0.031Az1.043*30


OUTPUT - USART 2 (using the pins and ports associated with USART2):

Code: Select all

..........y.............y............................y..y.y..........y..y.y....
.....................................y.......y.................y...............y


To display the information use the LPSD1.

Why does this happen? Is it a limitation of the board?

Cheers.

Re: STM32L4R5ZI-NUCLEO144 and serial driver

Posted: Thu Aug 08, 2019 10:38 am
by Giovanni
It is either a conflict on those pins on the board or a problem in GPIO alternate settings.

Giovanni

Re: STM32L4R5ZI-NUCLEO144 and serial driver

Posted: Thu Aug 08, 2019 2:33 pm
by sntnjrg
Thanks you, Giovanni. I had an error in the code.

I've been testing the different driver instances. When I went to test the driver associated with USART1, I noticed that the board offers the following ports:

USART_1_TX: PA9 - PB6 - PG9
USART_1_RX: PA10 - PB7 - PG10
ALTERNATE FUNCTION: 7

Reading the manual, I see that I only have the PB6 port. Does this mean that I cannot use the SD1 driver instance? Can I use another port?

Cheers.

Re: STM32L4R5ZI-NUCLEO144 and serial driver

Posted: Thu Aug 08, 2019 4:00 pm
by Giovanni
You can use any port for which USART1 is listed.

Just take care to not assign the same signal, for example USART1 RX, to multiple pins, this is a common error.

Giovanni