Fio v3 stymied by tone() function

I’ve had pretty decent luck getting my Fio v3 to do just about everything I’ve wanted now. However, if I try to run the tone() function on any of its PWM pins, it locks up and becomes very hard to get back under my control. It doesn’t matter if anything’s actually attached to the pin, just running the command does it.

Also, I’m trying to power an LED with pin 14 and that’s causing similar behavior. I can do it with pin 3, no prob, but pin 14 is crashy.

I’m really hoping there’s a way around the tone() problem.

Hi,

I have run into the same problem and found a solution. It seems there was a bug in the tone function for the Arduino Leonardo (which is similar to the Fio v3). A patch for the Arduino IDE was submitted last summer:

https://github.com/arduino/Arduino/pull/102

Now the Fio v3 core files are the same than for the Arduino Leonardo, except for a patch for the CPU frequency. This patch is now also part of the Arduino Leonardo core.

The solution is thus to copy the core files of a recent version of the Arduino IDE (that can be found in <path_to_arduino>/hardware/arduino/cores) to replace the ones from Fio v3 (hardware/Fiov3/cores/).

Hope that helps.

I will try it! Thank you.

Also, for pin 14, looking at the fio v3 schematics, you can observe that it is used for the on-board rx led.

http://dlnmh9ip6v2uc.cloudfront.net/dat … io-v30.pdf

If you want to be able to use pin 14, you need to deactivate its use by the USB serial. To do that, you need to change the file hardware/Fiov3/variants/pins_arduino.h. You can apply the following patch to this file:

< #define TX_RX_LED_INIT	DDRD |= (1<<5), DDRB |= (1<<0)
< #define TXLED1			PORTD |= (1<<5)
< #define TXLED0			PORTD &= ~(1<<5)
< #define RXLED1			PORTB |= (1<<0)
< #define RXLED0			PORTB &= ~(1<<0)
---
> // Rx/Tx leds are conflicting with other functionalities of the board.
> #define TX_RX_LED_INIT	;
> #define TXLED1			;
> #define TXLED0			;
> #define RXLED1			;
> #define RXLED0			;

Hi

I am using an Fio V3, 3.3v which has ATmega32U4 running at 8MHz. I have this tone problem and it seems like the solution that is suggested in the links which is also included in 1.0.5 IDE release has is not fixing the issue for a processor that is running at 8MHz. Am I right? How can I get around this?

Thanks