Hello
I have reproduced the probem. It is a bug in Processor Expert, initialization of baud rate registers must be in Init() or in Enable() (for more enabled speed modes) methods. The error will be fixed in next CodeWarrior release.
For now, please use one of the following workarounds:
a) Without using SelectBaudRate() method:
1. Set “Enabled in init. Code”property to “yes”.
2. Copy lines with values for baud rate registers (PDD macros) from AS_Init() method and place it behind AS_Init(UserDataPtr); method call.
3. Set “Enabled in init. Code” property to “no
Code example:
#include "UART_PDD.h"
…
DeviceDataPtr = AS_Init(UserDataPtr);
UART_PDD_SetBaudRateFineAdjust(UARTn_BASE_PTR, 12U); // Set baud rate fine adjust, where “n” is number of serial device (0..n)
UART_PDD_SetBaudRate(UARTn_BASE_PTR, 11U); // Set the baud rate register, where “n” is number of serial device(0..n)
…
(void) AS_Enable(DeviceDataPtr); // Enable serial device, now is possible use serial port for Rx/Tx with right baud rate.
…
b) With using SelectBaudRate() method:
It is possible to initialize baud rate register throught SelectBaudRate() method anytime. This method is enabled, if user specifies list of baud rate value in timing dialog in component inspector.
1. Open timing dialog for the "Baud rate" property
2. Select "list of values" mode
3. Enter at least two different values (init value would be your needed value)
4. Please SelectBaudRate() using initial value (valued with index 0) after the AS_Init call.
Code example:
…
DeviceDataPtr = AS_Init(UserDataPtr);
(void)AS1_SelectBaudRate(DeviceDataPtr, 0U); // initialize settings of baud rate register, baud rate list index 0
…
(void) AS_Enable(DeviceDataPtr); // Enable serial device, now is possible use serial port for Rx/Tx with right baud rate.
…
Best regards
Jiri Rezler
Processor Expert Support Team