Test and example code suggestion.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Test and example code suggestion.

Postby rew » Wed Jun 03, 2020 11:59 am

In most of the examples the start of the serial port looks like this:

Code: Select all

sdStart(&SD1, NULL);

sometimes the comment says that this will result in 38400-8-n-1 configuration (but most often not). That's all fine and dandy, but the code is also meant to be an example you can start from and start to modify.

Code: Select all

/*
 * This is the configuration for the serial port. The current configuration here is also
 * the default, so instead of passing this structure passin "NULL" would also result in the same configuration.
 */
static SerialConfig ser_cfg = {
    38400,
    0,
    0,
    0,
};
...
sdStart(&SD1, &ser_cfg);


In the same vein I think there should be

Code: Select all

/* because we use the DISCOVERY board definition and that configures the default to be
 * correct in this case this is not necessary. But if you want to use it on a different UART/pin
 * this is how it is done.
 */
palSetLinemode  (...., STM_ALTERNATE ());

Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 20 guests