To load support for the Microchip MRF24J40 execute the following:
#echo BB-BONE-MRF24J40 > /sys/devices/bone_capemgr.8/slots
This should result in following kernel debug messages:
[ 883.483409] bone-capemgr bone_capemgr.8: part_number 'BB-BONE-MRF24J40', version 'N/A' [ 883.483585] bone-capemgr bone_capemgr.8: slot #6: specific override [ 883.483660] bone-capemgr bone_capemgr.8: bone: Using override eeprom data at slot 6 [ 883.483716] bone-capemgr bone_capemgr.8: slot #6: 'Bone-MRF24J40,00A0,Signal 11 Softwa,BB-BONE-MRF24J40' [ 883.484028] bone-capemgr bone_capemgr.8: slot #6: Requesting firmware 'cape-bone-mrf24j40-00A0.dtbo' for board-name 'Bone-MRF24J40', version '00A0' [ 883.484113] bone-capemgr bone_capemgr.8: slot #6: dtbo 'cape-bone-mrf24j40-00A0.dtbo' loaded; converting to live tree [ 883.484629] bone-capemgr bone_capemgr.8: slot #6: #2 overlays [ 883.594180] edma-dma-engine edma-dma-engine.0: allocated channel for 0:43 [ 883.594350] edma-dma-engine edma-dma-engine.0: allocated channel for 0:42 [ 883.595019] mrf24j40: probe(). IRQ: 205 [ 883.599630] bone-capemgr bone_capemgr.8: slot #6: Applied #2 overlays.
The current kernel patches has a typo in the /kernel/firmware/capes/cape-bone-mrf24j40-00A0.dts that may cause the cape manager to report it is incompatible with the baseboard. i.e.:
[ 417.682368] bone-capemgr bone_capemgr.8: slot #8: Requesting firmware 'cape-bone-mrf24j40-00A0.dtbo' for board-name 'Bone-MRF24J40', version '00A0' [ 417.682392] bone-capemgr bone_capemgr.8: slot #8: dtbo 'cape-bone-mrf24j40-00A0.dtbo' loaded; converting to live tree [ 417.682595] bone-capemgr bone_capemgr.8: slot #8: Incompatible with baseboard for 'BB-BONE-MRF24J40' [ 417.692228] bone-capemgr bone_capemgr.8: slot #8: Failed verification
If this is the case, change the following line
compatible = "ti,beaglebone", "ti-beaglebone-black";
to
compatible = "ti,beaglebone", "ti,beaglebone-black";
and rebuild.
Device Tree support is gradually getting more mature. Changes were made after version 3.8 of the kernel that may result with the MRF24J40 driver being unable to get an IRQ, similar to that below:
[ 46.261282] edma-dma-engine edma-dma-engine.0: allocated channel for 0:43 [ 46.261342] edma-dma-engine edma-dma-engine.0: allocated channel for 0:42 [ 46.261755] mrf24j40: probe(). IRQ: 0 [ 46.266992] mrf24j40 spi1.0: Unable to get IRQ [ 46.277735] mrf24j40: probe of spi1.0 failed with error -22 [ 46.280241] bone-capemgr bone_capemgr.6: slot #7: Applied #2 overlays.
If this is the case change the following lines in /kernel/firmware/capes/cape-bone-mrf24j40-00A0.dts from
interrupt-parent = <&gpio2>; interrupts = <29>;
to
#interrupt-cells = <2>; interrupt-parent = <&gpio1>; interrupts = <29 0x8>;
Rebuild and then copy the .dtbo to the /lib/firmware path on your root filesystem.
dtc -O dtb -o BB-BONE-MRF24J40-00A0.dtbo -b o -@ cape-bone-mrf24j40-00A0.dts
The MRF24J40 shares I/O (P9.31) with the HDMI Interface. If you don't disable the HDMI interface on boot (or unload it - glup), the following error may result:
[ 23.701229] bone-capemgr bone_capemgr.8: slot #7: Requesting firmware 'cape-bone-mrf24j40-00A0.dtbo' for board-name 'Bone-MRF24J40', version '00A0' [ 23.715092] bone-capemgr bone_capemgr.8: slot #7: dtbo 'cape-bone-mrf24j40-00A0.dtbo' loaded; converting to live tree [ 23.726858] bone-capemgr bone_capemgr.8: slot #7: BB-BONE-MRF24J40 conflict P9.31 (#5:BB-BONELT-HDMI) [ 23.736629] bone-capemgr bone_capemgr.8: slot #7: Failed verification
To disable the HDMI interface, see the example at the bottom of this page.
The easiest way of testing your MRF24J40 interface hardware is using izchat to send simple text messages between two 802.15.4 interfaces. Izchat is part of the Linux Zigbee User Space Tools
Device 1:
# echo BB-BONE-MRF24J40 > /sys/devices/bone_capemgr.9/slots # iz add wpan-phy0 Registered new device ('wpan0') on phy wpan-phy0 # iz set wpan0 777 8001 11 # ifconfig wpan0 up # izchat 777 8001 8002 > hello how are you?
Device 2:
# echo BB-BONE-MRF24J40 > /sys/devices/bone_capemgr.9/slots # iz add wpan-phy0 Registered new device ('wpan0') on phy wpan-phy0 # iz set wpan0 777 8002 11 # ifconfig wpan0 up # izchat 777 8002 8001 hello > how are you?