Last active
January 8, 2023 16:59
-
-
Save pdp7/aee5664598059c9b9a9020f107957f80 to your computer and use it in GitHub Desktop.
src/arm/BB-SPIDEV1-00A0.dts modify to add tinydrm st7735r for Adafruit 1.8" TFT LCD connected to BeagleBone Black running 4.16.0-rc2-bone3 kernel. More info: https://groups.google.com/d/msg/beagleboard/GuMQIP_XCW0/b3lxbx_8AwAJ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2013 CircuitCo | |
* | |
* Virtual cape for SPI1 on connector pins P9.29 P9.31 P9.30 P9.28 | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License version 2 as | |
* published by the Free Software Foundation. | |
*/ | |
#include <dt-bindings/pinctrl/am33xx.h> | |
/dts-v1/; | |
/plugin/; | |
/ { | |
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green"; | |
/* identification */ | |
part-number = "BB-SPIDEV1"; | |
version = "00A0"; | |
/* state the resources this cape uses */ | |
exclusive-use = | |
/* the pin header uses */ | |
"P9.31", /* spi1_sclk */ | |
"P9.29", /* spi1_d0 */ | |
"P9.30", /* spi1_d1 */ | |
"P9.28", /* spi1_cs0 */ | |
// "P9.42", /* spi1_cs1 */ | |
/* the hardware ip uses */ | |
"spi1"; | |
fragment@0 { | |
target = <&am33xx_pinmux>; | |
__overlay__ { | |
/* default state has all gpios released and mode set to uart1 */ | |
bb_spi1_pins: pinmux_bb_spi1_pins { | |
pinctrl-single,pins = < | |
0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */ | |
0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */ | |
0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */ | |
0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ | |
// 0x164 0x12 /* eCAP0_in_PWM0_out.spi1_cs1 OUTPUT_PULLUP | MODE2 */ | |
>; | |
}; | |
}; | |
}; | |
fragment@1 { | |
target = <&spi1>; | |
__overlay__ { | |
#address-cells = <1>; | |
#size-cells = <0>; | |
status = "okay"; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&bb_spi1_pins>; | |
ti,pio-mode; /* disable dma when used as an overlay, dma gets stuck at 160 bits... */ | |
/*channel@0 { | |
#address-cells = <1>; | |
#size-cells = <0>; | |
compatible = "spidev"; | |
reg = <0>; | |
spi-max-frequency = <16000000>; | |
spi-cpha; | |
}; | |
channel@1 { | |
#address-cells = <1>; | |
#size-cells = <0>; | |
compatible = "spidev"; | |
reg = <1>; | |
spi-max-frequency = <16000000>; | |
};*/ | |
display@0{ | |
status = "okay"; | |
compatible = "jianda,jd-t18003-t01", "sitronix,st7735r"; | |
reg = <0>; | |
spi-max-frequency = <16000000>; | |
/* https://elinux.org/Beagleboard:Cape_Expansion_Headers */ | |
dc-gpios = <&gpio1 16 0>; /* dc:48 P9.15 GPIO1_16 */ | |
reset-gpios = <&gpio1 28 0>; /* reset:60 P9.12 GPIO1_28 */ | |
/* rotation = <270>; */ | |
}; | |
}; | |
}; | |
}; |
Author
pdp7
commented
Feb 22, 2018
debian@beaglebone:~/libdrm/tests/modetest$ ./modetest -M st7735r |head
Encoders:
id crtc type possible crtcs possible clones
31 30 none 0x00000001 0x00000000
Connectors:
id encoder status name size (mm) modes encoders
28 31 connected Virtual-1 35x28 1 31
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
160x128 0 160 160 160 160 128 128 128 128 1 flags: ; type: preferred, driver
debian@beaglebone:~/libdrm/tests/modetest$ sudo ./modetest -M st7735r -s 28:160x128
setting mode 160x128-0Hz@XR24 on connectors 28, crtc 30
debian@beaglebone:~/libdrm/tests/modetest$ find |grep modetest^C
debian@beaglebone:~/libdrm/tests/modetest$ sudo ./modetest -M st7735r -s 28:160x128 -v
setting mode 160x128-0Hz@XR24 on connectors 28, crtc 30
freq: 37.50Hz
freq: 37.43Hz
For anyone interested, here is a discussion thread about using this Adafruit 1.8" TFT LCD with tinydrm on BeagleBone.
PWM backlight example in BB-BONE-4D4C-01-00A1.dts
:
fragment@1 {
target = <&am33xx_pinmux>;
__overlay__ {
bb_lcd_pwm_backlight_pins: pinmux_bb_lcd_pwm_backlight_pins {
pinctrl-single,pins = <
BONE_P9_14 0x06 /* gpmc_a2.ehrpwm1a, OMAP_MUX_MODE6 | AM33XX_PIN_OUTPUT */
>;
};
fragment@6 {
target-path="/";
__overlay__ {
/* avoid stupid warning */
#address-cells = <1>;
#size-cells = <1>;
backlight {
status = "okay";
compatible = "pwm-backlight";
pwms = <&ehrpwm1 0 500000 0>;
brightness-levels = <
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59
60 61 62 63 64 65 66 67 68 69
70 71 72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87 88 89
90 91 92 93 94 95 96 97 98 99
100
>;
default-brightness-level = <100>;
};
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment