ConfigTools issue: Watchdog configuration for LPC54113

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ConfigTools issue: Watchdog configuration for LPC54113

Jump to solution
1,511 Views
eduardocarletti
Contributor III

Hello everyone,

I am developing a project using the LCP54113 MCU wich requires watchdog.

I used the ConfigTools to facilitate the configuration, but there seems to be a problem. The code generated does not sets the frequency for the WWDT. The workaround I found was to manually set, by doing:

#define WDT_CLK_FREQ CLOCK_GetFreq(kCLOCK_WdtOsc)

WWDT_1_config.clockFreq_Hz = WDT_CLK_FREQ;

Of couse, this requires me to change the declaration of "WWDT_1_config" both on peripherals.c and peripherals.h file, removing the "const" declaration. This is pretty annoying, as long I have to do this every time there is any change on the chip configurations generated by ConfigTools. If i don't do this, the processor stalls on initialization, once "WWDT_1_config.clockFreq_Hz = 0".

Is there any known bugs related to this? Could be there any mistake from me?

The WWDT component configurations are:

pastedImage_1.png

The code generated for WWDT is:

/***********************************************************************************************************************
* WWDT_1 initialization code
**********************************************************************************************************************/
/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
instance:
- name: 'WWDT_1'
- type: 'wwdt'
- mode: 'reset_mode'
- custom_name_enabled: 'true'
- type_id: 'wwdt_2cb925533f814de0a276eb97fc166b0f'
- functional_group: 'BOARD_InitPeripherals'
- peripheral: 'WWDT'
- config_sets:
- general:
- wwdt_config:
- clockSource: 'FunctionClock'
- clockSourceFreq: 'BOARD_BootClockHSRUN'
- enableWwdt: 'true'
- enableWatchdogProtect: 'false'
- enableLockOscillator: 'false'
- timeoutValue_input: '0xFFFFFF'
- windowEnable: 'false'
- warningValue_input: '512'
- interrupt:
- IRQn: 'WDT_BOD_IRQn'
- enable_priority: 'false'
- priority: '0'
- enable_custom_name: 'false'
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */
const wwdt_config_t WWDT_1_config = {
.enableWwdt = true,
.enableWatchdogReset = true,
.enableWatchdogProtect = false,
.enableLockOscillator = false,
.windowValue = WWDT_1_WINDOW,
.timeoutValue = WWDT_1_TIMEOUT,
.warningValue = WWDT_1_WARNING
};

void WWDT_1_init(void) {
/* WWDT_1 initiation */
WWDT_Init(WWDT_1_PERIPHERAL, &WWDT_1_config);
/* Enable interrupt WDT_BOD_IRQn request in the NVIC */
EnableIRQ(WWDT_1_IRQN);
}

Labels (1)
1 Solution
1,362 Views
Lukas_Heczko
NXP Employee
NXP Employee

Hi Eduardo,

Can you please also specify version of MCUXpresso SDK you are using?

From the snippet you included I see that you are using WWDT Peripherals tool component version 2.0.0. This component is aligned with WWDT SDK driver version 2.0.0 (present in SDK v2.4.x or earlier) which in fact does not use clockFreq_Hz in the wwdt_config_t structure. 

typedef struct _wwdt_config
{
  bool enableWwdt; /*!< Enables or disables WWDT */
  bool enableWatchdogReset; /*!< true: Watchdog timeout will cause a chip reset
  false: Watchdog timeout will not cause a chip reset */
  bool enableWatchdogProtect; /*!< true: Enable watchdog protect i.e timeout value can only be
  changed after counter is below warning & window values
  false: Disable watchdog protect; timeout value can be changed
  at any time */
  bool enableLockOscillator; /*!< true: Disabling or powering down the watchdog oscillator is prevented
  Once set, this bit can only be cleared by a reset
  false: Do not lock oscillator */
  uint32_t windowValue; /*!< Window value, set this to 0xFFFFFF if windowing is not in effect */
  uint32_t timeoutValue; /*!< Timeout value */
  uint32_t warningValue; /*!< Watchdog time counter value that will generate a
  warning interrupt. Set this to 0 for no warning */
} wwdt_config_t;

The clockFreq_Hz was introduced into wwdt_config_t in WWDT driver from version 2.1.0 (SDK v2.5.x and later).

So I guess you are combining the WWDT component with incorrect SDK version. You can pick the proper version of WWDT component in the component selector when adding component to the project (be aware that you first need to remove the previous version from the project):

pastedImage_2.png

Hope this will help you,

Lukas 

View solution in original post

4 Replies
1,363 Views
Lukas_Heczko
NXP Employee
NXP Employee

Hi Eduardo,

Can you please also specify version of MCUXpresso SDK you are using?

From the snippet you included I see that you are using WWDT Peripherals tool component version 2.0.0. This component is aligned with WWDT SDK driver version 2.0.0 (present in SDK v2.4.x or earlier) which in fact does not use clockFreq_Hz in the wwdt_config_t structure. 

typedef struct _wwdt_config
{
  bool enableWwdt; /*!< Enables or disables WWDT */
  bool enableWatchdogReset; /*!< true: Watchdog timeout will cause a chip reset
  false: Watchdog timeout will not cause a chip reset */
  bool enableWatchdogProtect; /*!< true: Enable watchdog protect i.e timeout value can only be
  changed after counter is below warning & window values
  false: Disable watchdog protect; timeout value can be changed
  at any time */
  bool enableLockOscillator; /*!< true: Disabling or powering down the watchdog oscillator is prevented
  Once set, this bit can only be cleared by a reset
  false: Do not lock oscillator */
  uint32_t windowValue; /*!< Window value, set this to 0xFFFFFF if windowing is not in effect */
  uint32_t timeoutValue; /*!< Timeout value */
  uint32_t warningValue; /*!< Watchdog time counter value that will generate a
  warning interrupt. Set this to 0 for no warning */
} wwdt_config_t;

The clockFreq_Hz was introduced into wwdt_config_t in WWDT driver from version 2.1.0 (SDK v2.5.x and later).

So I guess you are combining the WWDT component with incorrect SDK version. You can pick the proper version of WWDT component in the component selector when adding component to the project (be aware that you first need to remove the previous version from the project):

pastedImage_2.png

Hope this will help you,

Lukas 

1,362 Views
eduardocarletti
Contributor III

Hi Lukas. That was exactly my mistake. My SDK was updated, but I did choose the older version of the component. Its working now!

Thank you!

0 Kudos
1,362 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Eduardo Carletti 

What's your config tool version? Did you test it on the latest Rev 7.0?

Thanks

Jun Zhang

1,362 Views
eduardocarletti
Contributor III

Hi ZhangJennie, thanks for your reply. The problem was solved as suggested by Lukas Heczko.

0 Kudos