2014-01-09 09:37 AM
2014-01-09 09:48 AM
It samples into a capacitor, understand t
he ADC's input impedance relative to that of the signal source
. Tie the inputs to opposite supplies to confirm their sequencing. The DMA is not stopped by the debugger, or the slowness of the USART output. Make sure TIM4 is not saturating the processor with interrupts. Spin on the TXE flag, not TC2014-01-10 01:16 AM
Hi
''It samples into a capacitor, understand the ADC's input impedance relative to that of the signal source
.'' If you do not know much electronics - if you leave the ADC input with no connection and expect to read 0V (0 value) - it is unlikely to work. To read 0V/0 value - you must put 0V on the ADC ie connect it to 0V. (There are plenty of tutorials on electronic on the WEB) A simple way to put a 'known voltage' onto the ADC is to use a variable resistor, (try 10K - linear) one end to the + volt other end to 0V and the wiper/variable bit to the ADC. You can then measure the value to the ADC with a volt meter. DO NOT SHORT CIRCUIT THE +V TO 0V!2014-01-10 03:14 AM
Hello,
thanks your suggestion were helpful to understand more. To code is working fine now. I also change from TC to TXE (I take a look on the datasheet and seems that there is not such a big difference by using one of those).My test, now, was to attach two variable resistors and see what happen, it is working perfect. I guess should work fine also with my real sensors.The behavior that I was mention before was obtained by doing a test using a function generator in one channel and nothing in the other one. Still is strange for me why the voltage changing in one pin affects also the other one, do you know the answer?Thanks clive and sung.chen_chung for the hints.Pablo2014-01-10 03:40 AM
Still is strange for me why the voltage changing in one pin affects also the other one, do you know the answer?
As suggested, read about SA-ADC, especially multiplexed one's. If a floating ADC channel is converted directly after another one, the sampling capacitor's charge (and thus its voltage) is dependant of the previous channel's voltage, minus ''conversion losses'' for the previous channel, minus leakage currents. If the phantom results annoy you, tie the floating ADC input to ground.
2014-01-10 04:14 AM
TC is significantly more latent, perhaps 20 bit times, but at least 10. Both the holding register is empty, and the LAST bit of it's prior content must hit the wire.
TXE indicates the HOLDING buffer is empty, and should signal as the FIRST bit of the prior content hits the wire. Thus TC is the MOST inefficient way to send data using the USART, resulting in larger inter-symbol gaps. I would not spin on a USART in an interrupt, better to buffer output data, and service byte-wise on a TXE interrupt.2014-01-10 10:32 AM
Thanks Clive I will consider you suggestion.
fm, thank you now makes sense. Pablo