Error in code generated by PE

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Error in code generated by PE

跳至解决方案
2,060 次查看
lowks
Contributor III

Hi,

 

I noticed that when I am using the MQX3.7 BSP for K60 demo on the CW10.1 SE version, when I try to create a UART0 connection, I realised that when I unclick the option "enabled in init code", the following lines do not appear in the code:

 

  UART_PDD_SetBaudRateFineAdjust(UART0_BASE_PTR, 1u); /* Set baud rate fine adjust */
  UART_PDD_SetBaudRate(UART0_BASE_PTR, 26U); /* Set the baud rate register. */

And the baud rate is not set at all anywhere when the option is disabled for enabling in init code. Is this an error or the initialization is done some where else?

0 项奖励
1 解答
1,672 次查看
ProcessorExpert
Senior Contributor III

Hello,

 

The problem has been fixed within Update #2 V1.0.1 for CW MCU V10.1

To download the update please follow this link: Update #2 V1.0.1

best regards
Vojtech Filip
Processor Expert Support Team

在原帖中查看解决方案

0 项奖励
3 回复数
1,674 次查看
lowks
Contributor III

no one from freescale want to comment on this?

0 项奖励
1,674 次查看
ProcessorExpert
Senior Contributor III

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

1,673 次查看
ProcessorExpert
Senior Contributor III

Hello,

 

The problem has been fixed within Update #2 V1.0.1 for CW MCU V10.1

To download the update please follow this link: Update #2 V1.0.1

best regards
Vojtech Filip
Processor Expert Support Team

0 项奖励