2016-05-25 07:57 PM
I need to know what the differential mode SDADC conversion code is. Is it 2's compliment such that the code:
int16_t D = (int16_t)HAL_SDADC_GetValue(&hsdadc3);
Will return to D a signed result such that if the positive input is less than the negative input D will be a negative value and that: float V = D * VDDA / (1 << 16); will result in V being the signed voltage across the inputs? (Assuming unity gain.) I have looked for this in the documentation and I cannot find it. It would help for me to know where this is. The processor is an STM32F373VCT. #sdadc-codes-differential-mode2016-05-26 01:17 AM
Hi Stephen,
Referring to application note (Getting started with STM32F37x/38x SDADC (Sigma-Delta ADC)): ''In differential mode, the SDADC converts the difference between SDADCx_AINyP and SDADCx_AINyM. The result can be either positive or negative depending on which input is at higher voltage.''In this application note, you find some examples that may be helpful for you.Please let us know if you have any comment or feedback.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-05-26 11:20 AM
Thank you for the link. This is just what I was looking for.
There is something I noticed in AN4207 though. For every other 16 bit converter I am familiar with the voltage resolution is the full scale voltage divided by the number of possible output codes. This would be VDDA/65536. The highest possible value output code of 65535 would cover the input voltages between VDDA*65535/65536 and VDDA. The lowest possible value of zero would cover input voltages between 0 and up to, but not including, VDDA/65536. The number of possible codes AN4207 seems to be based on is 65535, as this is the divisor used in the equations. Is this really correct? I realize this is a trivial difference. But I am a stickler for detail and accuracy.2016-05-26 01:17 PM
I realize this is a trivial difference. But I am a stickler for detail and accuracy.
ST historically has used the N-1 philosophy for the ADC transforms. ie 0xFF for 8-bit, 0xFFF for 12-bitI'm more in the 0..N-1 has N states camp, but assume it is going to make very little difference compared to the noise, and fact it simply can't measure rail-to-rail.