Hi,

testing different kind of sensors/modules provide the change to work with 
the several buses the BeagleBone Black has.

Now, I'm playing with an analog light sensor connected to an ADC which 
communicate with BBB through SPI bus. 
So, the first step I need to do is enable the SPI. Then, test SPI with 
loopback example. And finally, build the code to read from the ADC the 
light sensor data.

BeagleBone Black has:

   - OS: Debian
   - Kernel: 3.8.13-bone78
   - Kernel version: #1 SMP Sat Sep 26 09:11:50 UTC 2015

To enable SPI0, I have followed this guide, SPIDEV 
<http://elinux.org/BeagleBone_Black_Enable_SPIDEV>. During the guide steps 
implementation I have found some doubts/issues, so I will explain the 
procedure I has followed with its results in order to get the more precise 
help as possible.

   1. Create and Edit: *BB-SPI0-01-00A0.dts*
   2. Compile: *BB-SPI0-01-00A0.dts*
   3. Copy, *BB-SPI0-01-00A0.dtbo*, to: */lib/firmware/*
   4. Enable the Device Overlay Tree: 
      - *echo BB-SPI0-01 > /sys/devices/bone_capemgr.*/slots*
      - At my system '*' is '9'.
      5. Edit: */boot/uboot/uEnv.txt* file to add next line:
      - *optargs=quiet drm.debug=7 capemgr.enable_partno=BB-SPI0-01*
      6. Reboot.
   7. List SPI buses enabled: *ls -al /dev/spidev0.**
      - *ISSUE1*: there is no SPI bus enabled. I need to repeat the step 4 
      to finally enabled the SPI bus. So, I have added that line to '.profile' 
to 
      have SPI enabled with every bootup. Is there any mistake at this 
behaviour?
   8. Show pingroups:
      - *cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups*
      1. group: spi0_pins_s0
         2. pin 84 (44e10950)
         3. pin 85 (44e10954)
         4. pin 86 (44e10958)
         5. pin 87 (44e1095c)
         - *QUESTION1*: How can I find out which address correspond to a 
      pin? I tried to find it at BBB_SRM but there is no info about.
   

Now, it is time to check SPI running a loopback example. The SPIDEV 
<http://elinux.org/BeagleBone_Black_Enable_SPIDEV> guide tells to shorcut 
pins 29 & 30 for SPI1, so for SPI0 pins are 18 & 21.
But, here start new problems:

   1. Next step ask for apply *diff to the kernel*.
      - *diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c*
      - Output: diff: unrecognized option '--git'
         - *ISSUE2*: Moreover, there is no spidev.c at BBB system. No diff 
         can be made.
      2. Finally, test the SPI with '*spidev_test*' program.
      - *QUESTION2*: Where is that file? Or the path, 
      *kernel/Documentation/spi*?
   

Well, once we reach this point there is only one thing more I would like to 
know. If I write a new code to work with SPI & sensors, *which libraries 
should be added*? (Maybe, <*linux/spi/spidev.h*> will be enough).

Kind Regards.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" 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.

Reply via email to