Difference between revisions of "BeagleBone Black RFID Adaptor Cape"
(→Schematic: Added the schematic and layout) |
(Added SPI DT) |
||
Line 11: | Line 11: | ||
== SPI Device Tree Overlay Setup== | == SPI Device Tree Overlay Setup== | ||
+ | '''NOTE:''' You CAN NOT use SPI1 on the BeagleBone Black WITHOUT disabling the HDMI interface | ||
+ | <br> | ||
+ | Create a file called BB-SPI1-01-00A0.dts and copy-paste the following code into the file | ||
+ | <pre> | ||
+ | /dts-v1/; | ||
+ | /plugin/; | ||
+ | |||
+ | / { | ||
+ | compatible = "ti,beaglebone", "ti,beaglebone-black"; | ||
+ | |||
+ | /* identification */ | ||
+ | part-number = "spi1mux"; | ||
+ | |||
+ | fragment@0 { | ||
+ | target = <&am33xx_pinmux>; | ||
+ | __overlay__ { | ||
+ | spi1_pins_s0: spi1_pins_s0 { | ||
+ | pinctrl-single,pins = < | ||
+ | 0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */ | ||
+ | 0x194 0x23 /* mcasp0_fsx.spi1_d0, INPUT_PULLDOWN | MODE3 */ | ||
+ | 0x198 0x03 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLDOWN | MODE3 */ | ||
+ | 0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ | ||
+ | >; | ||
+ | }; | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | fragment@1 { | ||
+ | target = <&spi1>; | ||
+ | __overlay__ { | ||
+ | |||
+ | #address-cells = <1>; | ||
+ | #size-cells = <0>; | ||
+ | status = "okay"; | ||
+ | pinctrl-names = "default"; | ||
+ | pinctrl-0 = <&spi1_pins_s0>; | ||
+ | cs-gpios = <&gpio4 17 0>; | ||
+ | |||
+ | spidev@0 { | ||
+ | spi-max-frequency = <16000000>; | ||
+ | reg = <0>; /* Use 0 if you want CS0 */ | ||
+ | compatible = "linux,spidev"; | ||
+ | spi-cpha; | ||
+ | }; | ||
+ | }; | ||
+ | }; | ||
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | Compile the dtc: | ||
+ | <pre> | ||
+ | dtc -O dtb -o BB-SPI1-01-00A0.dtbo -b 0 -@ BB-SPI1-01-00A0.dts | ||
+ | </pre> | ||
+ | Then, copy the file into /lib/firmware/: | ||
+ | <pre> | ||
+ | cp BB-SPI1-01-00A0.dtbo /lib/firmware/ | ||
+ | </pre> | ||
+ | Then enable the device tree overlay: | ||
+ | <pre> | ||
+ | echo BB-SPI1-01 > /sys/devices/bone_capemgr.*/slots | ||
+ | </pre> | ||
+ | |||
+ | Plug in your BBB to a host computer using the mini usb data cable. | ||
+ | |||
+ | Go to My Computer>BeagleBone Getting Started> and open uEnv.txt | ||
+ | Copy and paste this command into the .txt file. Make sure to save your changes. | ||
+ | (Ctrl+s) | ||
+ | |||
+ | <pre> | ||
+ | optargs=quiet drm.debug=7 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN | ||
+ | capemgr.enable_partno=BB-SPI1-01 | ||
+ | </pre> | ||
+ | after you save the changes, reboot your beaglebone black | ||
+ | <br> | ||
+ | Make sure it is enabled | ||
+ | You should now have two spidev-files in the folder /dev/ | ||
+ | <pre> | ||
+ | ls -al /dev/spidev1.* | ||
+ | </pre> | ||
== Eagle Files == | == Eagle Files == |
Revision as of 11:36, 23 July 2013
Contents
Description
The RFID adaptor cape is an interface between the Beaglebone Black (BBB) and Texas Instrument's TRF7970ATB, (Multi-Protocol Fully Integrated 13.56-MHz RFID and NFC Transceiver) It allows users to have fully functional RFID and NFC capabilities on the BBB. The adaptor board also features four additional LEDs and a push button.
The communication between the BBB and the TB is via SPI. Since SPI pins are not automatically enabled on BBB, a device tree overlay is used to configure the pins properly for SPI use.
Schematic
Sample Code
SPI Device Tree Overlay Setup
NOTE: You CAN NOT use SPI1 on the BeagleBone Black WITHOUT disabling the HDMI interface
Create a file called BB-SPI1-01-00A0.dts and copy-paste the following code into the file
/dts-v1/; /plugin/; / { compatible = "ti,beaglebone", "ti,beaglebone-black"; /* identification */ part-number = "spi1mux"; fragment@0 { target = <&am33xx_pinmux>; __overlay__ { spi1_pins_s0: spi1_pins_s0 { pinctrl-single,pins = < 0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */ 0x194 0x23 /* mcasp0_fsx.spi1_d0, INPUT_PULLDOWN | MODE3 */ 0x198 0x03 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLDOWN | MODE3 */ 0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ >; }; }; }; fragment@1 { target = <&spi1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi1_pins_s0>; cs-gpios = <&gpio4 17 0>; spidev@0 { spi-max-frequency = <16000000>; reg = <0>; /* Use 0 if you want CS0 */ compatible = "linux,spidev"; spi-cpha; }; }; }; };
Compile the dtc:
dtc -O dtb -o BB-SPI1-01-00A0.dtbo -b 0 -@ BB-SPI1-01-00A0.dts
Then, copy the file into /lib/firmware/:
cp BB-SPI1-01-00A0.dtbo /lib/firmware/
Then enable the device tree overlay:
echo BB-SPI1-01 > /sys/devices/bone_capemgr.*/slots
Plug in your BBB to a host computer using the mini usb data cable.
Go to My Computer>BeagleBone Getting Started> and open uEnv.txt Copy and paste this command into the .txt file. Make sure to save your changes. (Ctrl+s)
optargs=quiet drm.debug=7 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-SPI1-01
after you save the changes, reboot your beaglebone black
Make sure it is enabled
You should now have two spidev-files in the folder /dev/
ls -al /dev/spidev1.*