Thanks Koen! I think I'm starting to understand a little more now ....at least enough to have a go learning how to do it. MPU6050 is interesting .... led me to "iio" which is also interesting. Main issue is that it's i2c and doesn't offer all 9 axis.....then agaain I could be talking about my a!ss so :)
I found this: https://mbed.org/users/kylongmu/code/MPU9250_SPI/ Which has been somewhat ported into: https://github.com/emlid/Navio/blob/master/Navio/MPU9250.cpp Which is close....but it's C++ and it's more Middleware then a device driver ....so I'm thinking that with all the above examples and the "spidev.c" skeleton, I would have a go at copying/porting/writing an MPU9250 SPI device driver. I'm guessing: Interrupt wakes up processor, reads 9 axis values into a binary string and outputs to device "/dev/mpu9250" Now to find my old copy of "The C Programming language" :) On Mon, Jul 7, 2014 at 7:39 AM, Koen Kooi <[email protected]> wrote: > > Op 5 jul. 2014, om 23:16 heeft bruce bushby <[email protected]> het > volgende geschreven: > > > > > Looking much better: > > # ls -l /dev/*spi* > > crw------- 1 root root 153, 0 Jan 10 13:51 /dev/spidev0.0 > > # > > > > > > I added an spidev childnode to my spi1 node like so: > > > > spi1: spi@01c06000 { > > pinctrl-names = "default"; > > pinctrl-0 = <&spi1_pins_a>; > > status = "okay"; > > spidev@0 { > > compatible = "linux,spidev"; > > reg = <0>; > > spi-max-frequency = <1000000>; > > }; > > }; > > > > > > > > Rebuild, reboot and what would you know...... I have " /dev/spidev0.0" > > Note that spidev is a userspace 'driver' and a hack, not something you'd > use longterm. > > > Really can't thank you guys enough for all the help, much appreciated!!!! > > > > next stop.....connecting an SPI device ....hopefully without too many > sparks :) > > > > I'm connecting an MPU9250: > > > http://www.drotek.fr/shop/421-1256-large_dm/mpu9250-gyro-accelerometer-magnetometer.jpg > > > > Guessing the "compatible" string will just be spi? > > iirc the MPU6050 has a driver already, to get that working replace the > spidev entry with the 6050 one. > > regards, > > Koen > > > > > > > > > > > > > > > > > > > > On Sat, Jul 5, 2014 at 10:04 PM, bruce bushby <[email protected]> > wrote: > > Well Jon kindly pointed me to his repo which is confirmed to have spidev > working on A20. I used his repo and his .config file .....with the same > results ...which I guess is a good thing as it means my previous attempts > were probably all working and I just need to find what crucial step I am > missing. > > > > Here you can see both spi kernel processes running > > # > > # ps -ef | grep -i spi > > 46 root [spi0] > > 47 root [spi1] > > 152 root grep -i spi > > # > > > > > > I changed spidev to be a kernel module....and it loads without any > problems > > # lsmod > > Module Size Used by Not tainted > > spidev 5471 0 > > # > > > > > > > > The /sys filesystem is aware of the spi devices: > > # find /sys -iname "*spi*" > > /sys/bus/spi > > /sys/bus/spi/drivers/spidev > > /sys/bus/platform/devices/1c06000.spi > > /sys/bus/platform/devices/1c17000.spi > > /sys/bus/platform/drivers/sun4i-spi > > /sys/bus/platform/drivers/sun4i-spi/1c06000.spi > > /sys/bus/platform/drivers/sun4i-spi/1c17000.spi > > /sys/bus/platform/drivers/sun6i-spi > > /sys/devices/soc@01c00000/1c06000.spi > > /sys/devices/soc@01c00000/1c06000.spi/spi_master > > /sys/devices/soc@01c00000/1c06000.spi/spi_master/spi0 > > /sys/devices/soc@01c00000/1c17000.spi > > /sys/devices/soc@01c00000/1c17000.spi/spi_master > > /sys/devices/soc@01c00000/1c17000.spi/spi_master/spi1 > > /sys/class/spi_master > > /sys/class/spi_master/spi0 > > /sys/class/spi_master/spi1 > > /sys/class/spidev > > /sys/firmware/devicetree/base/soc@01c00000/spi@01c05000 > > /sys/firmware/devicetree/base/soc@01c00000/spi@01c06000 > > /sys/firmware/devicetree/base/soc@01c00000/spi@01c17000 > > /sys/firmware/devicetree/base/soc@01c00000/spi@01c1f000 > > /sys/firmware/devicetree/base/soc@01c00000/pinctrl@01c20800/spi0@0 > > /sys/firmware/devicetree/base/soc@01c00000/pinctrl@01c20800/spi1@0 > > /sys/firmware/devicetree/base/soc@01c00000/pinctrl@01c20800/spi2@0 > > /sys/firmware/devicetree/base/aliases/spi0 > > /sys/firmware/devicetree/base/aliases/spi1 > > /sys/module/spidev > > /sys/module/spidev/drivers/spi:spidev > > # > > > > I have added "udev" (eudev) to my build > > # > > # /etc/init.d/S10udev stop > > # /etc/init.d/S10udev start > > Populating /dev using udev: [ 1242.412281] udevd[164]: starting version > 1.7 > > done > > # > > > > > > > > Wondering if I need: > > 1. An actual spi device connected > > 2. An "spiddev node" ....or "spidev" as a "childnode" of spi1 > > > > > > Also noticed I don't see any SPI messages from dmesg....which I guess is > a hint I'll follow soon > > > > > > > > > > > > > > > > > > > > > > On Sat, Jul 5, 2014 at 8:59 PM, Maxime Ripard < > [email protected]> wrote: > > On Sat, Jul 05, 2014 at 02:14:44PM +0100, bruce bushby wrote: > > > update: I added spi0 to my dts file and everything appears to build and > > > boot smoothly.....however I still don't see anything under "/dev/*spi*" > > > ......perhaps something simple as a missing udev rule or mknod > script. I'm > > > not sure who or what should create the "/dev/*spi*" device(s). > > > > /dev/spi* is handled by a driver called spidev. If this driver is not > > both loaded and probed, you'll never see a /dev/spi* file, even though > > the controller driver is working fine. > > > > -- > > Maxime Ripard, Free Electrons > > Embedded Linux, Kernel and Android engineering > > http://free-electrons.com > > > > > > > > -- > > You received this message because you are subscribed to the Google > Groups "linux-sunxi" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "linux-sunxi" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/linux-sunxi/3Ybi8DQ37O0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
