Using digital potentiometer MCP41010 with BeagleBone Black

17 views
Skip to first unread message

Frederico Alves de Oliveira Silva

unread,
Aug 13, 2019, 12:14:18 PM8/13/19
to BeagleBoard
Hello guys,

I am using a BeagleBone Black with an digital potentiometer MCP41010.

I did the connections between the two devices and run the code in python below:

import Adafruit_BBIO.SPI as SPI

from Adafruit_BBIO.SPI import SPI
# spi = SPI(bus, device) #/dev/spidev<bus>.<device>

# /dev/spidev0.0
spi = SPI(0, 0)
print(spi.xfer2([127]))
spi.close()

The output of the code should be: 127
But I only get: 255

Can anyone help me?

Dennis Lee Bieber

unread,
Aug 13, 2019, 8:32:42 PM8/13/19
to beagl...@googlegroups.com
On Tue, 30 Jul 2019 15:27:55 -0700 (PDT), Frederico Alves de Oliveira Silva
<freder...@gmail.com> declaimed the
following:

>
>import Adafruit_BBIO.SPI as SPI
>from Adafruit_BBIO.SPI import SPI# spi = SPI(bus, device) #/dev/spidev<bus>.<device>
># /dev/spidev0.0spi = SPI(0, 0)print(spi.xfer2([127]))spi.close()
>The output of the code should be: 127

No... the output of that mess will be nothing -- please post using a
client that doesn't wipe out line endings when pasting code. As is, there
are only two viable statements in that and those are two conflicting import
statements

import Adafruit_BBIO.SPI as SPI
from Adafruit_BBIO.SPI import SPI

Everything else appears behind # comment markers

>But I only get: 255
>

Well, why do you expect the result to be 127? You may be sending 127 to
the device, but the device could be sending back whatever value it
initialized with -- and since you appear to be opening and closing the
device each time, there is no assurance the device didn't reset to maximum
each time you try.


--
Wulfraed Dennis Lee Bieber AF6VN
wlf...@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

Dennis Lee Bieber

unread,
Aug 14, 2019, 9:08:43 AM8/14/19
to beagl...@googlegroups.com
On Tue, 13 Aug 2019 20:32:25 -0400, Dennis Lee Bieber
<wlf...@ix.netcom.com> declaimed the following:


> Well, why do you expect the result to be 127? You may be sending 127 to
>the device, but the device could be sending back whatever value it
>initialized with -- and since you appear to be opening and closing the
>device each time, there is no assurance the device didn't reset to maximum
>each time you try.
>

Glancing at a data sheet, the 41010 doesn't even have an output, so
there is nothing you can be reading (so, if MISO is tied high, it may be
reading 1s on each clock)
Reply all
Reply to author
Forward
0 new messages