I want to make a device with a TFT screen and a speaker that uses the builtin tone() function. However, according to the documentation, using tone() interferes with PWM on pins 3 and 11. On the Arduino Uno, the MOSI pin is default on pin 11, and it seems like defining another pin for MOSI disables hardware SPI, which, according to the module page, slows down the device. As well, the examples are written for hardware SPI and the SD card is only available with hardware SPI. What should I do here? Is there a way to redefine the default MOSI pin without disabling hardware SPI?

  • It is no problem. The tone function uses timer2 which is the same timer when using pwm for pin 3 and 11. The tone function does not interfere with pin 3 and 11, it only uses timer2 for a software interrupt to create a tone on any pin. The tone function does not use the pwm capabilities of the microcontroller.
    – Jot
    Dec 4, 2018 at 23:42
  • short version : "interference with PWM", not with SPI
    – Juraj
    Dec 5, 2018 at 6:26

1 Answer 1


You are getting your wires crossed in your brain and imagining a problem where there is none.

Both PWM on pins 3 & 11, and tone(), use the Timer2 device. Only one of those can use Timer2 at a time, and they both want to use it in different ways, so there is a conflict between them.

Timer2 has nothing to do with SPI. So tone() has no effect on SPI, and nor does PWM have any effect on SPI (other than the fact that only one can come out of pin 11 at any time), since there is no internal resource conflict.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.