msdk icon indicating copy to clipboard operation
msdk copied to clipboard

fix(PeriphDrivers): MSDK-1287: Fix MAX32655 MXC_Delay on RISC-V shows different behavior when not compiling with -O0

Open dnguye14-adi opened this issue 8 months ago • 0 comments

Description

In the MSDK Dual Core Sync example for MAX32655, the LED was programed to turn on in 500ms and then turn off. Issue: when compiling with -O0, the LED stayed on for 500ms correctly. But, when compiling with -O1, -O2, -Os and -Og, the LED stayed on for longer (around 33% longer than the expected one). To reproduce, just compile the example changing the MXC_OPTIMIZE_CFLAGS accordingly.

Fix: Add a delay to prevent the CPU bothers PCCR too much, then the PCCR hardware can maintain the correct timing.

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.

dnguye14-adi avatar Apr 14 '25 07:04 dnguye14-adi