Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SPI device connection woes



On Mon, 2023-03-20 at 17:37 -0400, Brad Spencer wrote:

snip..snip..snip

> For the BMx280 it will be a pain to use it from userland.  That isn't
> true of every device I have worked with, but I wouldn't want to do
> that
> with this one.
> 
> > I do have a MAX31865 chip which allows temperatures to be read from
> > a
> > pt100 probe - this is a pure SPI device. I can probably knock up a
> > kernel driver using your code as a guideline. Would this be a more
> > sensible route rather than usermode application?
> 
> It depends entirely on how messy the chip is.  The Bosch chips are
> all
> messy, at least the BMx280 and BME68x are, and I would not want to
> try
> and use them from userland SPI.  When I was working on scmd(4) I
> allowed
> it to use the scmd driver, which can attach with i2c or SPI, or
> userland
> SPI or userland TTY (that device has a lot of way to talk to the
> world).
> See the scmdctl(1) command for details on how this is done, if you
> are
> interested.  However, this was really only possible because it was
> pretty simple to interface to the device.  Nothing about it was very
> messy as it modeled itself more or less as a linear set of registers,
> so
> I just allowed the device to be opened, read, write and seek'ed
> to.  The
> environment sensors I have worked with so far really would not lend
> themselves to that sort of model, although some of them are simple
> enough that a userland interface would be possible..  the SHT4x has a
> pretty simple trigger register and a simple read back, for example
> (but
> it is all I2C only).
> 
> Is there a data sheet for your device somewhere??

https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31865.pdf

It looks pretty straightforward to read the temperature with minimal
register accesses. There are a some extra registers for setting
thresholds and detecting and diagnosing broken connections between the
chip and the sensor. I will have a look at writing a userland driver in
a couple of weeks time. I decided to use a 4 wire resistive element as
this gives the greatest accuracy and they are a reasonable price...

Thanks for your help and the additional info on the scmd stuff. 

Dave


Home | Main Index | Thread Index | Old Index