Skip to content

Conversation

@perkinsmg
Copy link
Contributor

@perkinsmg perkinsmg commented Nov 13, 2025

From Aleks Kupriianov:

  1. Before proposed changes, the implementation of WDT clock for 78002 put literally the enum value for clock to the corresponding register. This would be correct if the table in the page 384 of the user guide were correct.
  2. However, it turns out that the clock diagram in the pdf is correct, and the sets and numbers of clocks are the same for 78000 and 78002. Henceforth, it makes sense to re-use the solution for 78000 for our case.
  3. So we add 78002 to wdt_me17.c and use wdt_me17.c for 78002 as well (changing makefile). We already use it for 78000.
  4. The files wdt_me17.c and wdt_ai87.c are nearly identical, except two places. One place is the function MXC_WDT_SetClockSource, where the substitution of enum is done. The other place is the function MXC_WDT_Init, which checks if the clock was enabled. It should be disabled in all chips, since LPGCR_PCLKDIS has ones for all chips.

Description

Please include a summary of the changes and related issues. Please also include relevant motivation and context.

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.
  • (Optional) Link any related GitHub issues using a keyword
  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.

From Aleks Kupriianov.
1. Before proposed changes, the implementation of WDT clock for 78002 put literally the enum value for clock to the corresponding register. This would be correct if the table in the page 384 of the user guide were correct.
2. However, it turns out that the clock diagram in the pdf is correct, and the sets and numbers of clocks are the same for 78000 and 78002. Henceforth, it makes sense to re-use the solution for 78000 for our case.
3. So we add 78002 to wdt_me17.c and use wdt_me17.c for 78002 as well (changing makefile). We already use it for 78000.
4. The files wdt_me17.c and wdt_ai87.c are nearly identical, except two places. One place is the function MXC_WDT_SetClockSource, where the substitution of enum is done. The other place is the function MXC_WDT_Init, which checks if the clock was enabled. It should be disabled in all chips, since LPGCR_PCLKDIS has ones for all chips.

Signed-off-by: Michael Perkins <[email protected]>
@github-actions github-actions bot added MAX32655 Related to the MAX32655 (ME17) MAX78000 Related to the MAX78000 (AI85) MAX78002 Related to the MAX78002 (AI87) labels Nov 13, 2025
Comment on lines 134 to 135
{ MXC_WDT_PCLK, MXC_WDT_IBRO_CLK, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
{ MXC_WDT_IBRO_CLK, MXC_WDT_INRO_CLK, MXC_WDT_ERTCO_CLK, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you conclude that these mappings are correct for MAX78002?

@ttmut
Copy link
Contributor

ttmut commented Nov 14, 2025

  1. The files wdt_me17.c and wdt_ai87.c are nearly identical, except two places. One place is the function MXC_WDT_SetClockSource, where the substitution of enum is done. The other place is the function MXC_WDT_Init, which checks if the clock was enabled. It should be disabled in all chips, since LPGCR_PCLKDIS has ones for all chips.

According to the user manual, the reset value of LPGCR_PCLKDIS is 0x0 for MAX78002, and possibly for other chips as well. So unless this information is inaccurate, the WDT1 clock is actually enabled on reset. I do not think re-enabling it will have any effect though.

@ttmut
Copy link
Contributor

ttmut commented Nov 14, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MAX32655 Related to the MAX32655 (ME17) MAX78000 Related to the MAX78000 (AI85) MAX78002 Related to the MAX78002 (AI87)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants