Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页
    1. Home
    2. zznzzn
    • Profile
    • Following 1
    • Followers 1
    • my integral 2780
    • Topics 41
    • Posts 55
    • Best 2
    • Groups 0

    zznzznLV 6

    @zznzzn

    2780
    integral
    3
    Reputation
    23
    Profile views
    55
    Posts
    1
    Followers
    1
    Following
    Joined Last Online

    zznzzn Unfollow Follow

    Best posts made by zznzzn

    • T113上uart转485功能实现

      sunxi-uart.c
      sunxi-uart.h

      如下是T113在linux下实现uart转485,patch可以参考附件,dts的配置如下:

      uart1: uart@05000400 {
      		status = "okay";
      		uart1_type = <2>;
      		uart1_rs485=<1>;
      		uart1_485fl=<0>;
      		uart1_485oe=<&pio PG 1 1 0xffffffff 0xffffffff 0>;
      	};
      

      patch如下:

      diff --git a/arch/arm/boot/dts/sun8iw20p1.dtsi b/arch/arm/boot/dts/sun8iw20p1.dtsi
      index 6e51b72..4d3fb29 100644
      --- a/arch/arm/boot/dts/sun8iw20p1.dtsi
      +++ b/arch/arm/boot/dts/sun8iw20p1.dtsi
      @@ -613,8 +613,11 @@
       			clock-names = "uart1";
       			resets = <&ccu RST_BUS_UART1>;
       			uart1_port = <1>;
      -			uart1_type = <4>;
      +			uart1_type = <2>;
       			status = "okay";
      +			uart1_rs485=<1>;
      +			uart1_485fl=<0>;
      +			uart1_485oe=<&pio PG 1 1 0xffffffff 0xffffffff 0>;			
       		};
       
       		uart2: uart@2500800 {
      diff --git a/drivers/tty/serial/sunxi-uart.c b/drivers/tty/serial/sunxi-uart.c
      index 395b1bd..f013ad2 100644
      --- a/drivers/tty/serial/sunxi-uart.c
      +++ b/drivers/tty/serial/sunxi-uart.c
      @@ -43,6 +43,10 @@
       #include <linux/of.h>
       #include <linux/of_irq.h>
       #include <linux/of_address.h>
      +
      +#include <linux/delay.h>
      +#include <uapi/linux/sched/types.h>
      +#include <linux/of_gpio.h>
       #include "sunxi-uart.h"
       
       #if defined(CONFIG_SERIAL_SUNXI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
      @@ -191,6 +195,28 @@ static inline void sw_uart_disable_ier_thri(struct uart_port *port)
       	}
       }
       
      +
      +/********************************************************************/
      +/* cet,liudachuan: rs485 delayed rts release control, not used now */
      +# if 0
      +static enum hrtimer_restart uart_set_rs485(struct hrtimer *u_timer)
      +{
      +	struct sw_uart_port *sw_uport = container_of(u_timer, struct sw_uart_port, uart_timer);
      +	if(sw_uport == NULL)
      +	{
      +		SERIAL_DBG("faile to get sw_uport\n", __func__);
      +		return HRTIMER_NORESTART;
      +	}
      +	
      +	if(sw_uport->rs485_en){
      +		gpio_direction_output(sw_uport->rs485oe_io.gpio, sw_uport->rs485_fl);
      +	}
      +
      +	return HRTIMER_NORESTART;
      +}
      +#endif
      +/***********************************************************************************/
      +
       static unsigned int sw_uart_handle_rx(struct sw_uart_port *sw_uport, unsigned int lsr)
       {
       	unsigned char ch = 0;
      @@ -272,23 +298,66 @@ static unsigned int sw_uart_handle_rx(struct sw_uart_port *sw_uport, unsigned in
       	return lsr;
       }
       
      +
      +
      +/******************************************************************************/
      +/* cet,liudachuan: add sw-rs485 support */
      +#define BITS_PER_SERIAL_BYTE	10
      +#define NANOSECOND_PER_USECONDS	1000
      +#define USECONDS_PER_SECOND		1000000
      +static void sw_uart_rs485_cal_tout(struct uart_port *port, unsigned int lcr)
      +{
      +	struct sw_uart_port *sw_uport = UART_TO_SPORT(port);
      +	unsigned int bits_per_byte;
      +	if (lcr & SUNXI_UART_LCR_PARITY) /*有奇偶的时候,byte=start+8+parity=10*/
      +		bits_per_byte = 10;
      +	else    /*无奇偶的时候,byte=start+8=9*/
      +		bits_per_byte = 9;
      +
      +	if (sw_uport->baud != 0) {
      +		sw_uport->tout = 
      +			(bits_per_byte * USECONDS_PER_SECOND) / (sw_uport->baud) * NANOSECOND_PER_USECONDS;
      +	}
      +	else {
      +		sw_uport->tout = 0;
      +	}
      +}
      +
       static void sw_uart_stop_tx(struct uart_port *port)
       {
      -#if IS_ENABLED(CONFIG_SERIAL_SUNXI_DMA)
       	struct sw_uart_port *sw_uport = UART_TO_SPORT(port);
      +
      +#if IS_ENABLED(CONFIG_SERIAL_SUNXI_DMA)
       	struct sw_uart_dma *uart_dma = sw_uport->dma;
       
       	if (uart_dma->use_dma & TX_DMA)
       		sw_uart_stop_dma_tx(sw_uport);
       #endif
       	sw_uart_disable_ier_thri(port);
      +	/* cet,liudachuan: delay 1 byte transmit time then turn off rs485 tx-en */
      +	if (sw_uport->rs485_en) {
      +	   	// hrtimer_start(&sw_uport->uart_timer, sw_uport->tout, HRTIMER_MODE_REL);
      +		unsigned char lsr = 0;
      +		while ((lsr & SUNXI_UART_LSR_BOTH_EMPTY) != SUNXI_UART_LSR_BOTH_EMPTY) {
      +			// cpu_relax();
      +			udelay(10);
      +			lsr = serial_in(port, SUNXI_UART_LSR);
      +		};
      +		gpio_direction_output(sw_uport->rs485oe_io.gpio, sw_uport->rs485_fl);
      +	}
       }
       
       static void sw_uart_start_tx(struct uart_port *port)
       {
      -#if IS_ENABLED(CONFIG_SERIAL_SUNXI_DMA)
       	struct sw_uart_port *sw_uport = UART_TO_SPORT(port);
      +	/* cet,liudachuan: rs485 rts = 1 */
      +	// serial_out(port, sw_uport->mcr & (~SUNXI_UART_MCR_RTS), SUNXI_UART_MCR);
      +	if(sw_uport->rs485_en){
      +		// udelay(20);
      +		gpio_direction_output(sw_uport->rs485oe_io.gpio, !sw_uport->rs485_fl);
      +	}
       
      +#if IS_ENABLED(CONFIG_SERIAL_SUNXI_DMA)
       	if (!((sw_uport->dma->use_dma & TX_DMA) && sw_uport->dma->tx_dma_used))
       #endif
       		sw_uart_enable_ier_thri(port);
      @@ -342,8 +411,14 @@ static void sw_uart_handle_tx(struct sw_uart_port *sw_uport)
       		uart_write_wakeup(&sw_uport->port);
       		spin_lock(&sw_uport->port.lock);
       	}
      -	if (uart_circ_empty(xmit))
      -		sw_uart_stop_tx(&sw_uport->port);
      +
      +	/* cet,liudachuan: add sw-rs485 support */
      +	// if (uart_circ_empty(xmit))
      +	//     sw_uart_stop_tx(&sw_uport->port);
      +	if (!sw_uport->rs485_en) {
      +		if (uart_circ_empty(xmit))
      +			sw_uart_stop_tx(&sw_uport->port);
      +	}
       }
       
       static unsigned int sw_uart_modem_status(struct sw_uart_port *sw_uport)
      @@ -354,7 +429,7 @@ static unsigned int sw_uart_modem_status(struct sw_uart_port *sw_uport)
       	sw_uport->msr_saved_flags = 0;
       
       	if (status & SUNXI_UART_MSR_ANY_DELTA && sw_uport->ier & SUNXI_UART_IER_MSI &&
      -	    sw_uport->port.state != NULL) {
      +		sw_uport->port.state != NULL) {
       		if (status & SUNXI_UART_MSR_TERI)
       			sw_uport->port.icount.rng++;
       		if (status & SUNXI_UART_MSR_DDSR)
      @@ -724,6 +799,25 @@ static enum hrtimer_restart sw_uart_report_dma_rx(struct hrtimer *rx_hrtimer)
       
       #endif
       
      +
      +
      +/**
      + * 串口中断实测14-135us,数据发完后gic_handle_irq两次进入中断,第二次才真正进入串口中断,导致整个延迟变大
      + * 通过提高中断线程优先级为4以上,可以解决,时间缩短到(-5-35us),这里优先级设置为1
      + * cet,ljt 2021.10
      +*/
      +static inline void sw_uart_irq_set_pri(struct sw_uart_port *sw_uport)
      +{
      +    struct sched_param param = { .sched_priority = MAX_USER_RT_PRIO - 2 };
      +	if (sw_uport->irq_pri_promoted)
      +		return;
      +	if (sched_setscheduler(current, SCHED_FIFO, &param) < 0)
      +	{
      +		SERIAL_MSG("sched_setscheduler set error\n");
      +	}
      +	sw_uport->irq_pri_promoted = 1;
      +}
      +
       static irqreturn_t sw_uart_irq(int irq, void *dev_id)
       {
       	struct uart_port *port = dev_id;
      @@ -731,6 +825,9 @@ static irqreturn_t sw_uart_irq(int irq, void *dev_id)
       	unsigned int iir = 0, lsr = 0;
       	unsigned long flags;
       
      +	/* if we hasn't promote the irq priority, set priority to 97 */
      +	//sw_uart_irq_set_pri(sw_uport);
      +
       	spin_lock_irqsave(&port->lock, flags);
       
       	iir = serial_in(port, SUNXI_UART_IIR) & SUNXI_UART_IIR_IID_MASK;
      @@ -1072,7 +1169,7 @@ static void sw_uart_flush_buffer(struct uart_port *port)
       }
       
       static void sw_uart_set_termios(struct uart_port *port, struct ktermios *termios,
      -			    struct ktermios *old)
      +				struct ktermios *old)
       {
       	struct sw_uart_port *sw_uport = UART_TO_SPORT(port);
       	unsigned long flags;
      @@ -1119,6 +1216,12 @@ static void sw_uart_set_termios(struct uart_port *port, struct ktermios *termios
       	dlh = quot >> 8;
       	SERIAL_DBG("set baudrate %d, quot %d\n", baud, quot);
       
      +	/* cet,liudachuan: add sw rs485 support */
      +	sw_uport->baud = baud;
      +	if (sw_uport->rs485_en) {
      +		sw_uart_rs485_cal_tout(port, lcr);
      +	}
      +
       	spin_lock_irqsave(&port->lock, flags);
       	uart_update_timeout(port, termios->c_cflag, baud);
       
      @@ -1379,7 +1482,7 @@ static int sw_uart_ioctl(struct uart_port *port, unsigned int cmd,
       }
       
       static void sw_uart_pm(struct uart_port *port, unsigned int state,
      -		      unsigned int oldstate)
      +			  unsigned int oldstate)
       {
       #if IS_ENABLED(CONFIG_EVB_PLATFORM)
       	int ret;
      @@ -1727,7 +1830,7 @@ static void sw_console_putchar(struct uart_port *port, int c)
       }
       
       static void sw_console_write(struct console *co, const char *s,
      -			      unsigned int count)
      +				  unsigned int count)
       {
       	struct uart_port *port = NULL;
       	struct sw_uart_port *sw_uport;
      @@ -1909,6 +2012,9 @@ static int sw_uart_probe(struct platform_device *pdev)
       	char uart_para[16] = {0};
       	const char *uart_string;
       	int ret = -1;
      +	int rs485_en = 0;         //2020.09.24 2¨??? ¨?¨a?¨?RS485????
      +	int rs485_fl = 0;
      +
       	struct device_node *apk_np = of_find_node_by_name(NULL, "auto_print");
       	const char *apk_sta = NULL;
       #if IS_ENABLED(CONFIG_SERIAL_SUNXI_DMA)
      @@ -2052,6 +2158,45 @@ static int sw_uart_probe(struct platform_device *pdev)
       	else
       		sw_uport->card_print = false;
       
      +	/* cet,liudachuan: add sw-rs485 support */
      +	/************ Modify by wangshunfan @2021.01.11 for this part *************/
      +	/* Get rs485 enable flag */
      +	snprintf(uart_para, sizeof(uart_para), "uart%d_rs485", pdev->id);
      +	ret = of_property_read_u32(np, uart_para, &rs485_en);
      +	if (ret) {
      +		SERIAL_MSG("error to get uart%d_rs485\n", pdev->id);
      +			rs485_en = 0;
      +	}
      +	sw_uport->rs485_en = rs485_en;
      +
      +	//SERIAL_DBG("caid rs485_en = %d port = %d", rs485_en, pdev->id);
      +	if (sw_uport->rs485_en) {
      +		snprintf(uart_para, sizeof(uart_para), "uart%d_485fl", pdev->id);
      +		ret = of_property_read_u32(np, uart_para, &rs485_fl);
      +		if (ret) {
      +			SERIAL_MSG("error to get tuart%d_rs485\n", pdev->id);
      +				rs485_fl = 0;
      +		}
      +		sw_uport->rs485_fl = rs485_fl;
      +
      +		/* Get rs485 enable control pin, request and init gpio */
      +		snprintf(uart_para, sizeof(uart_para), "uart%d_485oe", pdev->id);
      +		sw_uport->rs485oe_io.gpio = of_get_named_gpio_flags(np, uart_para, 0,
      +			(enum of_gpio_flags *)(&(sw_uport->rs485oe_io)));
      +		if (gpio_is_valid(sw_uport->rs485oe_io.gpio)){
      +			gpio_request(sw_uport->rs485oe_io.gpio, NULL);
      +			gpio_direction_output(sw_uport->rs485oe_io.gpio, sw_uport->rs485_fl);
      +		}
      +
      +		/* Init hrtimer for rs485 and set timeout callback function */
      +		// hrtimer_init(&sw_uport->uart_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
      +		// sw_uport->uart_timer.function = uart_set_rs485;
      +
      +		sw_uport->irq_pri_promoted = 0;
      +		SERIAL_MSG("uart%d rs485 enabled\n", pdev->id);
      +	}
      +	/**************** end of modify by wangshunfan for this part ****************/
      +
       	pdata->used = 1;
       	port->iotype = UPIO_MEM;
       	port->type = PORT_SUNXI;
      @@ -2129,7 +2274,14 @@ static int sw_uart_remove(struct platform_device *pdev)
       	struct sw_uart_port *sw_uport = platform_get_drvdata(pdev);
       
       	SERIAL_DBG("release uart%d port\n", sw_uport->id);
      -#if IS_ENABLED(CONFIG_SERIAL_SUNXI_DMA)
      +
      +	/* cet,liudachuan: add sw-rs485 support */
      +	if (sw_uport->rs485_en) {
      +		gpio_free(sw_uport->rs485oe_io.gpio);	/* free gpio of rs485 */
      +		// hrtimer_cancel(&sw_uport->uart_timer);	/* canel hrtimer      */
      +	}
      +
      +#ifdef CONFIG_SERIAL_SUNXI_DMA
       	sw_uart_release_dma_tx(sw_uport);
       	sw_uart_release_dma_rx(sw_uport);
       #endif
      diff --git a/drivers/tty/serial/sunxi-uart.h b/drivers/tty/serial/sunxi-uart.h
      index 565acbf..ab096d6 100644
      --- a/drivers/tty/serial/sunxi-uart.h
      +++ b/drivers/tty/serial/sunxi-uart.h
      @@ -22,6 +22,8 @@
       #include <linux/dmaengine.h>
       #include <linux/reset.h>
       //include <linux/serial_core.h>
      +#include <linux/ktime.h>
      +#include <linux/sunxi-gpio.h>
       
       /* SUNXI UART PORT definition*/
       #define PORT_MAX_USED	PORT_LINFLEXUART  /* see include/uapi/linux/serial_core.h */
      @@ -106,6 +108,16 @@ struct sw_uart_port {
       	struct serial_rs485 rs485conf;
       	bool card_print;
       	bool throttled;
      +
      +    /* cet,liudachuan: add rs485 support(not hardware's rs485) */
      +    struct gpio_config rs485oe_io;
      +    unsigned int rs485_en;
      +    unsigned int rs485_fl;
      +    struct hrtimer uart_timer;
      +    unsigned int baud;
      +    int irq_pri_promoted;
      +    /* Added by wangshunfan @2021.01.11 for hrtimer timeout */
      +	ktime_t tout;
       };
       
       /* register offset define */
      @@ -191,6 +203,8 @@ struct sw_uart_port {
       #define SUNXI_UART_LSR_OE         (BIT(1))
       #define SUNXI_UART_LSR_DR         (BIT(0))
       #define SUNXI_UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */
      +/* cet,liudachuan: add BOTH_EMPTY macro */
      +#define SUNXI_UART_LSR_BOTH_EMPTY   (SUNXI_UART_LSR_TEMT | SUNXI_UART_LSR_THRE)
       /* Modem Status Register */
       #define SUNXI_UART_MSR_DCD        (BIT(7))
       #define SUNXI_UART_MSR_RI         (BIT(6))
      
      posted in D1系列-RISC-V
      zznzzn
      zznzzn
    • 如何给R128在FreeRTOS下配置/data目录

      在调试音频、usb等模块时,会发现SDK的根目录下没有/data该目录,导致无法存储所需要的文件,这就是因为/data目录没有配置好的原因。

      1、选上配置

      首先需要选上的配置:
      运行mrtos_menuconfig,选上COMPONENT_LITTLEFS

      -> System components
          -> thirdparty components
              [*] LittleFS Filesystem
      

      选上littlefs只是支持了这个功能,另外还需要对分区进行配置。

      2、确认分区表

      通过命令cconfigs,跳转到方案配置目录,找到文件sys_partition.fex

      这里需要注意,目录下可能会有多个分区文件,带着不同后缀的,比如说nor,xip等等的,因此需要确认用的是哪一个分区表,以免修改不生效

      在方案已经编译完成之后,运行

      pack
      

      命令对方案进行打包,通过打包时打印出来的log信息,可以提取到用的是哪一个分区表,如下:

      download1FileByUrl.png

      如图片,可以确认到打包示例中调用的分区表。

      3、修改分区表

      在分区表中加入以下配置代码:

      [partition]
          name         = UDISK
          downloadfile = "data_udisk.fex"
          user_type    = 0x8100
      

      通过上述的代码,在打包固件调用的pack_img.sh脚本中,通过函数

      function make_data_image()
      

      会创建对应的分区。

      4、挂载目录

      分区已经建好的话,剩下就是通过littlefs将区分挂载到目录下了。

      在方案的main.c函数中(这里只是举个例子,在系统启动时挂载目录即可,但是需要注意要在flash初始化完成之后才能挂载)

      在main.c中,添加以下代码:

      littlefs_mount("/dev/UDISK", "/data", true);
      

      /dev/UDISK就是分区名字,由分区表产生的。
      /data则是创建目录的名字及路径。

      通过以上步骤,即可为方案新建一个/data目录,可以用于保存一些程序所需要用到的文件。

      5、保存文件到data目录下

      1.在SDK编译环境中存放文件
      可以在编译时,所需要的文件放到UDISK分区。

      存放文件到UDISK分区方法为:

      直接将文件拷贝到编译环境对应的路径下:

      {root_dir}/board/芯片名/方案名/data/UDISK
      

      在SDK打包时就会将UDISK目录下的文件全部打包生成udisk的镜像,最终打包到image里。

      在烧录时,就会udisk的镜像烧录到对应的分区里。系统启动,挂载分区之后,就直接可以通过/data目录访问到对应的文件了。

      2.通过代码读写文件
      FreeRTOS SDK中,通过fopen fwrite fread等POSIX接口,即可操作UDISK分区(/data目录)的文件。

      以下做个示例:

      static int save_to_file(void *str, void *start, int length)
      {
              FILE *fp = NULL;
      
              fp = fopen(str, "wb+"); //save more frames
              if (!fp) {
                      printf(" Open %s error\n", (char *)str);
      
                      return -1;
              }
      
              if (fwrite(start, length, 1, fp)) {
                      fclose(fp);
      
                      return 0;
              } else {
                      printf(" Write file fail (%s)\n", strerror(errno));
                      fclose(fp);
      
                      return -1;
              }
      
              return 0;
      }
      
      • str: 路径名,若为/data目录的话,比如说写入一个a.txt,str可以定义为 /data/a.txt
      • start:所需要写入的数据起始地址
      • length:所需要写的数据的长度。
      posted in R128系列-智能硬件
      zznzzn
      zznzzn

    Latest posts made by zznzzn

    • 有没有大佬在测试D1s melis 的时候遇到epc register corrupted

      有没有大佬在测试D1s melis 的时候遇到这个问题的epc register corrupted!!

      ``
      msh />disp_layer_alpha_tes0t3 0
      disp_layer_alpha_tes0t3: command not found.
      msh />disp_layer_alpha_test3 0
      msh />cedar_test F:\output.mp4
      cmd_cedar_test start, free mem size:45194872
      vplay filename = F:\output.mp4
      [DBG]: [LDR_LoadFile:0261]: filepath = d:\mod\cedar.mod.
      [DBG]: [esMEMS_FreeMemSize:2352]: aval memory: 0x02b00c18.
      ========mp_display:0xe9a052e8=========
      vedio screen=0 0 800 800
      ===11=====mp_display:0xe9a052e8=========
      [DBG]: [layer_request:0691]: layer_request MOD_DISP_LAYER_WORK_MODE_SCALER
      [DBG]: [layer_request:0739]: requested: ch:0, id:1 disp_mgr[0].req_layer_cnt = 2
      pipe = 0, prio = 255, w:800, h:800
      request_vedio_layer success...
      [DBG]: [esMEMS_FreeMemSize:2352]: aval memory: 0x02b00c18.
      [DBG]: [PlayMediFile:0964]: Play file: F:\output.mp4!

      cmd_cedar_test end, free mem size:45020584
      msh />[DBG]: [LDR_LoadFile:0261]: filepath = d:\mod\cedar\avs.drv.
      [DBG]: [install_psr:0203]: load psr_video.plg!
      [DBG]: [LDR_LoadFile:0261]: filepath = d:\mod\cedar\psr_video.plg.
      [DBG]: [CEDAR_fs_set_encrytp_mod:0049]: [YG] g_cedar_encrytp_mod:0

      [DBG]: [pvfopen:0042]: filename: F:\output.mp4
      [DBG]: [GetParserType:0216]: parser type:4104
      [DBG]: [PsrVideo_MIoctrl:2574]: cmd:2e aux:0
      [DBG]: [PsrVideo_MIoctrl:2612]: enter set:0 1
      [DBG]: [PlayMediFile:1220]: Set MediaTpe=0x1.
      [DBG]: [PlayMediFile:1232]: type[14] w[1280] h[720]

      =====================================================================================================
      EXC_INST_PAGE_FAULT

      thread: 0xE940412A, entry: 0x00000000e940412a, stack_base: 0x00000000409de000,stack_size: 0x00003000.
      x0:0x0000000000000000 ra:0x00000000e9406016 sp:0x00000000409e0e50 gp:0x00000000403420e4
      tp:0x00000000409d6340 t0:0x00000000e9400164 t1:0x000000000000000e t2:0x0000000000000000
      s0:0x000000004138f438 s1:0x00000000000002d0 a0:0x00000000409e0e90 a1:0x00000000e94104b3
      a2:0x0000000000000001 a3:0x0000000000000002 a4:0x0000000000000000 a5:0x0000000000001000
      a6:0x0000000002500000 a7:0x000000004010e8b0 s2:0x00000000e940d6f8 s3:0x0000000000001008
      s5:0x0000000000000001 s5:0x0000000000000001 s6:0xffffffffffffffd0 s7:0x000000004138f448
      s8:0x00000000e9410410 s9:0x000000004138fa68 s10:0x0000000041390438 s11:0x0000000000000500
      t3:0x0000000000000000 t4:0x0000000019999999 t5:0x0000000000000009 t6:0x0000000000000000

      other:
      sepc :0x0000000000000000
      scause :0x000000000000000c
      stval :0x0000000000000000
      sstatus :0x0000000200004120
      sscratch:0x0000000000000000

      -------backtrace-----------
      backtrace : 0X00000000
      backtrace : 0XE9406014
      backtrace : 0XE9404370
      backtrace : 0X40028ECE
      backtrace : 0X40028E6E

      -----------------------------------------------TSK Usage Report----------------------------------------------------------
          name     errno    entry       stat   prio     tcb     slice stacksize      stkfree  lt    si   so       stack_range
       0xE54040B4    0   0xe54040b4    suspend   24   0x409d66b8   15    16384       15912    15  0000 0000  [0x415b2000-0x415b6000]
       0xE5000F5C    0   0xe5000f5c    suspend   14   0x409d64d8   20     8192        7520    20  0000 0000  [0x41557000-0x41559000]
       0xE940412A    0   0xe940412a    running    9   0x409d62f8   20    12288        8736    15  0000 0000  [0x409de000-0x409e1000]
       0xE9400B8A    0   0xe9400b8a    suspend   24   0x409d6118   15    16384       15912    15  0000 0000  [0x4154a000-0x4154e000]
           tshell    0   0x400c883a    suspend   20   0x409d5f38   10    16384       11968    08  0000 0000  [0x41516000-0x4151a000]
         tp_input    0   0x400d047a    suspend    3   0x409d5d58   10     2048        1568    10  0000 0000  [0x414ba000-0x414ba800]
         kb_input    0   0x400d0074    suspend    3   0x409d5b78   10     4096        2752    10  0000 0000  [0x4150b000-0x4150c000]
       0x400385C6    0   0x400385c6    suspend   24   0x409d57b8   15     4096        3600    15  0000 0000  [0x40a32000-0x40a33000]
            disp2    0   0x4002f8c8    running   15   0x409d55d8   10     8192        5736    03  0000 0000  [0x413bf000-0x413c1000]
        kmsg2appq    0   0x400d4a5c    suspend    6   0x409d53f8   10     4096        3376    07  0000 0000  [0x40a31000-0x40a32000]
         mnt_task    0   0x400fe256    suspend    7   0x409d5218   10    16384       15936    10  0000 0000  [0x409e1000-0x409e5000]
            tidle    0   0x4002bad2    running   31   0x4034f030   32     8192        7488    17  0000 0000  [0x4034f228-0x40351228]
            timer    0   0x4002f744    suspend    8   0x40351900   10    16384       12848    07  0000 0000  [0x40351ad8-0x40355ad8]
      -------------------------------------------------------------------------------------------------------------------------
      
      memory info:
          Total  0x036f3000
          Used   0x00d8fda0
          Max    0x00d93da0
      ------------------------------------------------memory information-------------------------------------------------------
      

      dump stack memory:
      0x00000000409e0e50: 0x0000000e 0x00000000 0x00000500 0x00000000
      0x00000000409e0e60: 0x000002d0 0x00000000 0xe940d6f8 0x00000000
      0x00000000409e0e70: 0x00000000 0x00000000 0x0000000e 0x00000000
      0x00000000409e0e80: 0x409e0f30 0x00000000 0x00000000 0x00000000
      0x00000000409e0e90: 0x0000000e 0x00000000 0x050002d0 0x00000000
      0x00000000409e0ea0: 0x401069c8 0x00000000 0xdeadbeef 0x00000000
      0x00000000409e0eb0: 0xdeadbeef 0x00000000 0xdeadbeef 0x00000000
      0x00000000409e0ec0: 0xdeadbeef 0x00000000 0xdeadbeef 0x00000000
      0x00000000409e0ed0: 0xdeadbeef 0x00000000 0x000009c4 0x00000000
      0x00000000409e0ee0: 0x0000500d 0x00000000 0xe940d6f8 0x00000000
      0x00000000409e0ef0: 0x00001000 0x00000000 0x409e0f30 0x00000000
      0x00000000409e0f00: 0xe9410410 0x00000000 0xe9404374 0x00000000
      0x00000000409e0f10: 0x23232323 0x23232323 0x23232323 0x23232323
      0x00000000409e0f20: 0x23232323 0x23232323 0x23232323 0x00232323
      0x00000000409e0f30: 0x00000001 0x00000000 0x00000079 0x00000000
      0x00000000409e0f40: 0x400c2e36 0x00000000 0x408f6218 0x00000000
      0x00000000409e0f50: 0x23232323 0x23232323 0x23232323 0x23232323
      0x00000000409e0f60: 0x23232323 0x23232323 0x23232323 0x23232323
      0x00000000409e0f70: 0x23232323 0x23232323 0xdeadbeef 0x00000000
      0x00000000409e0f80: 0xdeadbeef 0x00000000 0xdeadbeef 0x00000000
      0x00000000409e0f90: 0xdeadbeef 0x00000000 0xdeadbeef 0x00000000
      0x00000000409e0fa0: 0x409d62f8 0x00000000 0x4002e920 0x00000000
      0x00000000409e0fb0: 0x00000000 0x00000000 0xe940412a 0x00000000
      0x00000000409e0fc0: 0x409d5f38 0x00000000 0x40028ed0 0x00000000
      0x00000000409e0fd0: 0xffffffff 0xffffffff 0xe940412a 0x00000000
      0x00000000409e0fe0: 0x00000000 0x00000000 0x4002e920 0x00000000
      0x00000000409e0ff0: 0xdeadbeef 0x00000000 0x40028e6e 0x00000000
      0x00000000409e1000: 0x23232323 0x23232323 0x23232323 0x23232323
      0x00000000409e1010: 0x23232323 0x23232323 0x23232323 0x23232323
      0x00000000409e1020: 0x23232323 0x23232323 0x23232323 0x23232323
      0x00000000409e1030: 0x23232323 0x23232323 0x23232323 0x23232323
      0x00000000409e1040: 0x23232323 0x23232323 0x23232323 0x23232323

      epc register corrupted!!

      posted in D1系列-RISC-V
      zznzzn
      zznzzn
    • 如何给R128在FreeRTOS下配置/data目录

      在调试音频、usb等模块时,会发现SDK的根目录下没有/data该目录,导致无法存储所需要的文件,这就是因为/data目录没有配置好的原因。

      1、选上配置

      首先需要选上的配置:
      运行mrtos_menuconfig,选上COMPONENT_LITTLEFS

      -> System components
          -> thirdparty components
              [*] LittleFS Filesystem
      

      选上littlefs只是支持了这个功能,另外还需要对分区进行配置。

      2、确认分区表

      通过命令cconfigs,跳转到方案配置目录,找到文件sys_partition.fex

      这里需要注意,目录下可能会有多个分区文件,带着不同后缀的,比如说nor,xip等等的,因此需要确认用的是哪一个分区表,以免修改不生效

      在方案已经编译完成之后,运行

      pack
      

      命令对方案进行打包,通过打包时打印出来的log信息,可以提取到用的是哪一个分区表,如下:

      download1FileByUrl.png

      如图片,可以确认到打包示例中调用的分区表。

      3、修改分区表

      在分区表中加入以下配置代码:

      [partition]
          name         = UDISK
          downloadfile = "data_udisk.fex"
          user_type    = 0x8100
      

      通过上述的代码,在打包固件调用的pack_img.sh脚本中,通过函数

      function make_data_image()
      

      会创建对应的分区。

      4、挂载目录

      分区已经建好的话,剩下就是通过littlefs将区分挂载到目录下了。

      在方案的main.c函数中(这里只是举个例子,在系统启动时挂载目录即可,但是需要注意要在flash初始化完成之后才能挂载)

      在main.c中,添加以下代码:

      littlefs_mount("/dev/UDISK", "/data", true);
      

      /dev/UDISK就是分区名字,由分区表产生的。
      /data则是创建目录的名字及路径。

      通过以上步骤,即可为方案新建一个/data目录,可以用于保存一些程序所需要用到的文件。

      5、保存文件到data目录下

      1.在SDK编译环境中存放文件
      可以在编译时,所需要的文件放到UDISK分区。

      存放文件到UDISK分区方法为:

      直接将文件拷贝到编译环境对应的路径下:

      {root_dir}/board/芯片名/方案名/data/UDISK
      

      在SDK打包时就会将UDISK目录下的文件全部打包生成udisk的镜像,最终打包到image里。

      在烧录时,就会udisk的镜像烧录到对应的分区里。系统启动,挂载分区之后,就直接可以通过/data目录访问到对应的文件了。

      2.通过代码读写文件
      FreeRTOS SDK中,通过fopen fwrite fread等POSIX接口,即可操作UDISK分区(/data目录)的文件。

      以下做个示例:

      static int save_to_file(void *str, void *start, int length)
      {
              FILE *fp = NULL;
      
              fp = fopen(str, "wb+"); //save more frames
              if (!fp) {
                      printf(" Open %s error\n", (char *)str);
      
                      return -1;
              }
      
              if (fwrite(start, length, 1, fp)) {
                      fclose(fp);
      
                      return 0;
              } else {
                      printf(" Write file fail (%s)\n", strerror(errno));
                      fclose(fp);
      
                      return -1;
              }
      
              return 0;
      }
      
      • str: 路径名,若为/data目录的话,比如说写入一个a.txt,str可以定义为 /data/a.txt
      • start:所需要写入的数据起始地址
      • length:所需要写的数据的长度。
      posted in R128系列-智能硬件
      zznzzn
      zznzzn
    • 【R128经验分享】启用USB ADB以及无线ADB配置方法

      首先在FreeRTOS的环境下,选择r128_c906_pro:

      source envsetup.sh
      lunch_rtos r128s2_pro_c906
      

      USB ADB的配置比较常规,注意以下几个驱动的勾选

      • usb device驱动
      • adb gadget驱动
      • adbd应用

      运行menuconfig,选择对应的驱动以及软件包:

      mrtos_menuconfig
      

      配置好的图片如下图所示

      downloadFileByUrl (3).png

      downloadFileByUrl (1).png

      downloadFileByUrl (4).png

      当选上以上配置时,usb的adb功能已经可以正常使用了。无线adb还需要额外选上以下配置:

      配置是开启无线adb的配置。

      downloadFileByUrl (5).png

      无线adb的端口,默认为5555

      downloadFileByUrl (6).png

      当上面配置全部选上后,编译烧录即可使用无线adb调试功能。

      1、首先让笔记本与板子,都连上共一个wifi,使其处于局域网的状态。

      2、板子串口控制台运行

      ifconfig
      

      查看ip地址。

      3、笔记本首先使用

      ping 板子ip地址
      

      命令确认笔记本是否能连接上板子。

      4、运行

      adb connect 板子ip地址
      

      进行连接。

      downloadFileByUrl (7).png

      5、出现如上图的connect to 板子ip地址的字符,表示已经连接成功。
      6、接下来就可以运行adb的一些调试命令了。

      7、如果更换了无线adb的端口,比如说从5555改成了5556,那么在笔记本中连接adb的命令需要改成:

      adb connect 板子ip地址:5556
      

      相对于原来的命令多了“:5556”,原来的命令是自动省略端口“:5555”。

      posted in R128系列-智能硬件
      zznzzn
      zznzzn
    • Reply: 【R128填坑分享】适配LVGL界面图片和文字显示很虚,色阶明显的解决方法

      修复好之后的显示效果,一切正常了

      azcjbjq.jpg

      posted in R128系列-智能硬件
      zznzzn
      zznzzn
    • 【R128填坑分享】适配LVGL界面图片和文字显示很虚,色阶明显的解决方法

      LVGL界面图片和文字显示很虚,色阶明显的具体问题情况如下图

      微信图片_20231008184933.png

      初步分析为RGB参数问题,先调出Colorbar检查一下

      • disp -c 0 8 显示如下,无异常

      微信图片_20231008185207.jpg

      • disp -c 0 1 显示如下,有条纹

      微信图片_20231008185212.jpg

      此时问题可能出现在两个方向

      1、rgb接线不稳定有干扰
      2、色彩级数配置问题

      1、rgb接线不稳定有干扰
      检查杜邦线连接很紧,排除干扰导致的文字显示虚化

      2、色彩级数配置问题
      查找R128在线文档显示与屏幕驱动相关内容,选择一下参数进行配置,后解决问题

      文档链接:https://r128.docs.aw-ol.com/sdk_base/disp/#480x480-rgb-86

      微信图片_20231008185509.png

      posted in R128系列-智能硬件
      zznzzn
      zznzzn
    • t113i编译失败

      请教各位大佬,T113-i编译失败了怎么办

      QQ图片20231007105743.png

      posted in 创龙科技专区
      zznzzn
      zznzzn
    • H616低温reboot过程中进入休眠

      H618在DDR物料适配支持时候,reboot实验异常进休眠,在reboot老化测试中报如下log

      [2023-07-11,16:56:44][   40.325238][    T1] init: Untracked pid 1888 exited with status 0
      [2023-07-11,16:56:44][   40.325295][    T5] binder: undelivered death notification, 00000000eae863b8
      [2023-07-11,16:56:44][   40.332300][    T1] init: Service 'vendor.bluetooth-1-0' (pid 1861) received signal 11
      [2023-07-11,16:56:44][   40.348931][    T1] init: Sending signal 9 to service 'vendor.bluetooth-1-0' (pid 1861) process group...
      [2023-07-11,16:56:44][   40.359943][    T1] libprocessgroup: Successfully killed process cgroup uid 1002 pid 1861 in 0ms
      [2023-07-11,16:56:44][   40.370774][    T1] init: Untracked pid 1890 exited with status 0
      [2023-07-11,16:56:45][   40.835661][  T193] type=1400 audit(1685954038.968:313): avc: denied { search } for comm="pool-1-thread-1" name="com.clock.pt1.keeptesting" dev="dm-5" ino=2713 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=1 app=com.clock.pt1.keeptesting
      [2023-07-11,16:56:45][   40.865824][  T193] type=1400 audit(1685954038.968:314): avc: denied { write } for comm="pool-1-thread-1" name="shared_prefs" dev="dm-5" ino=2737 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=1 app=com.clock.pt1.keeptesting
      [2023-07-11,16:56:45][   40.895506][  T193] type=1400 audit(1685954038.968:315): avc: denied { remove_name } for comm="pool-1-thread-1" name="umeng_general_config.xml" dev="dm-5" ino=982382 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=1 app=com.clock.pt1.keeptesting
      [2023-07-11,16:56:45][   40.927110][  T193] type=1400 audit(1685954038.968:316): avc: denied { add_name } for comm="pool-1-thread-1" name="umeng_general_config.xml.bak" scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=1 app=com.clock.pt1.keeptesting
      [2023-07-11,16:56:45][   41.090281][  T214] audit: audit_lost=197 audit_rate_limit=5 audit_backlog_limit=64
      [2023-07-11,16:56:45][   41.091551][  T193] type=1400 audit(1685954039.224:317): avc: denied { read } for comm="Binder:207_2" name="event_count" dev="sysfs" ino=21828 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
      [2023-07-11,16:56:45][   41.099158][  T214] audit: rate limit exceeded
      [2023-07-11,16:56:45][   41.176369][  T164] init: Received sys.powerctl='reboot,' from pid: 490 (system_server)
      [2023-07-11,16:56:45][   41.185428][  T164] init: sys.powerctl: do_shutdown: 0 IsShuttingDown: 0
      [2023-07-11,16:56:46][   41.489695][  T142] disp_runtime_idle
      [2023-07-11,16:56:46][   41.494260][  T142] disp_runtime_suspend
      [2023-07-11,16:56:46][   41.509803][  T490] binder: 490:490 transaction failed 29189/-22, size 116-0 line 2714
      [2023-07-11,16:56:46][   41.549310][  T662] binder_alloc: 288: binder_alloc_buf, no vma
      [2023-07-11,16:56:46][   41.556327][  T662] binder: 662:662 transaction failed 29189/-3, size 88-0 line 2904
      [2023-07-11,16:56:46][   41.577077][   T43] binder: release 288:316 transaction 28975 in, still active
      [2023-07-11,16:56:46][   41.585214][   T43] binder: send failed reply for transaction 28975 to 662:901
      [2023-07-11,16:56:46][   41.662344][  T142] disp_runtime_suspend finish
      [2023-07-11,16:56:46]Gatekeeper_TA_DestroyEntryPoint
      [2023-07-11,16:56:46][   41.870414][    T1] libprocessgroup: Successfully killed process cgroup uid 0 pid 246 in 164ms
      [2023-07-11,16:56:46][   42.095552][    T1] init: Sending signal 9 to service 'netd' (pid 245) process group...
      [2023-07-11,16:56:46][   42.110584][    T1] libprocessgroup: Successfully killed process cgroup uid 0 pid 245 in 5ms
      [2023-07-11,16:56:46][   42.120586][    T1] init: Sending signal 9 to service 'statsd' (pid 244) process group...
      [2023-07-11,16:56:46][   42.135427][    T1] libprocessgroup: Successfully killed process cgroup uid 1066 pid 244 in 5ms
      [2023-07-11,16:56:46][   42.145660][    T1] init: Sending signal 9 to service 'optee' (pid 211) process group...
      [2023-07-11,16:56:46][   42.160205][    T1] libprocessgroup: Successfully killed process cgroup uid 0 pid 211 in 5ms
      [2023-07-11,16:56:46][   42.170237][    T1] init: Sending signal 9 to service 'vendor.keymint-default' (pid 210) process group...
      [2023-07-11,16:56:46][   42.186469][    T1] libprocessgroup: Successfully killed process cgroup uid 9999 pid 210 in 5ms
      [2023-07-11,16:56:46][   42.196962][    T1] init: Sending signal 9 to service 'vendor.boot-hal-1-2' (pid 209) process group...
      [2023-07-11,16:56:46][   42.201237][  T469] binder: undelivered death notification, 00000000f39a1bc8
      [2023-07-11,16:56:46][   42.201864][ T1935] PM: suspend entry (deep)
      [2023-07-11,16:56:46][   42.233610][ T1935] Filesystems sync: 0.031 seconds
      [2023-07-11,16:56:47][   42.438211][ T1935] Freezing user space processes ... (elapsed 0.001 seconds) done.
      [2023-07-11,16:56:47][   42.448235][ T1935] OOM killer disabled.
      [2023-07-11,16:56:47][   42.452739][ T1935] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
      

      reboot老化的过程中,reboot的过程被暂停了,并且进入了standby

      posted in H616系列-OTT
      zznzzn
      zznzzn
    • sqlite库文件如何放到img里面

      我在100ASK_T113开发板上移植sqlite3,现在sqlite3和libsqlite3.so.0.8.6都已经编译好了,我的img文件是直接烧录到板载flash里面的,在SDK里面如何才能把sqlite库文件放到img里面

      posted in 其它全志芯片讨论区
      zznzzn
      zznzzn
    • t113单独aplay可以播放语音文件但是mplayer没声音报错
      # mplayer -zoom -x 320 -y 240 ruguomeiyou.FLV -fs -ao alsa -framedrop
      MPlayer 1.5-7.2.1 (C) 2000-2022 MPlayer Team
      
      Playing ruguomeiyou.FLV.
      libavformat version 59.17.102 (internal)
      libavformat file format detected.
      [lavf] stream 0: video (h264), -vid 0
      [lavf] stream 1: audio (aac), -aid 0
      VIDEO:  [H264]  1280x720  0bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
      ==========================================================================
      Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
      libavcodec version 59.21.100 (internal)
      Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
      ==========================================================================
      Load subtitles in ./
      ==========================================================================
      Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
      AUDIO: 44100 Hz, 2 ch, floatle, 0.0 kbit/0.00% (ratio: 0->352800)
      Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
      ==========================================================================
      [AO_ALSA] alsa-lib: pcm_hw.c:1895:(_snd_pcm_hw_open) Unknown field slave
      [AO_ALSA] Playback open error: Invalid argument
      Failed to initialize audio driver 'alsa'
      Could not open/initialize audio device -> no sound.
      Audio: no sound
      Starting playback...
      Could not find matching colorspace - retrying with -vf scale...
      Opening video filter: [scale]
      [swscaler @ 0xf2d958]bicubic scaler, from yuv420p to bgra using C
      VO: [fbdev] 320x240 => 320x240 BGRA  [fs] [zoom]
      V:  45.5   0/  0 178% 150%  0.0% 0 0
      
      
      MPlayer interrupted by signal 2 in module: flip_page
      V:  45.5   0/  0 178% 150%  0.0% 0 0
      
      Exiting... (Quit)
      #
      #
      #
      # mplayer help
      MPlayer 1.5-7.2.1 (C) 2000-2022 MPlayer Team
      
      Playing help.
      File not found: 'help'
      Failed to open help.
      
      posted in 其它全志芯片讨论区
      zznzzn
      zznzzn
    • 四线电阻触摸屏测试tslib无法校准,而且点击按钮无反应

      A40i目前用的系统是linux3.10,它可以支持usb的电阻四线触摸屏吗,

      想使用usb的转接卡,移植驱动后,测试tslib无法校准,而且点击按钮无反应,需要外接鼠标才能看到点的位置,看到位置后,点击有反应

      2.png.thumb.jpg

      posted in 飞凌嵌入式专区
      zznzzn
      zznzzn