Hardware
- SoC: nRF52840
- Board: Custom (Nice Nano compatible)
- Application: Stepper motor control via TMC2209 drivers
Software Versions
- Working: Zephyr 4.1.0
- Broken: Zephyr 4.2.1
Configuration
PWM Setup:
- 2x PWM peripherals (PWM1, PWM2) driving stepper motor STEP pins
- Clock: 1MHz, Counter top: 10, Grouped mode
- 2ms playback buffers (200 cycles each) using dual sequence DMA
- Continuous loop with NRFX_PWM_FLAG_LOOP
- Buffer generation: ~200µs per buffer
- No buffer drops (buffers_dropped = 0)
UART Setup:
- UARTE0 for command/response protocol
- 1 Mbps, async API
- Position polling at 17 Hz (85 total UART events/sec)
Interrupt Priorities:
- PWM1/PWM2: Priority 0
- UART: Priority 1
Problem Description
Expected Behavior: Smooth motor rotation regardless of UART activity (works on Zephyr 4.1.0)
Actual Behavior (Zephyr 4.2.1):
- Motor exhibits jerky motion with periodic brief stops when UART traffic is present
- Motion is smooth when UART is idle (no Go software polling)
- Motion is smooth when running shell commands manually without UART protocol traffic
Diagnostics Performed
1. PWM interrupts fire every 2ms as expected, no latency detected
2. Buffer generation completes well within the 2ms window (~200µs)
3. Moved UART processing from ISR to dedicated thread - no effect
4. Set PWM interrupts to higher priority than UART - no effect
5. Problem occurs even with minimal UART activity (just position reads at 17Hz)
Questions
1. What changed between these versions that could cause PWM output issues when UART DMA is active?
2. Are there known interactions between PWM DMA and UART DMA on nRF52840 in recent releases?
3. Any recommended diagnostics or workarounds to try?