Hi,
after enabling a 2nd clock source for my KL46Z CPU the lcd controller stopped showing anything.
After comparing the source codes with one and two clock sources, I found out that in method "SegLCD_Init(LDD_TUserData *UserDataPtr)" the line "LCD_PDD_EnableDevice(LCD_BASE_PTR,PDD_ENABLE);" disappeared.
I need to call the disappeared method by myself, although it's an internal PEx method.
Is this a bug?
Many thanks,
Rolf
Hello,
When you add second clock configuration into the CPU component the default state of the SegLCD_LDD component in this clock configuration is disabled, see the following screenshot of Component Inspector (use the Advanced view):
The source code of the SegLCD_LDD Init method is modified. The following code is generated:
SegLCD1_SetClockConfiguration(DeviceDataPrv, Cpu_GetClockConfiguration()); /* Set Initial according speed CPU mode */
(instead of LCD_PDD_EnableDevice(LCD_BASE_PTR,PDD_ENABLE); /* Enable device */)
The SegLCD1_SetClockConfiguration() method contains the following code that enables or disables the LCD device according to selected clock configuration of the CPU:
/*
** ===================================================================
** Method : SegLCD1_SetClockConfiguration (component SegLCD_LDD)
**
** Description :
** This method changes the clock configuration. During a clock
** configuration change the component changes it's setting
** immediately upon a request.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void SegLCD1_SetClockConfiguration(LDD_TDeviceData *DeviceDataPtr, LDD_TClockConfiguration ClockConfiguration)
{
SegLCD1_TDeviceData *DeviceDataPrv = (SegLCD1_TDeviceData *)DeviceDataPtr;
switch (ClockConfiguration) {
case CPU_CLOCK_CONFIG_0:
DeviceDataPrv->EnMode = TRUE; /* Set the flag "device enabled" in the actual speed CPU mode */
LCD_PDD_SetClkSource(LCD_BASE_PTR, LCD_PDD_ALTERNATE_CLK); /* Set CLK source */
LCD_PDD_SetAlternateClkDivider(LCD_BASE_PTR, 0x01U); /* Set value of LCD Alternate divider */
LCD_PDD_SetClkPrescaler(LCD_BASE_PTR, 0x04U); /* Set value of LCD clock prescaler */
break;
default:
DeviceDataPrv->EnMode = FALSE; /* Set the flag "device disabled" in the actual speed CPU mode */
break;
}
HWEnDi(DeviceDataPtr); /* Enable/disable device according to status flags */
}
When you want the SegLCD_LDD component (LCD device) to be enabled in all (both) clock configurations you must select the "This component enabled" value in the "CPU clock/configuration selection/Clock configuration 1" property.
Best Regards,
Marek Neuzil
Hello Marek,
If I'm enabling both clock configurations for the SegLCD_LDD component, the LCD device stays disabled until I add "LCD_PDD_EnableDevice(..);" as first command into main.c.
If I'm working with one clock configuration for the SegLCD_LDD component, the LCD device stays disabled, even if I manually switch to the active CPU clock.
In both configurations I checked "Enable in init. code" and "Auto initialization".
As said in my first posting, everythig is working fine if I'm using one CPU clock. But in the meantime I need 4 cpu clock settings with disabled LCD for the 4th cpu clock.
Many thanks for your help,
Rolf
Hello Rolf,
I have reproduced the issue and I have reported it to the Processor Expert development team. They will fix it.
Please, use the workaround you have described above in the meantime.
Best Regards,
Marek Neuzil
Hello Marek,
Many thanks for your help.
Cheers,
Rolf
Hi,
The same thing happens with I2C_LDD. The device and the interrupt won't be enabled if I'm using multiple clock sources.
Cheers,
Rolf