您尚未登录。

楼主 # 2022-04-04 11:34:12

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

XBOOT F1C100S 修改调试串口

由于调试串口留在了串口2(PE7,PE8),在源码中修改了:
src\arch\arm32\mach-f1c100s\romdisk\boot\sast-kk131.json 519行

	"console-uart@0": {
		"uart-bus": "uart-16550.2"
	}

重新编译,烧录还是没有日志输出:
检查了src\arch\arm32\mach-f1c100s\romdisk\boot\sast-kk131.json

	"uart-16550@0x01c25800": {
		"clock-name": "link-uart2",
		"reset": 86,
		"txd-gpio": 135,
		"txd-gpio-config": 3,
		"rxd-gpio": 136,
		"rxd-gpio-config": 3,
		"baud-rates": 115200,
		"data-bits": 8,
		"parity-bits": 0,
		"stop-bits": 1
	},

GPIO编号貌似也没问题:src\arch\arm32\mach-f1c100s\include\f1c100s-gpio.h

#define F1C100S_GPIOE7			(135)
#define F1C100S_GPIOE8			(136)

又修改了,src\arch\arm32\mach-f1c100s\sys-uart.c,修改后代码如下:

void sys_uart_init(void)
{
	virtual_addr_t addr;
	u32_t val;

	/* Config GPIOE7 and GPIOE8 to txd2 and rxd2 */
	addr = 0x01c20890 + 0x00;
	val = read32(addr);
	val &= ~(0xf << ((7 & 0x7) << 2));
	val |= ((0x3 & 0x7) << ((7 & 0x7) << 2));
	write32(addr, val);

	addr = 0x01c20890 + 0x04;
	val = read32(addr);
	val &= ~(0xf << ((0 & 0x7) << 2));
	val |= ((0x3 & 0x7) << ((0 & 0x7) << 2));
	write32(addr, val);

	/* Open the clock gate for uart0 */
	addr = 0x01c20068;
	val = read32(addr);
	val |= 1 << 22;
	write32(addr, val);

	/* Deassert uart0 reset */
	addr = 0x01c202d0;
	val = read32(addr);
	val |= 1 << 22;
	write32(addr, val);

	/* Config uart0 to 115200-8-1-0 */
	addr = 0x01c25800;
	write32(addr + 0x04, 0x0);
	write32(addr + 0x08, 0x37);
	write32(addr + 0x10, 0x0);
	val = read32(addr + 0x0c);
	val |= (1 << 7);
	write32(addr + 0x0c, val);
	write32(addr + 0x00, 0x36 & 0xff);
	write32(addr + 0x04, (0x36 >> 8) & 0xff);
	val = read32(addr + 0x0c);
	val &= ~(1 << 7);
	write32(addr + 0x0c, val);
	val = read32(addr + 0x0c);
	val &= ~0x1f;
	val |= (0x3 << 0) | (0 << 2) | (0x0 << 3);
	write32(addr + 0x0c, val);
}

void sys_uart_putc(char c)
{
	virtual_addr_t addr = 0x01c25800;

	while((read32(addr + 0x7c) & (0x1 << 1)) == 0);
	write32(addr + 0x00, c);
}

修改后,又出现了新的问题,屏幕啥也不显示了………………
@ 各位大神  有没有遇到类似的问题 求解

离线

楼主 #1 2022-04-04 20:37:39

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

续楼上,继续修改了src\arch\arm32\mach-f1c100s\sast-kk131.c

static void mach_logger(struct machine_t * mach, const char * buf, int count)
{
	#if 0
	virtual_addr_t virt = phys_to_virt(0x01c25000);
	int i;

	for(i = 0; i < count; i++)
	{
		while((read32(virt + 0x14) & (0x1 << 6)) == 0);
		write32(virt + 0x00, buf[i]);
	}
	#else
	virtual_addr_t virt = phys_to_virt(0x01c25800);
	int i;

	for(i = 0; i < count; i++)
	{
		while((read32(virt + 0x7c) & (0x1 << 1)) == 0);
		write32(virt + 0x00, buf[i]);
	}
	#endif
	
}

编译后烧录:
日志终于打印了,启动一半停了,不过显示正常了^^,日志如下:

 _  _ | |___ _____ _____ _| |_
\ \/ /|  _  |  _  |  _  |_   _|  (C) 2007-2022
 )  ( | |_| | |_| | |_| | | |____JIANJUN.JIANG__
/_/\_\|_____|_____|_____| |_____________________|
V3.0.0 (Apr  4 2022 - 05:26:33) - [sast-kk131][SAST KK131 Digital Player Based On Allwinner F1C100S]
[    0.000020]Probe device 'blk-romdisk.0' with blk-romdisk
[    0.000800]Probe device 'hosc' with clk-fixed
[    0.000810]Probe device 'losc' with clk-fixed
[    0.000820]Probe device 'osc32k' with clk-fixed
[    0.000830]Probe device 'pll-cpu' with clk-f1c100s-pll
[    0.000840]Probe device 'pll-audio' with clk-f1c100s-pll
[    0.000850]Probe device 'pll-video' with clk-f1c100s-pll
[    0.000860]Probe device 'pll-ve' with clk-f1c100s-pll
[    0.000870]Probe device 'pll-ddr' with clk-f1c100s-pll
[    0.000880]Probe device 'pll-periph' with clk-f1c100s-pll
[    0.000890]Probe device 'pll-audio-8x' with clk-fixed-factor
[    0.000900]Probe device 'pll-audio-4x' with clk-fixed-factor
[    0.000910]Probe device 'pll-audio-2x' with clk-fixed-factor
[    0.000920]Probe device 'pll-audio-1x' with clk-fixed-factor
[    0.000930]Probe device 'cpu' with clk-mux
[    0.000940]Probe device 'hclk' with clk-divider
[    0.000950]Probe device 'ahb1-pre-div' with clk-divider
[    0.000960]Probe device 'mux-ahb1' with clk-mux
[    0.000970]Probe device 'ahb1' with clk-ratio
[    0.000980]Probe device 'apb1' with clk-ratio
[    0.000990]Probe device 'mux-clkout' with clk-mux
[    0.001000]Probe device 'ratio-clkout' with clk-ratio
[    0.001010]Probe device 'div-clkout' with clk-divider
[    0.001020]Probe device 'gate-clkout' with clk-gate
[    0.001030]Probe device 'link-clkout' with clk-link
[    0.001040]Probe device 'gate-bus-dma' with clk-gate
[    0.001050]Probe device 'link-dma' with clk-link
[    0.001060]Probe device 'gate-bus-uart0' with clk-gate
[    0.001070]Probe device 'gate-bus-uart1' with clk-gate
[    0.001080]Probe device 'gate-bus-uart2' with clk-gate
[    0.001090]Probe device 'link-uart0' with clk-link
[    0.001100]Probe device 'link-uart1' with clk-link
[    0.001110]Probe device 'link-uart2' with clk-link
[    0.001120]Probe device 'gate-bus-i2c0' with clk-gate
[    0.001130]Probe device 'gate-bus-i2c1' with clk-gate
[    0.001140]Probe device 'gate-bus-i2c2' with clk-gate
[    0.001150]Probe device 'link-i2c0' with clk-link
[    0.001160]Probe device 'link-i2c1' with clk-link
[    0.001170]Probe device 'link-i2c2' with clk-link
[    0.001180]Probe device 'gate-bus-spi0' with clk-gate
[    0.001190]Probe device 'gate-bus-spi1' with clk-gate
[    0.001200]Probe device 'link-spi0' with clk-link
[    0.001210]Probe device 'link-spi1' with clk-link
[    0.001220]Probe device 'mux-timer0' with clk-mux
[    0.001230]Probe device 'ratio-timer0' with clk-ratio
[    0.001240]Probe device 'link-timer0' with clk-link
[    0.001250]Probe device 'mux-timer1' with clk-mux
[    0.001260]Probe device 'ratio-timer1' with clk-ratio
[    0.001270]Probe device 'link-timer1' with clk-link
[    0.001280]Probe device 'mux-timer2' with clk-mux
[    0.001290]Probe device 'ratio-timer2' with clk-ratio
[    0.001300]Probe device 'link-timer2' with clk-link
[    0.001310]Probe device 'link-ts' with clk-link
[    0.001320]Probe device 'link-pwm' with clk-link
[    0.001330]Probe device 'link-wdt' with clk-link
[    0.001340]Probe device 'mux-defe' with clk-mux
[    0.001350]Probe device 'div-defe' with clk-divider
[    0.001360]Probe device 'gate-defe' with clk-gate
[    0.001370]Probe device 'gate-bus-defe' with clk-gate
[    0.001380]Probe device 'link-defe' with clk-link
[    0.001390]Probe device 'mux-debe' with clk-mux
[    0.001400]Probe device 'div-debe' with clk-divider
[    0.001410]Probe device 'gate-debe' with clk-gate
[    0.001420]Probe device 'gate-bus-debe' with clk-gate
[    0.001430]Probe device 'link-debe' with clk-link
[    0.001440]Probe device 'mux-tcon' with clk-mux
[    0.001450]Probe device 'gate-tcon' with clk-gate
[    0.001460]Probe device 'gate-bus-tcon' with clk-gate
[    0.001470]Probe device 'link-tcon' with clk-link
[    0.001480]Probe device 'mux-tvd' with clk-mux
[    0.001490]Probe device 'div-tvd' with clk-divider
[    0.001500]Probe device 'gate-tvd' with clk-gate
[    0.001510]Probe device 'gate-bus-tvd' with clk-gate
[    0.001520]Probe device 'link-tvd' with clk-link
[    0.001530]Probe device 'mux-sdmmc0' with clk-mux
[    0.001540]Probe device 'ratio-sdmmc0' with clk-ratio
[    0.001550]Probe device 'div-sdmmc0' with clk-divider
[    0.001560]Probe device 'gate-sdmmc0' with clk-gate
[    0.001570]Probe device 'gate-bus-sdmmc0' with clk-gate
[    0.001580]Probe device 'link-sdmmc0' with clk-link
[    0.001590]Probe device 'mux-sdmmc1' with clk-mux
[    0.001600]Probe device 'ratio-sdmmc1' with clk-ratio
[    0.001610]Probe device 'div-sdmmc1' with clk-divider
[    0.001620]Probe device 'gate-sdmmc1' with clk-gate
[    0.001630]Probe device 'gate-bus-sdmmc1' with clk-gate
[    0.001640]Probe device 'link-sdmmc1' with clk-link
[    0.001650]Probe device 'gate-bus-audio' with clk-gate
[    0.001660]Probe device 'gate-audio' with clk-gate
[    0.001670]Probe device 'link-audio' with clk-link
[    0.001680]Probe device 'reset-f1c100s.0' with reset-f1c100s
[    0.001690]Probe device 'reset-f1c100s.1' with reset-f1c100s
[    0.001700]Probe device 'reset-f1c100s.2' with reset-f1c100s
[    0.001710]Probe device 'irq-f1c100s.0' with irq-f1c100s
[    0.001720]Probe device 'irq-f1c100s-gpio.0' with irq-f1c100s-gpio
[    0.001730]Probe device 'irq-f1c100s-gpio.1' with irq-f1c100s-gpio
[    0.001740]Probe device 'irq-f1c100s-gpio.2' with irq-f1c100s-gpio
[    0.001750]Probe device 'gpio-f1c100s.0' with gpio-f1c100s
[    0.001760]Probe device 'gpio-f1c100s.1' with gpio-f1c100s
[    0.001770]Probe device 'gpio-f1c100s.2' with gpio-f1c100s
[    0.001780]Probe device 'gpio-f1c100s.3' with gpio-f1c100s
[    0.001790]Probe device 'gpio-f1c100s.4' with gpio-f1c100s
[    0.001840]Probe device 'dma-f1c100s.0' with dma-f1c100s
[    0.001850]Probe device 'pwm-f1c100s.0' with pwm-f1c100s
[    0.001860]Probe device 'pwm-f1c100s.1' with pwm-f1c100s
[    0.001870]Probe device 'ce-f1c100s-timer.0' with ce-f1c100s-timer
[    0.000061]Probe device 'cs-f1c100s-timer.0' with cs-f1c100s-timer
[    0.006330]Probe device 'i2c-f1c100s.0' with i2c-f1c100s
[    0.011575]Probe device 'i2c-f1c100s.1' with i2c-f1c100s
[    0.016841]Probe device 'i2c-f1c100s.2' with i2c-f1c100s
[    0.022009]Probe device 'uart-16550.0' with uart-16550
[    0.027096]Probe device 6[    0.032198]Probe device 'uart-16550.2' with uart-16550
[    0.034589]Probe device '

应该串口还是有点问题……

最近编辑记录 Sam (2022-04-04 20:38:35)

离线

楼主 #2 2022-04-04 22:21:27

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

楼上出现的问题是由于更改完串口后与SPI1的引脚定义冲突了,屏蔽了SPI1后启动正常了:

	// "spi-f1c200s@0x01c06000": {
	// 	"clock-name": "link-spi1",
	// 	"reset": 21,
	// 	"sclk-gpio": 137,
	// 	"sclk-gpio-config": 4,
	// 	"mosi-gpio": 136,
	// 	"mosi-gpio-config": 4,
	// 	"miso-gpio": 138,
	// 	"miso-gpio-config": 4,
	// 	"cs-gpio": 135,
	// 	"cs-gpio-config": 4
	// },

启动后的日志:

 _  _ | |___ _____ _____ _| |_
\ \/ /|  _  |  _  |  _  |_   _|  (C) 2007-2022
 )  ( | |_| | |_| | |_| | | |____JIANJUN.JIANG__
/_/\_\|_____|_____|_____| |_____________________|
V3.0.0 (Apr  4 2022 - 06:54:35) - [widora][Widora TINY200 R3 Based On Allwinner F1C200S]
[    0.000020]Probe device 'blk-romdisk.0' with blk-romdisk
[    0.000800]Probe device 'hosc' with clk-fixed
[    0.000810]Probe device 'losc' with clk-fixed
[    0.000820]Probe device 'osc32k' with clk-fixed
[    0.000830]Probe device 'pll-cpu' with clk-f1c200s-pll
[    0.000840]Probe device 'pll-audio' with clk-f1c200s-pll
[    0.000850]Probe device 'pll-video' with clk-f1c200s-pll
[    0.000860]Probe device 'pll-ve' with clk-f1c200s-pll
[    0.000870]Probe device 'pll-ddr' with clk-f1c200s-pll
[    0.000880]Probe device 'pll-periph' with clk-f1c200s-pll
[    0.000890]Probe device 'pll-audio-8x' with clk-fixed-factor
[    0.000900]Probe device 'pll-audio-4x' with clk-fixed-factor
[    0.000910]Probe device 'pll-audio-2x' with clk-fixed-factor
[    0.000920]Probe device 'pll-audio-1x' with clk-fixed-factor
[    0.000930]Probe device 'cpu' with clk-mux
[    0.000940]Probe device 'hclk' with clk-divider
[    0.000950]Probe device 'ahb1-pre-div' with clk-divider
[    0.000960]Probe device 'mux-ahb1' with clk-mux
[    0.000970]Probe device 'ahb1' with clk-ratio
[    0.000980]Probe device 'apb1' with clk-ratio
[    0.000990]Probe device 'mux-clkout' with clk-mux
[    0.001000]Probe device 'ratio-clkout' with clk-ratio
[    0.001010]Probe device 'div-clkout' with clk-divider
[    0.001020]Probe device 'gate-clkout' with clk-gate
[    0.001030]Probe device 'link-clkout' with clk-link
[    0.001040]Probe device 'gate-bus-dma' with clk-gate
[    0.001050]Probe device 'link-dma' with clk-link
[    0.001060]Probe device 'gate-bus-uart0' with clk-gate
[    0.001070]Probe device 'gate-bus-uart1' with clk-gate
[    0.001080]Probe device 'gate-bus-uart2' with clk-gate
[    0.001090]Probe device 'link-uart0' with clk-link
[    0.001100]Probe device 'link-uart1' with clk-link
[    0.001110]Probe device 'link-uart2' with clk-link
[    0.001120]Probe device 'gate-bus-i2c0' with clk-gate
[    0.001130]Probe device 'gate-bus-i2c1' with clk-gate
[    0.001140]Probe device 'gate-bus-i2c2' with clk-gate
[    0.001150]Probe device 'link-i2c0' with clk-link
[    0.001160]Probe device 'link-i2c1' with clk-link
[    0.001170]Probe device 'link-i2c2' with clk-link
[    0.001180]Probe device 'gate-bus-spi0' with clk-gate
[    0.001190]Probe device 'gate-bus-spi1' with clk-gate
[    0.001200]Probe device 'link-spi0' with clk-link
[    0.001210]Probe device 'link-spi1' with clk-link
[    0.001220]Probe device 'mux-timer0' with clk-mux
[    0.001230]Probe device 'ratio-timer0' with clk-ratio
[    0.001240]Probe device 'link-timer0' with clk-link
[    0.001250]Probe device 'mux-timer1' with clk-mux
[    0.001260]Probe device 'ratio-timer1' with clk-ratio
[    0.001270]Probe device 'link-timer1' with clk-link
[    0.001280]Probe device 'mux-timer2' with clk-mux
[    0.001290]Probe device 'ratio-timer2' with clk-ratio
[    0.001300]Probe device 'link-timer2' with clk-link
[    0.001310]Probe device 'link-ts' with clk-link
[    0.001320]Probe device 'link-pwm' with clk-link
[    0.001330]Probe device 'link-wdt' with clk-link
[    0.001340]Probe device 'mux-defe' with clk-mux
[    0.001350]Probe device 'div-defe' with clk-divider
[    0.001360]Probe device 'gate-defe' with clk-gate
[    0.001370]Probe device 'gate-bus-defe' with clk-gate
[    0.001380]Probe device 'link-defe' with clk-link
[    0.001390]Probe device 'mux-debe' with clk-mux
[    0.001400]Probe device 'div-debe' with clk-divider
[    0.001410]Probe device 'gate-debe' with clk-gate
[    0.001420]Probe device 'gate-bus-debe' with clk-gate
[    0.001430]Probe device 'link-debe' with clk-link
[    0.001440]Probe device 'mux-tcon' with clk-mux
[    0.001450]Probe device 'gate-tcon' with clk-gate
[    0.001460]Probe device 'gate-bus-tcon' with clk-gate
[    0.001470]Probe device 'link-tcon' with clk-link
[    0.001480]Probe device 'mux-tvd' with clk-mux
[    0.001490]Probe device 'div-tvd' with clk-divider
[    0.001500]Probe device 'gate-tvd' with clk-gate
[    0.001510]Probe device 'gate-bus-tvd' with clk-gate
[    0.001520]Probe device 'link-tvd' with clk-link
[    0.001530]Probe device 'mux-sdmmc0' with clk-mux
[    0.001540]Probe device 'ratio-sdmmc0' with clk-ratio
[    0.001550]Probe device 'div-sdmmc0' with clk-divider
[    0.001560]Probe device 'gate-sdmmc0' with clk-gate
[    0.001570]Probe device 'gate-bus-sdmmc0' with clk-gate
[    0.001580]Probe device 'link-sdmmc0' with clk-link
[    0.001590]Probe device 'mux-sdmmc1' with clk-mux
[    0.001600]Probe device 'ratio-sdmmc1' with clk-ratio
[    0.001610]Probe device 'div-sdmmc1' with clk-divider
[    0.001620]Probe device 'gate-sdmmc1' with clk-gate
[    0.001630]Probe device 'gate-bus-sdmmc1' with clk-gate
[    0.001640]Probe device 'link-sdmmc1' with clk-link
[    0.001650]Probe device 'gate-bus-audio' with clk-gate
[    0.001660]Probe device 'gate-audio' with clk-gate
[    0.001670]Probe device 'link-audio' with clk-link
[    0.001680]Probe device 'reset-f1c200s.0' with reset-f1c200s
[    0.001690]Probe device 'reset-f1c200s.1' with reset-f1c200s
[    0.001700]Probe device 'reset-f1c200s.2' with reset-f1c200s
[    0.001710]Probe device 'irq-f1c200s.0' with irq-f1c200s
[    0.001720]Probe device 'irq-f1c200s-gpio.0' with irq-f1c200s-gpio
[    0.001730]Probe device 'irq-f1c200s-gpio.1' with irq-f1c200s-gpio
[    0.001740]Probe device 'irq-f1c200s-gpio.2' with irq-f1c200s-gpio
[    0.001750]Probe device 'gpio-f1c200s.0' with gpio-f1c200s
[    0.001760]Probe device 'gpio-f1c200s.1' with gpio-f1c200s
[    0.001770]Probe device 'gpio-f1c200s.2' with gpio-f1c200s
[    0.001780]Probe device 'gpio-f1c200s.3' with gpio-f1c200s
[    0.001790]Probe device 'gpio-f1c200s.4' with gpio-f1c200s
[    0.001840]Probe device 'dma-f1c200s.0' with dma-f1c200s
[    0.001850]Probe device 'pwm-f1c200s.0' with pwm-f1c200s
[    0.001860]Probe device 'pwm-f1c200s.1' with pwm-f1c200s
[    0.001870]Probe device 'ce-f1c200s-timer.0' with ce-f1c200s-timer
[    0.000067]Probe device 'cs-f1c200s-timer.0' with cs-f1c200s-timer
[    0.006380]Probe device 'i2c-f1c200s.0' with i2c-f1c200s
[    0.011808]Probe device 'i2c-f1c200s.1' with i2c-f1c200s
[    0.017239]Probe device 'i2c-f1c200s.2' with i2c-f1c200s
[    0.022567]Probe device 'uart-16550.0' with uart-16550
[    0.027707]Probe device 'uart-16550.1' with uart-16550
6[    0.032850]Probe device 'uart-16550.2' with uart-16550
[    0.038003]Probe device 'spi-f1c200s.0' with spi-f1c200s
[    0.147140]Probe device 'sdhci-f1c200s.0' with sdhci-f1c200s
[    0.152796]Probe device 'audio-f1c200s.0' with audio-f1c200s
[    0.158430]Probe device 'cam-f1c200s-tvd.0' with cam-f1c200s-tvd
[    0.173714]Found spi nor flash 'SFDP' with 16.000MB
[    0.178498]Found partition:
[    0.181274]  0x0000000000000000 ~ 0x0000000000ffffff 16.000MB  - blk-spinor.0
[    0.188402]  0x0000000000000000 ~ 0x00000000003fffff 4.000MB   - blk-spinor.0.xboot
[    0.196015]  0x0000000000400000 ~ 0x0000000000ffffff 12.000MB  - blk-spinor.0.private
[    0.203761]Probe device 'blk-spinor.0' with blk-spinor
[    0.208927]Probe device 'wdg-f1c200s.0' with wdg-f1c200s
[    0.214212]Probe device 'key-f1c200s-lradc.0' with key-f1c200s-lradc
[    0.222482]Fail to probe device with ts-ns2009
[    0.226906]Probe device 'led-pwm-bl.0' with led-pwm-bl
[    0.238567]Probe device 'fb-f1c200s.0' with fb-f1c200s
[    0.243660]Probe device 'console-uart.0' with console-uart
[    0.251337]mount /private with 'ram' filesystem
Press any key to stop auto boot:  0.000
xboot: /#

终于可以进行下一步了:触摸校准。。。
新的问题又产生了:
1.如何不用修改设备树,而选择行加载驱动?
2.触摸如何校准?

离线

楼主 #3 2022-04-05 20:51:27

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

继续:
参考了XBOOT大神的 https://whycan.com/t_6896.html
命令行中输入

tscal fb-f1c200s ts-f1c200s

成功出现了校准点,可惜遗憾的是触摸效果不是很好,庆幸的是可以校准了^^;

另外发现,运行XBOOT里面自带的LUA应用程序好慢,输入完命令需要等几秒才显示,而且触摸超级卡顿,所幸直接不要LUA功能了
在makefile里做了裁剪

#
# Configurable advanced custom components
#
CFG_FRAMEWORK	?= n
CFG_CAIRO		?= n
CFG_WBOXTEST 	?= n

日志末尾显示

[    0.254008]mount /private with 'ram' filesystem
Press any key to stop auto boot:  0.000
 could not found 'launcher' command

命令行输入

overview

显示速度跟LUA简直不是一个级别的。。。

离线

楼主 #4 2022-04-05 20:58:55

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

离线

楼主 #5 2022-04-07 21:55:03

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

关于校准的问题,上传两个视频,大佬看到帮忙分析:
1.src\arch\arm32\mach-f1c200s\driver\ts-f1c200s.c 不做任何修改的测试

2.src\arch\arm32\mach-f1c200s\driver\ts-f1c200s.c 加了一行printf("%d\r\n",val);
代码如下:

static void ts_f1c100s_interrupt(void * data)
{
	struct input_t * input = (struct input_t *)(data);
	struct ts_f1c100s_pdata_t * pdat = (struct ts_f1c100s_pdata_t *)input->priv;
	u32_t val;
	int x = 0, y = 0;

	val = read32(pdat->virt + TP_INT_FIFOS);
	printf("%d\r\n",val);
	if(val & TP_DOWN_PENDING)
	{
		if(!pdat->press)
		{
		}
	}
	if(val & TP_UP_PENDING)
	{
		pdat->press = 0;
		pdat->ignore_fifo_data = 1;
		tsfilter_clear(pdat->filter);
		push_event_touch_end(input, pdat->x, pdat->y, 0);
	}
	if(val & FIFO_DATA_PENDING)
	{
		y = read32(pdat->virt + TP_DATA);
		x = read32(pdat->virt + TP_DATA);

		if(!pdat->ignore_fifo_data)
		{
			tsfilter_update(pdat->filter, &x, &y);

			if(!pdat->press)
			{
				push_event_touch_begin(input, x, y, 0);
				pdat->press = 1;
			}
			else
			{
				if((pdat->x != x) || (pdat->y != y))
				{
					push_event_touch_move(input, x, y, 0);
				}
			}
			pdat->x = x;
			pdat->y = y;
		}
		else
		{
			pdat->ignore_fifo_data = 0;
		}
	}
	write32(pdat->virt + TP_INT_FIFOS, val);
}

疑问简单的加了一句打印函数,结果校准就边得非常灵敏,不改动则感觉响应的非常慢,大佬们 帮忙分析分析,
还有一问:校准完怎样才能保存校准参数,再第二次开机后还能继续使用校准过的参数。。。

最近编辑记录 Sam (2022-04-07 22:04:35)

离线

楼主 #6 2022-04-08 21:49:43

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

续上帖:
在触摸中断函数中加上打印函数src\arch\arm32\mach-f1c200s\driver\ts-f1c200s.c:

static void ts_f1c100s_interrupt(void * data)
{
	struct input_t * input = (struct input_t *)(data);
	struct ts_f1c100s_pdata_t * pdat = (struct ts_f1c100s_pdata_t *)input->priv;
	u32_t val;
	int x = 0, y = 0;

	val = read32(pdat->virt + TP_INT_FIFOS);
	//printf("%d\r\n",val);
	if(val & TP_DOWN_PENDING)
	{
		if(!pdat->press)
		{
		}
	}
	if(val & TP_UP_PENDING)
	{
		pdat->press = 0;
		pdat->ignore_fifo_data = 1;
		tsfilter_clear(pdat->filter);
		push_event_touch_end(input, pdat->x, pdat->y, 0);
	}
	if(val & FIFO_DATA_PENDING)
	{
		y = read32(pdat->virt + TP_DATA);
		x = read32(pdat->virt + TP_DATA);
		printf("x = %d,y = %d\r\n",x,y);
		if(!pdat->ignore_fifo_data)
		{
			tsfilter_update(pdat->filter, &x, &y);

			if(!pdat->press)
			{
				push_event_touch_begin(input, x, y, 0);
				pdat->press = 1;
			}
			else
			{
				if((pdat->x != x) || (pdat->y != y))
				{
					push_event_touch_move(input, x, y, 0);
				}
			}
			pdat->x = x;
			pdat->y = y;
		}
		else
		{
			pdat->ignore_fifo_data = 0;
		}
	}
	write32(pdat->virt + TP_INT_FIFOS, val);
}

触摸时,屏幕可以正常的输出AD采样值,中断响应速度正常,但是屏幕的反应任然比较慢!截取日志中间一段如下,猜测问题应该处在应用程序响应上了,继续摸索

x = 432,y = 559
x = 432,y = 559
x = 432,y = 560
x = 432,y = 560
x = 432,y = 561
x = 433,y = 561
x = 433,y = 561
x = 433,y = 561
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 560
x = 433,y = 559
x = 433,y = 559
x = 433,y = 559
x = 433,y = 560
x = 434,y = 561
x = 434,y = 561
x = 434,y = 562
x = 434,y = 562
x = 434,y = 562
x = 434,y = 562
x = 434,y = 562
x = 434,y = 561
x = 434,y = 561
x = 434,y = 562
x = 434,y = 561
x = 434,y = 562
x = 434,y = 562
x = 434,y = 562
x = 435,y = 561
x = 435,y = 562
x = 435,y = 561
x = 435,y = 562
x = 435,y = 562
x = 435,y = 562
x = 435,y = 562
x = 435,y = 563
x = 435,y = 564
x = 435,y = 565
x = 436,y = 566
x = 436,y = 567
x = 436,y = 568
x = 436,y = 569
x = 436,y = 570
x = 436,y = 570
x = 436,y = 571
x = 436,y = 570
x = 436,y = 570
x = 437,y = 571
x = 437,y = 572

最近编辑记录 Sam (2022-04-08 21:55:48)

离线

楼主 #7 2022-04-09 09:58:43

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

续上贴:
在src\kernel\command\cmd-tscal.c 169行添加了日志打印:

printf("%d\r\n",(int)e.type);

发现每次屏幕按下和保持响应都比较快,但是抬起后会等带一段时间,也就是说抬起后要经过一段时间才能运行到:

case EVENT_TYPE_TOUCH_END:
						cal.x[cal.index] = e.e.touch_end.x;
						cal.y[cal.index] = e.e.touch_end.y;
						if(++cal.index >= 5)
						{
							if(perform_calibration(&cal))
							{
								input_ioctl(dev, "touchscreen-set-calibration", &cal.a[0]);
								printf("[%d, %d, %d, %d, %d, %d, %d]\r\n", cal.a[0], cal.a[1], cal.a[2], cal.a[3], cal.a[4], cal.a[5], cal.a[6]);
								running = 0;
							}
							else
							{
								cal.index = 0;
							}
						}
						break;

日志是这样的:

1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1025
1026

1024代表按下、1025代表保持、1026代表抬起,在这里定义:src\include\xboot\event.h

enum event_type_t {
	EVENT_TYPE_KEY_DOWN					= 0x0100,
	EVENT_TYPE_KEY_UP					= 0x0101,

	EVENT_TYPE_ROTARY_TURN				= 0x0200,

	EVENT_TYPE_MOUSE_DOWN				= 0x0300,
	EVENT_TYPE_MOUSE_MOVE				= 0x0301,
	EVENT_TYPE_MOUSE_UP					= 0x0302,
	EVENT_TYPE_MOUSE_WHEEL				= 0x0303,

	EVENT_TYPE_TOUCH_BEGIN				= 0x0400,
	EVENT_TYPE_TOUCH_MOVE				= 0x0401,
	EVENT_TYPE_TOUCH_END				= 0x0402,

	EVENT_TYPE_JOYSTICK_LEFTSTICK		= 0x0500,
	EVENT_TYPE_JOYSTICK_RIGHTSTICK		= 0x0501,
	EVENT_TYPE_JOYSTICK_LEFTTRIGGER		= 0x0502,
	EVENT_TYPE_JOYSTICK_RIGHTTRIGGER	= 0x0503,
	EVENT_TYPE_JOYSTICK_BUTTONDOWN		= 0x0504,
	EVENT_TYPE_JOYSTICK_BUTTONUP		= 0x0505,

	EVENT_TYPE_SYSTEM_EXIT				= 0x1000,
};

大概可能是由于触摸的数据在传递到cmd命令处理函数这边的时间有点长,或是有丢数据的可能,或者屏幕松开后没再次进入中断,纯属猜测。。。

最近编辑记录 Sam (2022-04-09 10:29:10)

离线

楼主 #8 2022-04-09 10:50:35

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

续上贴:
在触摸中断处理函数中加入日志打印:src\arch\arm32\mach-f1c200s\driver\ts-f1c200s.c

	if(val & TP_UP_PENDING)
	{
		printf("val & TP_UP_PENDING\r\n");
		pdat->press = 0;
		pdat->ignore_fifo_data = 1;
		tsfilter_clear(pdat->filter);
		push_event_touch_end(input, pdat->x, pdat->y, 0);
	}

中断处理,测试都OK,每一次触摸都能成功进入并打印,但是校准界面不一定更新,也就是说执行下面的函数后,在校准的函数里没有检测到触摸事件的发生。

push_event_touch_end(input, pdat->x, pdat->y, 0);

还有一个奇怪的问题,加入打印函数后,校准成功的概率明显提升了

最近编辑记录 Sam (2022-04-09 11:03:15)

离线

楼主 #9 2022-04-09 14:29:33

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

续上贴,在src\kernel\core\event.c 中加入打印日志,删除之前所有的日志打印(由于加入打印日志,效果也会改善,避免干扰,故删除其他的)

void push_event_touch_end(void * device, s32_t x, s32_t y, u32_t id)
{
	struct event_t e;

	e.device = device;
	e.type = EVENT_TYPE_TOUCH_END;
	e.e.touch_end.x = x;
	e.e.touch_end.y = y;
	e.e.touch_end.id = id;
	push_event(&e);
	printf("%d\r\n",(int)e.type);
}

添加后问题基本,测试多次,都OK,打印日志如下:

xboot: /# tscal fb-f1c200s.0 ts-f1c200s.0
1026
1026
1026
1026
1026
[23, 13259, -962672, 10512, 12, -2707748, 65536]
xboot: /# tscal fb-f1c200s.0 ts-f1c200s.0
1026
1026
1026
1026
1026
[67, 13208, -761848, 10452, -85, -2029674, 65536]
xboot: /# tscal fb-f1c200s.0 ts-f1c200s.0
1026
1026
1026
1026
1026
[41, 13200, -578824, 10400, -43, -2319552, 65536]
xboot: /# tscal fb-f1c200s.0 ts-f1c200s.0
1026
1026
1026
1026
1026
[135, 13038, -433968, 10462, 51, -2800992, 65536]
xboot: /# tscal fb-f1c200s.0 ts-f1c200s.0
1026
1026
1026
1026
1026

视频如下:

感觉问题应该出在了时间未触发成功,加入打印日志,这个现象得到了改善,将日志打印改一些没用的代码,就像这样:

void push_event_touch_end(void * device, s32_t x, s32_t y, u32_t id)
{
	struct event_t e;

	e.device = device;
	e.type = EVENT_TYPE_TOUCH_END;
	e.e.touch_end.x = x;
	e.e.touch_end.y = y;
	e.e.touch_end.id = id;

	push_event(&e);

	e.device = device;
	e.type = EVENT_TYPE_TOUCH_END;
	e.e.touch_end.x = x;
	e.e.touch_end.y = y;
	e.e.touch_end.id = id;
	//printf("%d\r\n",(int)e.type);
}

效果还是不错的,多次测试还是OK的,虽然我也不想这样改,其他也不会啊。。。

离线

楼主 #10 2022-04-09 15:05:53

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

这样改貌似合理一点,(由于汇编是个小白,不知道对不对,大神看到请指正),经过反复测试都OK:

void push_event_touch_end(void * device, s32_t x, s32_t y, u32_t id)
{
	struct event_t e;
	int temp,ret;
	__asm__ volatile("MRS %0, CPSR\n"
					 "ORR %1, %0, #0xC0\n"
					 "MSR CPSR, %1":"=r"(ret),"=r"(temp)::"memory");
	e.device = device;
	e.type = EVENT_TYPE_TOUCH_END;
	e.e.touch_end.x = x;
	e.e.touch_end.y = y;
	e.e.touch_end.id = id;

	push_event(&e);
	__asm__ volatile("MSR CPSR,%0"::"r"(ret): "memory");
}

离线

楼主 #11 2022-04-10 21:49:37

Sam
会员
注册时间: 2019-12-06
已发帖子: 55
积分: 60

Re: XBOOT F1C100S 修改调试串口

关于上帖提出的问题说明:
由于今天在学习源代码时看到了src\include\xconfigs.h 这个文件,里面有个宏定义:

#if !defined(CONFIG_EVENT_FIFO_SIZE)
#define CONFIG_EVENT_FIFO_SIZE				(64)
#endif

突然想到了,触摸校准的问题是不是跟这个也有关系,所以将64 改为了 128,实验结果是每个点的响应速度还是慢,但是成功率还是有明显提升的,现在彻底蒙了,上贴由于涉及到源码的修改,现在又改了回去。往高人解答

离线

#12 2024-03-29 16:49:21

loveme758
会员
注册时间: 2021-01-25
已发帖子: 17
积分: 0.5

Re: XBOOT F1C100S 修改调试串口

最终调好了吗?能存储校准信息了吗?我现在是同样问题

离线

页脚

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

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