1.26.4.11 DBGU_SerialSetup Function

C

/* Blocking, non-blocking and ring buffer mode */

bool DBGU_SerialSetup(DBGU_SERIAL_SETUP * serialSetup, uint32_t clkFrequency)

Summary

Sets up serial configurations for DBGU peripheral.

Description

This function provides run-time interface to configure the baud and parity of the serial connection. Calling this function when a serial communication is in progress can disrupt the communication. The caller should ensure that there is no serial communication in progress. In case of success, the function will update all parameters specified in the serialSetup parameter, even if some parameter may have not changed since a previous call to this function. In case of failure, all parameters stay unchanged.

Precondition

DBGU_Initialize must have been called for the associated DBGU instance.

Parameters

Param Description
serialSetup Pointer to serial configuration data structure
clkFrequency Input clock frequency to the Baud Rate Generator. If configured to zero, the PLIB takes the peripheral clock frequency from MHC

Returns

true - Serial configuration was successful

false - The specified serial configuration could not be supported. This, for example, could happen if the requested baud is not supported.

Example

DBGU_SERIAL_SETUP setup = {
    115200,
    DBGU_PARITY_ODD
};

DBGU_SerialSetup(&setup, 0);

Remarks

None