BLog

ImprintImpressum
PrivacyDatenschutz
DisclaimerHaftung
Downloads 

Enable the ADC and PRU devices of the BeagleBone Black on FreeBSD 12-CURRENT

By default, the ADC and PRU devices of the BeagleBone Black are not enabled by FreeBSD 12-CURRENT, although the device drivers are built-in to the kernel. For enabling ADC and PRU, it is necessary to overlay respective directives to the device tree.

  1. I got a ~/install directory and I put a dts directory in there for creating the DT overlays.
  2. For enabling the ADC, create the file ~/install/dts/am335x-boneblack-tscadc.dtso:
    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
    
    	fragment@0 {
    		target = <&tscadc>;
    		__overlay__ {
    			status = "okay";
    			adc {
    				ti,adc-channels = <0 1 2 3 4 5 6 7>;
    			};
    		};
    	};
    };
  3. Compile the ADC device tree overlay source code into a respective device tree blob:
    cd ~/install/dts
    dtc -I dts -O dtb -b0 -@ -o /boot/dtb/am335x-boneblack-tscadc.dtbo am335x-boneblack-tscadc.dtso
  4. For enabling the PRU, create the file ~/install/dts/am335x-boneblack-pruss.dtso:
    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
    
    	fragment@0 {
    		target-path="/";
    		__overlay__ {
    			ocp {
    				#address-cells = <1>;
    				#size-cells = <1>;
    
    				pruss@4a300000 {
    					status = "okay";
    					compatible = "ti,pruss-v2";
    					ti,deassert-hard-reset = "pruss", "pruss";
    					reg = <0x4a300000 0x080000>;
    					ti,pintc-offset = <0x20000>;
    					interrupt-parent = <&intc>;
    					interrupts = <20 21 22 23 24 25 26 27>;
    				};
    			};
    		};
    	};
    };
  5. Compile the PRU device tree overlay source code into a respective device tree blob:
    cd ~/install/dts
    dtc -I dts -O dtb -b0 -@ -o /boot/dtb/am335x-boneblack-pruss.dtbo am335x-boneblack-pruss.dtso
  6. To the file /boot/loader.conf add the following line:
    fdt_overlays="am335x-boneblack-tscadc.dtbo,am335x-boneblack-pruss.dtbo"
  7. Finally restart.

Enter the command sysctl dev.ti_adc:

dev.ti_adc.0.ain.7.input: 0
dev.ti_adc.0.ain.7.samples_avg: 0
dev.ti_adc.0.ain.7.open_delay: 0
dev.ti_adc.0.ain.7.enable: 0
dev.ti_adc.0.ain.6.input: 0
dev.ti_adc.0.ain.6.samples_avg: 0
dev.ti_adc.0.ain.6.open_delay: 0
dev.ti_adc.0.ain.6.enable: 0
dev.ti_adc.0.ain.5.input: 0
dev.ti_adc.0.ain.5.samples_avg: 0
dev.ti_adc.0.ain.5.open_delay: 0
dev.ti_adc.0.ain.5.enable: 0
dev.ti_adc.0.ain.4.input: 0
dev.ti_adc.0.ain.4.samples_avg: 0
dev.ti_adc.0.ain.4.open_delay: 0
dev.ti_adc.0.ain.4.enable: 0
dev.ti_adc.0.ain.3.input: 0
dev.ti_adc.0.ain.3.samples_avg: 0
dev.ti_adc.0.ain.3.open_delay: 0
dev.ti_adc.0.ain.3.enable: 0
dev.ti_adc.0.ain.2.input: 0
dev.ti_adc.0.ain.2.samples_avg: 0
dev.ti_adc.0.ain.2.open_delay: 0
dev.ti_adc.0.ain.2.enable: 0
dev.ti_adc.0.ain.1.input: 0
dev.ti_adc.0.ain.1.samples_avg: 0
dev.ti_adc.0.ain.1.open_delay: 0
dev.ti_adc.0.ain.1.enable: 0
dev.ti_adc.0.ain.0.input: 0
dev.ti_adc.0.ain.0.samples_avg: 0
dev.ti_adc.0.ain.0.open_delay: 0
dev.ti_adc.0.ain.0.enable: 0
dev.ti_adc.0.clockdiv: 2400
dev.ti_adc.0.%parent: simplebus0
dev.ti_adc.0.%pnpinfo: name=tscadc@44e0d000 compat=ti,am3359-tscadc
dev.ti_adc.0.%location:
dev.ti_adc.0.%driver: ti_adc
dev.ti_adc.0.%desc: TI ADC controller
dev.ti_adc.%parent:

Enter the command sysctl dev.ti_pruss:

dev.ti_pruss.0.global_interrupt_enable: 0
dev.ti_pruss.0.irq.9.enable: 0
dev.ti_pruss.0.irq.9.event: NONE
dev.ti_pruss.0.irq.9.channel: NONE
dev.ti_pruss.0.irq.8.enable: 0
dev.ti_pruss.0.irq.8.event: NONE
dev.ti_pruss.0.irq.8.channel: NONE
dev.ti_pruss.0.irq.7.enable: 0
dev.ti_pruss.0.irq.7.event: NONE
dev.ti_pruss.0.irq.7.channel: NONE
dev.ti_pruss.0.irq.6.enable: 0
dev.ti_pruss.0.irq.6.event: NONE
dev.ti_pruss.0.irq.6.channel: NONE
dev.ti_pruss.0.irq.5.enable: 0
dev.ti_pruss.0.irq.5.event: NONE
dev.ti_pruss.0.irq.5.channel: NONE
dev.ti_pruss.0.irq.4.enable: 0
dev.ti_pruss.0.irq.4.event: NONE
dev.ti_pruss.0.irq.4.channel: NONE
dev.ti_pruss.0.irq.3.enable: 0
dev.ti_pruss.0.irq.3.event: NONE
dev.ti_pruss.0.irq.3.channel: NONE
dev.ti_pruss.0.irq.2.enable: 0
dev.ti_pruss.0.irq.2.event: NONE
dev.ti_pruss.0.irq.2.channel: NONE
dev.ti_pruss.0.irq.1.enable: 0
dev.ti_pruss.0.irq.1.event: NONE
dev.ti_pruss.0.irq.1.channel: NONE
dev.ti_pruss.0.irq.0.enable: 0
dev.ti_pruss.0.irq.0.event: NONE
dev.ti_pruss.0.irq.0.channel: NONE
dev.ti_pruss.0.%parent: simplebus0
dev.ti_pruss.0.%pnpinfo: name=pruss@4a300000 compat=ti,pruss-v2
dev.ti_pruss.0.%location:
dev.ti_pruss.0.%driver: ti_pruss
dev.ti_pruss.0.%desc: TI Programmable Realtime Unit Subsystem
dev.ti_pruss.%parent: 

Keywords: ADC, PRU, BeagleBone, FreeBSD

Copyright © Dr. Rolf Jansen - 2018-07-07 11:27:49

PROMOTION