[PATCH 29/29] staging: comedi: dt282x: automatically handle D/A data format

Ian Abbott abbotti at mev.co.uk
Tue Jun 24 12:35:01 UTC 2014


On 2014-06-23 18:45, Hartley Sweeten wrote:
> On Monday, June 23, 2014 8:10 AM, Ian Abbott wrote:
>> On 2014-06-20 21:13, H Hartley Sweeten wrote:
>>> The DT2821 series board have jumpers that set the output range for
>>> the two Analog Output channels. The range_table for the Analog Output
>>> subdevice provides all possible ranges to the user. When a unipolar
>>> range is selected the board expects the data to be in a straight
>>> binary format. When a bipolar range is select the data should be in
>>> two's complement format.
>>>
>>> Currently, the user passes some configuration options when attaching
>>> to the driver to select the data format for each channel. If the
>>> user does not pass the config options, the data format is assumed to
>>> be straight binary.
>>>
>>> The Analog Output subdevice now has a range_table that provides the
>>> user will all possible ranges. Use the range information to determine
>>> if the data values need to be munged into two's complememnt values
>>> and deprecate the config options.
>>
>> I don't think there's any physical requirement for the 2's
>> complement/straight binary jumpers to match the range jumpers.  The 2's
>> complement/straight binary jumper will just invert or pass through the
>> top bit of the data value.
>>
>> A downside of this patch is that users may have to open up their
>> computer to set the jumper how comedi expects it to be, rather than just
>> telling comedi how the jumper is set on the board via the attach option
>> (although the options were handled incorrectly anyway and fixed by your
>> patch 06).  Particularly in this case, the default option values for
>> options 6, 7, 9 and 10 would have been to assume the +/-10V range with
>> straight binary coding, but this patch changes it to assume 2's
>> complement encoding for the +/-10V range.
>>
>> In general, I feel it's best not to mess with the attach option values
>> unless they're obviously buggy.
>
> These legacy boards can be a pain with all the jumper options...
>
> For manual for the DT2821 series states this for the D/A subsystem:
>
> "Tables 3-10 and 3-11 indicate jumper selections
> for the output range for each DAC and the factory
>   configuration. When jumpered for unipolar
> operation, the DT2821 series board expects digital
> data in straight binary coding. When set for
> bipolar mode, the DT2821 series board expects
> digital data in offset binary coding only."
>
>
> Based on that it appears there is a physical requirement.

In that case I agree there's no point having options to configure the 
encoding of the AO channels' data.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


More information about the devel mailing list