ChibiOS 18.2 STM32H743-SerialDriver Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
dwawerek
Posts: 4
Joined: Tue Jan 29, 2019 10:23 am
Has thanked: 1 time
Been thanked: 1 time

ChibiOS 18.2 STM32H743-SerialDriver  Topic is solved

Postby dwawerek » Tue Jan 29, 2019 4:24 pm

Hi,
I changed the RT-STM32H743I-NUCLEO144 example project for STM32H7 in order to use more then one SerialPort, I decided to use UART7(SD7) and UART4(SD4). I made enabled them in halconf.h maped pin contected to UARTs

Code: Select all

 //UART4
  palSetPadMode(GPIOD, GPIOD_ZIO_D67, PAL_MODE_ALTERNATE(8));
  palSetPadMode(GPIOD, GPIOD_ZIO_D66, PAL_MODE_ALTERNATE(8));
  sdStart(&SD4, NULL);
  //UART7
  palSetPadMode(GPIOF, GPIOF_PIN6, PAL_MODE_ALTERNATE(7));
  palSetPadMode(GPIOF, GPIOF_ZIO_D62, PAL_MODE_ALTERNATE(7));
  sdStart(&SD7, NULL);

and send Strings through using sdWrite() function

Code: Select all

static THD_FUNCTION(Thread3, arg) {

  (void)arg;
  chRegSetThreadName("UART4andUART7");
  while (true) {
    sdWrite(&SD7, "UART7\n", 10);
    chThdSleepMilliseconds(80);
    sdWrite(&SD4, "UART4\n", 10);
    chThdSleepMilliseconds(70);
  }
}

I got strange output, becuase the Strings from one serialDriver shows paritly in second one output, givie for example: "UAUART7" in console. I know that the sizes of strings and declared in sdWrite are not the same, but shouldn't they work indepently or the data buffor is conected?

Morover after first launch there was an error in hal_serial_lld.h saying that STM32_UART4CLK and STM32_UART7CLK was undeclared but in hal_lld.h there was a similiar declarations STM32_USART4CLK STM32_USART7CLK and after chaning it the errors disapper, so I belivie is just a spelling mistake.

Regards
Damian

User avatar
alex31
Posts: 264
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 16 times
Been thanked: 30 times
Contact:

Re: ChibiOS 18.2 STM32H743-SerialDriver

Postby alex31 » Tue Jan 29, 2019 6:32 pm

Hi,

Code: Select all

  sdWrite(&SD4, "UART4\n", 10);
    chThdSleepMilliseconds(70);


There is error in your code, namely "out of bound buffer" error.

You have a constant string buffer of lenght 7 including null at the end of string, but you write 10 bytes

The length of your string is 6 including newline, you should use 6 instead of 10.

You can avoid this kind of error using sizeof :

Code: Select all

const char uart4Label[] = "UART4\n";
sdWrite(&SD4, uart4Label, sizeof(uart4Label)-1); // -1 because you don't want so send NULL terminator


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests