I found that my smartphone (android 4.2.2) is not able to generate square waveforms (i need it to use the audio output as serial line for data transfer). At beginning i supposed it was my application, but then i made many significant tests. These are latest tests. I hope you can find an explanation for the phenomenon.
I generated a wav file with a square waveform at 500Hz inside it. I play the wav file on a android phone and on a apple iphone. I recorded and analyzed the signal with my notebook (the audio cable connected to the notebook audio input).
Then i repeated the tests with the audio cable connected between a bluetooth transceiver device and the notebook audio input. And the smartphones connected via bluetooth (one at time) to the bluetooth transceiver device.
NOTE: the bluetooth transceiver device is a device that receives audio data via bluetooth and gives a audio output with a standard audio jack.
This is the signal generated by the iphone directly connected on the audio jack:
This is the signal generated by the bluetooth device receiving data from the iphone:
This is the signal generated by the android device directly connected with the audio jack:
This is the signal generated by the bluetooth device receiving data from the android smartphone:
Analisys:
-The bluetooth device introduces a cut to the bandwidth of the signal (it seems to me acceptable).
-The iphone has really good analog part (it outputs a very good square waveform)
-The android device has really bad analog part (even if it is perfect for music play)
-the data sent by the android phone to the bluetooth device is not correct, in fact the aquired signal is different than the one aquired with data coming from iphone.
I restored the smartphone to factory default but the problem was not solved. I also tried to install kitkat custom rom but the problem is still there. I also tried with a Nexus 5 (android 5) and samsung S4 mini (android 4.2.2 like mine) and they acts like the iphone.
I suspect that the problem has to do with DTS studio sound (i tried disabiling it and setting it in different ways without success). the DTS seems to be the only software difference between my phone and the samsung s4 mini.
QUESTION: I can understand that the analog side of my android device is not good as the iphone, i could also suppose that the analog part of my android device is broken... but i don't understand why i don't obtain the same result when i insert the bluetooth transceiver device.