r/ArduinoHelp • u/grrrzzzt • Sep 24 '26
can I change timer frequency with W5500 ethernet board (arduino nano)
Hello, so simple question; I'm using an arduino to control actuators/motors and learning to control it via ethernet. (using OSC and I'm pretty happy of having figured it out in an afternoon with limited programmation knowledge).
I've done this many times with usb serial and I usually change the frequency of the timers so the PWM frequency is higher than audio rate (and thus not audible; because this is a musical project).
trouble is the ethernet board (W5500) uses pins 10 through 13 and so 2 PWM pins that are sets via the 3 timers (this is an arduino nano but I could use a different one; like a mega if I need to)
so the question is will changing the timers screw with the ethernet transmission?
I usually do something like this (don't remember the frequency but I think it's above 20khz)
TCCR0B = (TCCR0B & 0xF8) | 0x01;
TCCR1B = (TCCR1B & 0xF8) | 0x01;
TCCR2B = (TCCR2B & 0xF8) | 0x01; reference says:
- D3 and D11: Controlled by Timer 2.
- D5 and D6: Controlled by Timer 0.
- D9 and D10: Controlled by Timer 1.
so timer 0 should be fine but 1 and 2 could cause trouble.
(I'm trying to figure out a way how to do this in general before attacking different instruments and particular cases so no idea how much outputs I'll need and of them how much I'll need to be PWM; just trying to cover all the bases).
1
u/nixiebunny Sep 24 '26
The W5500 uses those pins for SPI. They are not internally routed to the timers by the W5500 library. There should be no problem unless the W5500 driver claims use of a timer for other reasons.
0
u/[deleted] Sep 24 '26
Changing Timer1 or Timer2's PWM prescaler should not change the W5500's SPI clock. The practical pin conflict is that the Ethernet board uses D10-D13, so you can't also use D10 or D11 as PWM outputs. D9 (Timer1) and D3 (Timer2) may still be options if your wiring leaves them free.
I'd avoid changing Timer0: Arduino's millis(), micros(), and delay() depend on its timing, so changing its prescaler can break software timing. Try one available PWM pin first, measure its frequency, and test Ethernet at the same time.