Hello,
I created a code that switches the PWM duty every 562us or 1.69ms. The implementation uses the pwm_set_dt() function to switch the duty and waits using the k_busy_wait() function until the next pwm_set_dt() function. When I implemented this in an empty application, it worked correctly as intended.
However, Matter applications created from Matter: Template are exhibiting strange behavior. Specifically, the PWM output is controlled according to the ClusterId and AttributeId received by the MatterPostAttributeCallback() function, but the wait time in the k_busy_wait() function during PWM control is extended.
When I checked the PWM waveform with an oscilloscope, it was as shown in the graph. The correct time is 562us for the short wait and 1.69ms for the long wait, but as shown in red, there is a wait that extends for several tens of microseconds. There is no regularity to this extended wait time, and it appears to occur randomly.
Why does this phenomenon occur?
- Development PC
- OS: Windows 10
- SDK: nRF Connect SDK 2.5.0
- ZAP tool: v2024.01.20
- Microcontroller
- nRF52840