如题,使用SPI1 驱动,配置了设备树
&spi1 {
status = "okay";
ssd1306@0 {
compatible = "solomon,ssd1306";
reg = <0>;
spi-max-frequency = <1000000>;
rotate = <0>;
bgr;
fps = <30>;
buswidth = <8>;
reset-gpios = <&pio 4 5 GPIO_ACTIVE_LOW>;
dc-gpios = <&pio 4 6 GPIO_ACTIVE_LOW>;
debug = <0>;
};
};
IO节点声明引脚定义 PA2 PA0 PA3 PA1
pio: pinctrl@1c20800 {
compatible = "allwinner,suniv-f1c100s-pinctrl";
reg = <0x01c20800 0x400>;
interrupts = <38>, <39>, <40>;
clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
clock-names = "apb", "hosc", "losc";
gpio-controller;
interrupt-controller;
#interrupt-cells = <3>;
#gpio-cells = <3>;
spi0_pins_a: spi0-pins-pc {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
spi1_pins: spi1-pins{
pins = "PA2","PA0","PA3","PA1";
function = "spi1";
};
SPI支持中开启 【Allwinner A31 SPI controller 】配置了SSD1306驱动相关内容
离线
在驱动fd_ssd1306.c 写帧数据函数内打log
static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
{
u16 *vmem16 = (u16 *)par->info->screen_buffer;
u32 xres = par->info->var.xres;
u32 yres = par->info->var.yres;
u8 *buf = par->txbuf.buf;
int x, y, i;
int ret = 0;
printk(KERN_INFO "********************OLED******************/n");
for (x = 0; x < xres; x++) {
for (y = 0; y < yres / 8; y++) {
*buf = 0x00;
for (i = 0; i < 8; i++)
*buf |= (vmem16[(y * 8 + i) * xres + x] ? 1 : 0) << i;
buf++;
}
}
/* Write data */
gpio_set_value(par->gpio.dc, 1);
ret = par->fbtftops.write(par, par->txbuf.buf, xres * yres / 8);
if (ret < 0)
dev_err(par->info->device, "write failed and returned: %d\n",
ret);
return ret;
}
最终在终端不断显示
[ 1784.147529] ********************OLED******************/n
[ 1784.357529] ********************OLED******************/n
[ 1784.567523] ********************OLED******************/n
[ 1784.777526] ********************OLED******************/n
[ 1784.987531] ********************OLED******************/n
[ 1785.197518] ********************OLED******************/n
[ 1785.407524] ********************OLED******************/n
[ 1785.617529] ********************OLED******************/n
[ 1785.827523] ********************OLED******************/n
[ 1786.037540] ********************OLED******************/n
说明fbtft应该是跑起来了,拿逻辑分析仪观察,发现spi相关的 CS MOSI CLK 均无输出,配置的GPIO RESET DC,有正常输出
离线
个人猜测是SPI1 这个master没有驱动器来,或者SPI1对应的管教没有正常配置,应为默认情况下这个spi内核是没有配置的,但是现在麻瓜了,不知道咋弄好。能给点建议吗?
不知道晕哥大神和小二大神在不在,指导一二,最近在学习linux,想搞一搞,哈哈
离线
[ 1.420327] i2c /dev entries driver
[ 1.452739] sunxi-mmc 1c0f000.mmc: base:0x8a848b4d irq:19
[ 1.460284] usbcore: registered new interface driver usbhid
[ 1.465862] usbhid: USB HID core driver
[ 1.470045] fbtft_of_value: buswidth = 8
[ 1.473982] fbtft_of_value: debug = 0
[ 1.477741] fbtft_of_value: rotate = 0
[ 1.481490] fbtft_of_value: fps = 30
[ 1.485583] ********************OLED******************/n
[ 1.621352] ********************OLED******************/n
[ 1.637891] Console: switching to colour frame buffer device 16x8
[ 1.649793] graphics fb0: fb_ssd1306 frame buffer, 128x64, 16 KiB video memory, 4 KiB buffer memory, fps=33, spi1.0 at 1 MHz
[ 1.675182] NET: Registered protocol family 17
[ 1.680016] Key type dns_resolver registered
[ 1.685866] ********************OLED******************/n
[ 1.687886] Loading compiled-in X.509 certificates
[ 1.706370] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.723364] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
从这里看出驱动应该是正确加载了的
离线
你的设备树配错了, 不是那样配置的。
离线
你的设备树配错了, 不是那样配置的。
附议, 可以参考晕哥这个帖子:
H5的spi控制器驱动, 可以通过 gpio 控制 spi 片选 (转载)
http://whycan.com/t_2418.html#p18568
(出处:哇酷开发者社区【全志 V3S/F1C100s/X3】)
离线
你的设备树配错了, 不是那样配置的。
非常感谢您指出错误。我研究研究
离线
拉轰的脚踏车 说:你的设备树配错了, 不是那样配置的。
附议, 可以参考晕哥这个帖子:
H5的spi控制器驱动, 可以通过 gpio 控制 spi 片选 (转载)
http://whycan.com/t_2418.html#p18568
(出处:哇酷开发者社区【全志 V3S/F1C100s/X3】)
非常感谢,我学习一下如何配置设备树
离线
结贴了,最后感谢大家的帮助,的确设备树配置错了,没有为spi设备配置 spi的pin
&spi1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
ssd1306@0 {
compatible = "solomon,ssd1306";
reg = <0>;
spi-max-frequency = <1000000>;
rotate = <0>;
bgr;
fps = <30>;
buswidth = <8>;
reset-gpios = <&pio 4 5 GPIO_ACTIVE_LOW>;
dc-gpios = <&pio 4 6 GPIO_ACTIVE_LOW>;
debug = <0>;
};
};
离线
新的问题又产生了,oled开启之后,会自动显示闪烁的光标,我通过程序向/dev/fd0写入数据,刷新显示内容时,光标和我写入的内容同时出现,那么应该如何关闭这个光标,,或者说怎么知道这个光标是从哪写入的?
离线
lichee nano官方linux config文件踩坑与填坑(常见配置误区)
http://whycan.com/t_2703.html
(出处:哇酷开发者社区【全志 V3S/F1C100s/X3】)
真是卧虎藏龙啊,????,今天太晚了,明天试试,我就说我一直没法关闭farmebuffer console support ,原来如此
离线
试过了,完全可行,感谢论坛网友大力支持,爱你们,么么哒
离线
[ 1.420327] i2c /dev entries driver [ 1.452739] sunxi-mmc 1c0f000.mmc: base:0x8a848b4d irq:19 [ 1.460284] usbcore: registered new interface driver usbhid [ 1.465862] usbhid: USB HID core driver [ 1.470045] fbtft_of_value: buswidth = 8 [ 1.473982] fbtft_of_value: debug = 0 [ 1.477741] fbtft_of_value: rotate = 0 [ 1.481490] fbtft_of_value: fps = 30 [ 1.485583] ********************OLED******************/n [ 1.621352] ********************OLED******************/n [ 1.637891] Console: switching to colour frame buffer device 16x8 [ 1.649793] graphics fb0: fb_ssd1306 frame buffer, 128x64, 16 KiB video memory, 4 KiB buffer memory, fps=33, spi1.0 at 1 MHz [ 1.675182] NET: Registered protocol family 17 [ 1.680016] Key type dns_resolver registered [ 1.685866] ********************OLED******************/n [ 1.687886] Loading compiled-in X.509 certificates [ 1.706370] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 1.723364] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
从这里看出驱动应该是正确加载了的
老哥请教一下,帮忙看看我这是怎么回事https://whycan.com/t_6237.html/
离线
新的问题又产生了,oled开启之后,会自动显示闪烁的光标,我通过程序向/dev/fd0写入数据,刷新显示内容时,光标和我写入的内容同时出现,那么应该如何关闭这个光标,,或者说怎么知道这个光标是从哪写入的?
请问楼主有没有遇到过花屏的问题?我也是nano+1306,能亮但是花屏
离线
fbtft资料太少了。。。。。。。。
离线