Post here first, or if you can't find a relevant section!
Problem solved,it was electrical noise (problably caused by the serial line).There was a 4cm thin wire betwen the capacitor and the pin,this wire was a enought good antenna to make the chip (an me too) crazy. I solved the problem adding a 3k resistor in series with the pin and as close as possible to the mcu,the pin capacitance and the resitor makes a low band pass filter that cancels the high frecuency noise.
Last edited by octavio on Tue Sep 19, 2017 12:10 am, edited 1 time in total.
So it means your 10uF capacitor did not work as the capacitor at higher frequencies. Most probably you have not used a 10uF ceramic multilayer smd one
Pukao Hats Cleaning Services Ltd.
It was a multilayer ceramic capacitor,but there was a 4cm wire betwen the capacitor and the port pin and another 4cm betwen the capacitor and the board gnd.It seems that this wire has a good radiofrecuency coupling with the serial line.