您尚未登录。

楼主 #1 2017-10-06 17:01:45

basicdev
会员
注册时间: 2017-10-02
已发帖子: 159
积分: 159

开始测试v3s 荔枝派zero 接oled, 请围观.

离线

楼主 #2 2017-10-06 17:04:39

basicdev
会员
注册时间: 2017-10-02
已发帖子: 159
积分: 159

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

貌似这个选项已经选好了:

Device Drivers  --->
    Graphics support  --->
        Frame buffer Devices  --->
            <*> Solomon SSD1307 framebuffer support

离线

楼主 #3 2017-10-06 17:09:19

basicdev
会员
注册时间: 2017-10-02
已发帖子: 159
积分: 159

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

修改: arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts

&i2c0 {
    status = "okay";

    ns2009: ns2009@48 {
        compatible = "nsiway,ns2009";
        reg = <0x48>;
    };

ssd1306fb: ssd1306fb@3c {
        compatible = "solomon,ssd1306fb-i2c";
        reg = <0x3c>;
        solomon,width = <128>;
        solomon,height = <64>;
        reset-gpios = <&pio 1 0 GPIO_ACTIVE_HIGH>;
        solomon,page-offset = <0>;
        solomon,com-invdir;
    };

};

最近编辑记录 basicdev (2017-10-06 17:09:38)

离线

楼主 #4 2017-10-06 17:33:01

basicdev
会员
注册时间: 2017-10-02
已发帖子: 159
积分: 159

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

终于搞定:

v3s_oled_ssd1307.jpg

写随机数:

cat /dev/urandom > /dev/fb1

清屏:

cat /dev/zero > /dev/fb1

离线

楼主 #5 2017-10-07 11:10:31

basicdev
会员
注册时间: 2017-10-02
已发帖子: 159
积分: 159

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

注意在参数设置中要勾选字节倒叙选项。
下面写一个测试程序,加载驱动并把图像显示到屏幕上
C测试程序

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <string.h>

	/*seconds: the seconds; mseconds: the micro seconds*/
	void setTimer(int seconds, int mseconds)
{
	struct timeval temp;
	temp.tv_sec = seconds;
	temp.tv_usec = mseconds;
	printf("timer1\n");
	select(0, NULL, NULL, NULL, &temp);
	printf("timer2\n");
	return ;
}

int main ()
{
	char lichee[] = {
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0xE0,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x60,0x00,0x06,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x07,0x3C,0x74,0xE0,0x81,0x03,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x04,0x22,0x8C,0x10,0x43,0x04,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x04,0x42,0x84,0x10,0x22,0x0C,0xF8,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x04,0x03,0x84,0x08,0x22,0x08,0xFC,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x04,0x01,0x84,0x18,0x22,0x08,0xFE,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x04,0x01,0x84,0x18,0x20,0x00,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x00,0x04,0x01,0x84,0x08,0x20,0x00,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
		0x40,0x10,0x04,0x03,0x84,0x18,0x20,0x00,0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x08,
		0x40,0x10,0x04,0x02,0x84,0x10,0x22,0x00,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x0C,
		0x40,0x18,0x04,0x06,0x84,0x30,0x40,0x04,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x06,
		0xE0,0x0F,0x1F,0x1C,0xCE,0xC1,0x80,0x03,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x07,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x80,0x07,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xBF,0xFF,0x1F,0x00,0x00,0x00,0xC0,0x07,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xDF,0xFF,0x7F,0x00,0x00,0x00,0xE0,0x07,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC7,0xFF,0xFF,0x00,0x00,0x00,0xF0,0x03,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC9,0xFF,0xFF,0x01,0x00,0x00,0xF0,0x03,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xC0,0xFF,0xFF,0x03,0x00,0x00,0xF8,0x03,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xFF,0xFF,0x07,0x00,0x00,0xF0,0x03,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xC0,0xF7,0xFF,0x0F,0x00,0x00,0xF8,0x03,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE3,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0x01,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xEF,0xFF,0xFF,0x7F,0x00,0x00,0xF8,0x01,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFB,0xFF,0xFF,0xFF,0x00,0x00,0xFC,0x01,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0xFC,0x00,
		0x40,0x30,0x00,0x06,0x04,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xFE,0x00,
		0x40,0x10,0x02,0x06,0x04,0xC0,0x00,0x9C,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0xFF,0x00,
		0xFE,0xFF,0x07,0x06,0x04,0x80,0xC8,0x81,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x7F,0x00,
		0x40,0x10,0x00,0x06,0x04,0x80,0x08,0x00,0xFF,0xFF,0xFF,0xFF,0x7F,0x80,0x7F,0x00,
		0x40,0x13,0x00,0x16,0xCC,0x00,0x08,0x10,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x7F,0x00,
		0x00,0xC3,0xC0,0x3F,0x04,0x00,0x08,0x0E,0xFE,0xFF,0xFF,0xFF,0xFF,0xE3,0x3F,0x00,
		0x00,0xC1,0x00,0x06,0x04,0x10,0x48,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xF7,0x3F,0x00,
		0x80,0x41,0x00,0x06,0x04,0x20,0x49,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,
		0x80,0x40,0x00,0x0E,0x44,0x20,0x48,0x30,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,
		0x60,0x78,0x00,0x9F,0x61,0x80,0x48,0x08,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,
		0x38,0x30,0x00,0x17,0x60,0x80,0x48,0x02,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,
		0x20,0x60,0x00,0x17,0x21,0x80,0x48,0x02,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,
		0xFE,0xFB,0x83,0x06,0x30,0x40,0x48,0x02,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,
		0x30,0x23,0x02,0x06,0x12,0x70,0x44,0x04,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,
		0x30,0x23,0x42,0x06,0x1A,0x60,0x44,0x04,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,
		0x10,0x31,0x02,0x06,0x0C,0x40,0x44,0x08,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,
		0x18,0x11,0x03,0x06,0x0E,0x60,0x42,0x18,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,
		0x88,0x19,0x03,0x06,0x31,0x60,0xC2,0x30,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
		0xC4,0xCD,0x01,0x86,0xE0,0x61,0x41,0x20,0xE0,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,
		0x00,0x82,0x01,0x36,0x80,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x9F,0xFF,0xFF,0xFF,0x07,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0F,0xFF,0xFF,0xFF,0x01,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0xFF,0x7F,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x0F,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x7F,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	};
	int fp=0;
	long screensize=0;

	char *fbp = 0;

	struct fb_var_screeninfo vinfo;
	struct fb_fix_screeninfo finfo;
	fp = open ("/dev/fb1",O_RDWR);

	if (fp < 0){
		printf("Error : Can not open framebuffer device/n");
		exit(1);
	}

	if (ioctl(fp,FBIOGET_FSCREENINFO,&finfo)){
		printf("Error reading fixed information/n");
		exit(2);
	}

	if (ioctl(fp,FBIOGET_VSCREENINFO,&vinfo)){
		printf("Error reading variable information/n");
		exit(3);
	}

	printf("The mem is :%d\n",finfo.smem_len);
	printf("The line_length is :%d\n",finfo.line_length);
	printf("The xres is :%d\n",vinfo.xres);
	printf("The yres is :%d\n",vinfo.yres);
	printf("bits_per_pixel is :%d\n",vinfo.bits_per_pixel);

	screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
	printf("screensize: %d\n",screensize);
	fbp =(char *) mmap (0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED,
		fp,0);
	if ((int) fbp == -1)
	{
		printf ("Error: failed to map framebuffer device to memory./n");
		exit (4);
	}

	int i=0;
	memset(fbp, 0x00, 1024);
	setTimer(3,0);
	while(1){
		for(i=0;i<1024;i++){
			fbp[ i ]=lichee[ i ];
		}
		setTimer(3,0);
		memset(fbp, 0x00, 1024);
		setTimer(3,0);
	}
	munmap (fbp, screensize);
	close (fp);
}

离线

#6 2017-10-08 16:43:39

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

两个framebuffer可以同时工作了, 使用的是主线代码:  4.13.y 分支





离线

#7 2017-10-08 16:50:40

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

感谢楼主,终于一步一步搞定了 big_smile big_smile

20171008164740.jpg


20171008164750.jpg





离线

#8 2019-03-13 10:08:29

超级萌新
会员
注册时间: 2018-05-04
已发帖子: 408
积分: 407

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

帮顶帮顶

离线

#9 2019-05-16 20:22:14

晕哥小弟
会员
注册时间: 2019-04-04
已发帖子: 309
积分: 299.5

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

晕哥,BSP内核使用oled 可以实现么?这个是主线kernel

离线

#10 2019-05-16 20:23:15

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

晕哥小弟 说:

晕哥,BSP内核使用oled 可以实现么?这个是主线kernel

应该是可以,
实在不行再应用层也可以驱动.





离线

#11 2019-05-16 20:38:44

晕哥小弟
会员
注册时间: 2019-04-04
已发帖子: 309
积分: 299.5

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

1、应用层调用接口是什么?
2、应用层调用I2C去初始化或者显示这样的屏幕的时候,可能会有延时,导致刷新或者更新缓慢。就会给人不像一个正常的产品。

离线

#12 2019-05-16 21:15:38

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

1. 应用程序操作 /dev/i2c-X   /dev/spiX 读写寄存器.
2. 延时应该几乎是一样的, 都是定时器或者应用驱动刷新. 只是驱动实现接口统一.





离线

#13 2019-05-17 11:11:01

Jmhh247
会员
注册时间: 2018-12-21
已发帖子: 262
积分: 262

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

围观学习

离线

#14 2019-05-17 20:01:16

晕哥小弟
会员
注册时间: 2019-04-04
已发帖子: 309
积分: 299.5

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

晕哥 说:

1. 应用程序操作 /dev/i2c-X   /dev/spiX 读写寄存器.
2. 延时应该几乎是一样的, 都是定时器或者应用驱动刷新. 只是驱动实现接口统一.

晕哥,V3S配置I2C模块怎么配置,我看到有其他地方是这样的配置:

[twi0/twi_board0]                                                             
compatible  =                                                 
reg = 0x50                                                                     
;[twi0/twi_board0]                                                             
;compatible        =                                                           
;reg =


但是我用fex2bin转换的时候, /  符号报错,说无效。

离线

#15 2019-05-17 20:05:46

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

http://files.lindeni.org/lindenis-v5/documents/Driver/Sunxi%20I2C总线驱动使用文档.pdf

[twi0/twi_board0]
compatible = "atmel,24c16";
reg = 0x50;


其中:
1.twi0/twi_board0:表示挂在总线 twi0 下的设备 twi_board0;;
2.compatible:表征具体的设备,用于驱动和设备的绑定;
3.reg:设备使用的地址;





离线

#16 2019-05-17 20:14:37

晕哥小弟
会员
注册时间: 2019-04-04
已发帖子: 309
积分: 299.5

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

适用于A64、B100/G102、A20E/V40、T7、H5、V5、H6硬件平台。   这个使用fex2bin 去生成.bin文件的时候,就报  /   这个是个无效字符。

离线

#17 2019-05-17 20:19:37

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

可能是语法解释错误, 试一试

[twi0\/twi_board0]




离线

#18 2019-05-17 20:22:17

晕哥小弟
会员
注册时间: 2019-04-04
已发帖子: 309
积分: 299.5

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

晕哥 说:

可能是语法解释错误, 试一试

[twi0\/twi_board0]

不对。试过了。

离线

#19 2019-05-17 20:42:22

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

晕哥小弟 说:
晕哥 说:

可能是语法解释错误, 试一试

[twi0\/twi_board0]

不对。试过了。

这就有点尴尬了, 只能改 bsp 分析 fex 的源码了, 把斜杠去掉.





离线

#20 2019-05-17 22:08:17

晕哥小弟
会员
注册时间: 2019-04-04
已发帖子: 309
积分: 299.5

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

这个思路不对吧,这样的情况别人应该早就遇到过,可是网络没有搜到相关的信息。你的板卡也是这样么?或者你在不忙的时候也试试使用fex2bin测试下。

离线

#21 2019-05-17 22:10:14

晕哥小弟
会员
注册时间: 2019-04-04
已发帖子: 309
积分: 299.5

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

应该不是我的sunxi-tools版本问题吧。

离线

#22 2020-04-21 22:00:21

raspberryman
会员
注册时间: 2019-12-27
已发帖子: 503
积分: 465

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

这个双屏不错 ^_^

离线

#23 2023-07-05 17:25:08

1028178517
会员
注册时间: 2023-07-05
已发帖子: 1
积分: 1

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

这个芯片如果刷RGB的LCD速度怎么样?

离线

#24 2023-07-06 10:39:23

Lonson
会员
注册时间: 2023-07-06
已发帖子: 2
积分: 2

Re: 开始测试v3s 荔枝派zero 接oled, 请围观.

可以运行QT的程序吗

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn