linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Mode 1 on /dev/spidev1.0: invalid argument
@ 2017-10-15 20:34 Dirk-Jan Faber
  0 siblings, 0 replies; only message in thread
From: Dirk-Jan Faber @ 2017-10-15 20:34 UTC (permalink / raw)
  To: linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]

Hello list,

While connecting an as5047d sensor to my Raspberry Pi 3, I noticed something unexpected in the spi connection. According the datasheet, the as5047d works in spi mode 1 (cpol=0, cpha=1). I noticed a difference between `/dev/spidev0.0` and `/dev/spidev1.0`. From the first device, I can read the sensor without problems. When I use the second device, I get the message:

> can't set spi mode: Invalid argument

I am aware that this can mean that either the Pi’s hardware or the software has a problem with setting the mode. I hope you can help me figure out which one is the case or maybe I am overlooking something.

I've put the code I use on a github gist: https://gist.github.com/steviethecat/49cfb90c7aaee848284647d31f4889e1
The argument for the compiled code is the device to use:

     $ ./as5047d-spi /dev/spidev0.0 | head -n 5
    spi mode: 1 bits per word: 8 max speed: 1000000 Hz (1000 KHz)
    245.52
    245.52
    $ ./as5047d-spi /dev/spidev1.0 | head -n 5
    can't set spi mode: Invalid argument
    $ uname -a
    Linux mypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux

I would really like to use `spidev1.0` for the encoder, as I already have the `spidev0.1` device connected to another spi device.

Kind regards,
  Dirk-Jan Faber

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 496 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-15 20:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-15 20:34 Mode 1 on /dev/spidev1.0: invalid argument Dirk-Jan Faber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).