TDA4开发记录(三)

Posted by 肥仔 on May 26, 2024

前言

该部分是公司购买的 TDA4 EVM 开发记录,主要是熟悉一下相关BSP.

实际业务开发是基于公司自研域控制器或者联电的双TDA4

SD Card Boot App Use

J721E 的 EVM 设置 — 处理器 SDK 实时操作系统 J721E

20220720 gpio test_case

?注意GPIO Example 没有打印,GPIO 没有闪烁 ${PSDKRA}/pdk_jacinto_07_01_00_45/packages/ti/boot/sbl/binary/j721e_evm/mmcs d/bin/sbl_mmcsd_img_mcu1_0_release.tiimage ${PSDKRA}/pdk_jacinto_07_01_05_14/packages/ti/drv/sciclient/soc/V1/tifs.bin ${PSDKRA}/ pdk_jacinto_08_00_00_37/packages/ti/binary

TDA4VM: How to boot from SD CARD - Processors forum - Processors - TI E2E support forums

J721E SBL — 平台开发套件 (PDK) - JACINTO 用户指南

SOM SW1 1 ON, 2 OFF SW2 1 OFF, 2 ON SW3 1 OFF, 2 OFF

EVM Board

SW8 1 ON,2 OFF,3 OFF, 4 OFF,5 OFF, 6 OFF, 7 ON, 8 OFF SW9 1-8 OFF SW13 1 OFF ,2 OFF SW3 1 OFF, 2 ON, 3 ON ,4 ON, 5 OFF, 6 OFF, 7 ON, 8 ON ,9 ON, 10 OFF

TDA4VM:如何从SD卡加载mcu1_1,mcu2_0,mcu2-1等的应用程序?- 处理器论坛 - 处理器 - TI E2E 支持论坛

TDA4VM: SBL SD 引导 - tifs 文件打开失败 - 处理器论坛 - 处理器 - TI E2E 支持论坛

20220720 test case continue

UART_Baremetal_TestApp_mcu1_0_release.appimage

查看代码需要输入16 个字符数据 ,检测通过

20220721 csi-tx test

没有检测到相关波形

SD Card Boot Linux Use

? 脚本路径没有说清楚

  • 拿取空白卡,umount 相关 设备符

umount /dev/sdb1 umount /dev/sdb2

  • 制作相关boot 以及rootfs
    • 使用脚本制作 sudo ./mk-linux-card.sh /dev/sdb
    • 使用gparted ,gui制作 1.确保将 FAT32 分区标志设置为“引导”、“lba” 2.将 FAT32 分区命名为“BOOT”,将 ext4 分区命名为“rootfs”
  • 将相关文件复制到sd 卡 ./install_to_sd_card.sh

    20220722 Linux 启动

make -s allcores BOARD=j721e_evm

  • 基于虚拟机编译的二进制无法被引导 查看相关.out 执行结果

    20220726 vision app 的使用说明

    没有输出。建议20220801 继续查看

    20220801

20220822 tda4_sdk_8.1

参考制作 RTOS BSP E:/TDA4/PROCESSOR-SDK-RTOS-J721E_08_01_13/ti-processor-sdk-rtos-j721e-evm-08_01_00_13-docs_only/ti-processor-sdk-rtos-j721e-evm-08_01_00_13-docs_only/vision_apps/docs/user_guide/ENVIRONMENT_SETUP.html#autotoc_md2

https://www.yuque.com/shuobeiyibuyi/gn28qo/urkuk1sdm6tkr5il 虚拟机编译失败

Compiling j721e:mpu1_0:release:csl_init: a53/src/startup/aarch64/bootcode.asm aarch64-none-elf-gcc: fatal error: cannot execute ‘/home/leadmove/software/tda4_08_02_rtos/ti_sdk/gcc-arm-9.2-2019.12-x8 6_64-aarch64-none-elf/bin/../libexec/gcc/aarch64-none-elf/9.2.1/cc1’: execv: Exec format error compilation terminated.

更新编译链工具解决相关问题

20220824 sensor_drv

8.12. 向 PSDK 实时操作系统添加新的图像传感器 — 处理器 SDK 实时操作系统 J721E

task 顺序说明

lm_dcu: 8.0 srv_demo, 各种摄像头 驱动的 测试 (驱动已经 ready).

ti_evm: HDMI 驱动移植。测试是否出图

lm_dcu: 升级 sdk 至 sdk8.1.

lm_dcu, sdk8.1, 测试环视,使用ox01f10

https://gitee.com/peng_zhihui/HDMI-PI?_from=gitee_search

ps

理解错误,直接从第三项做起来了,各种摄像头还不熟悉...

20220826 cam_cs1 log

vx_app_single_cam_cs2_1.log

20220829 lt6911 i2c 地址写不进

PROC079E3B_RP_Common_Processor_Board

1
2
3
4
5
6
7
8
9
[MCU2_0]   3096.669556 s: ImageSensor_RemoteServiceHandler: IM_SENSOR_CMD_CREATE
[MCU2_0]   3096.669813 s: set I2C mux status ok?: -1, control reg: 0
[MCU2_0]   3096.670084 s: set I2C mux status ok?: -1, control reg: 0
[MCU2_0]   3096.670273 s: set I2C mux status ok?: -1, control reg: 0
[MCU2_0]   3096.670459 s: set I2C mux status ok?: -1, control reg: 0
[MCU2_0]   3096.670511 s: check LT6911 id: 0
[MCU2_0]   3096.670674 s: check LT6911 id: 0
[MCU2_0]   3096.670726 s: set I2C mux status ok?: -1, control reg: 0
[MCU2_0]   3096.670770 s: status -1

i2c6

i2cdetect -y -r 5

i2cget -y 5 0x2b 0x00

  • 排查电源,发现1.8 的电源是3.3v

将sw3.7 拨码成off, 确保相关电源正确

  • 发现hdmi 的i2c 数据是写入的(示波器),排除Linux设备问题
  • 发现复位引脚拉低。该引脚由TCA6408A控制,需拉高 查找TCA6408A datasheet 与code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  uint8_t data = 0x00;
  status |=  Board_i2c8BitRegWr(gISS_Sensor_I2cHandle, I2C_6_EXPAND_GPIO, 0x03, &data, 1, SENSOR_I2C_TIMEOUT);
  printf("set I2C mux status ok?: %d, control reg: 0x00 \n",status);
  printf("set as out putpin\n");

  data = 0xff;
  status |=  Board_i2c8BitRegWr(gISS_Sensor_I2cHandle, I2C_6_EXPAND_GPIO, 0x01, &data, 1, SENSOR_I2C_TIMEOUT);
  printf("set I2C mux status ok?: %d, control reg: 0x03 \n",status, tmp);
  printf("set all output pin  as 1\n");

  status |=  Board_i2c8BitRegRd(gISS_Sensor_I2cHandle, I2C_6_EXPAND_GPIO, 0x00, &tmp, 1, SENSOR_I2C_TIMEOUT);
  printf("set I2C mux status ok?: %d, control reg: %x\n",status, tmp);
  printf("check I2C_6_EXPAND_GPIO id: %x\n", tmp);
  status |=  Board_i2c8BitRegRd(gISS_Sensor_I2cHandle, I2C_6_EXPAND_GPIO, 0x01, &tmp, 1, SENSOR_I2C_TIMEOUT);
  printf("check I2C_6_EXPAND_GPIO id: %x\n", tmp);
  printf("set I2C mux status ok?: %d, control reg: %x\n",status, tmp);

  • 拉高相关复位后,运行相关out,hdmi 驱动正常,可识别到相关chip id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[MCU2_0]     88.282406 s: ImageSensor_RemoteServiceHandler: IM_SENSOR_CMD_CONFIG
[MCU2_0]     88.282476 s: Application requested features = 0x0
[MCU2_0]     88.282525 s:  Configuring camera # 0
[MCU2_0]     88.283826 s: >> Set Hpd Low!
[MCU2_0]     88.285402 s: lt6911 id:0x1605
[MCU2_0]     88.491157 s: >> Set Hdmi Edid done!
[MCU2_0]     88.791566 s: >> Set Hpd High!
[MCU2_0]     88.791630 s: >> Next step is t

[MCU2_0]     90.978242 s: [Tmds Clock] : 148320 MHZ
[MCU2_0]     90.979561 s: >> RX PLL unlock yet , still needs Calibrate!!
[MCU2_0]     90.979610 s: >> RX PLL Calibration Start!!
[MCU2_0]     91.043685 s: >> RX PLL Calibration Done!!
[MCU2_0]     91.217433 s: >> Rx Hsync is stable !!
[MCU2_0]     91.238558 s: >> Next step is to check video is right or not!!
[MCU2_0]     91.764982 s: HDMI timing check:
[MCU2_0]     91.765057 s: pixel clock:148319000
[MCU2_0]     91.765121 s: H:2200(active 1920, sync:44, fp:88, bp:148)
[MCU2_0]     91.765184 s: V:1125(active 1080, sync:5, fp:4, bp:36)

vision_apps 变动

csi_0

1
2
3
4
local_capture_config.instId[CAPT_INST_ID] = 0; // use instance 1 for DMS and front camera
local_capture_config.chInstMap[CAPT_INST_ID] = 0;
local_capture_config.instCfg[CAPT_INST_ID].laneBandSpeed =
TIVX_CAPTURE_LANE_BAND_SPEED_560_TO_640_MBPS;  //for 9296 fix bandrate. ov10640, 96705 front camera.

20220830 lm_bsp build

error: multi-line comment [-Werror=comme 编译错误:error: multi-line comment - 独孤酷酷 - 博客园 (cnblogs.com) U ,L,F 常量缩写 (152条消息) C语言中,数字后面带个U,L,F的含义_喵喵锤锤你小可爱的博客-CSDN博客_c语言数字后面加l

重点 (152条消息) warning:implicit conversion loses integer precision:‘int‘ to ‘unsigned short‘ – C integer promotion_Phenixyf的博客-CSDN博客

20220831 车道线移植

  • 相关code 已经合并完成,并完成编译
1
2
3
4
# ifeq ($(TREAT_WARNINGS_AS_ERROR),1)
# $(_MODULE)_CFLAGS += -Werror
# endif

https://blog.csdn.net/weixin_30611509/article/details/96155380

https://blog.csdn.net/weixin_43828438/article/details/102406646

https://blog.csdn.net/sdhahaha945/article/details/120085017?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-120085017-blog-111996770.pc_relevant_multi_platform_featuressortv2dupreplace&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-120085017-blog-111996770.pc_relevant_multi_platform_featuressortv2dupreplace&utm_relevant_index=1

build error

1
2
3
4
5
6
/mnt/HD2/lm_dcu_sdk81/ti-processor-sdk-rtos-j721e-evm-08_01_00_13/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/9.2.1/../../../../aarch64-none-linux-gnu/bin/ld: /mnt/HD2/lm_dcu_sdk81/ti-processor-sdk-rtos-j721e-evm-08_01_00_13/vision_apps/out/J7/A72/LINUX/release/module/apps.dl_demos.app_tidl_seg_cam_lane_dectect/main.o: undefined reference to symbol 'pthread_create@@GLIBC_2.17'
/mnt/HD2/lm_dcu_sdk81/ti-processor-sdk-rtos-j721e-evm-08_01_00_13/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/9.2.1/../../../../aarch64-none-linux-gnu/bin/ld: /mnt/HD2/lm_dcu_sdk81/ti-processor-sdk-rtos-j721e-evm-08_01_00_13/targetfs//lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
concerto/finale.mak:212: recipe for target '/mnt/HD2/lm_dcu_sdk81/ti-processor-sdk-rtos-j721e-evm-08_01_00_13/vision_apps/out/J7/A72/LINUX/release/vx_app_tidl_seg_cam_lane_dectect.out' failed

  • 确定相关动态库是否在targetfs
    • find . -name “thread
    • locate “xxx”
  • 直接在makefile 中添加 SYS_SHARED_LIBS += pthread
  • 强制类型转换 openvx 专有名称 https://bbs.elecfans.com/jishu_1727893_1_1.html ldc,畸变矫正

lt6911 -> seg demo

  • cancel viss asew node

20220901 去除ldc

1
(sensorObj->enable_ldc == 1) app_create_graph_scaler(obj->context, obj->graph, &obj->scalerObj, obj->ldcObj.output_arr);

畸变矫正

scaler 对格式转换有要求,只支持如下格式

https://www.freesion.com/article/446464563/

obj->captureObj type is 0x1

VX_DF_IMAGE_UYVY

0 »»>RAW

1 »»>YUV

20220902 明确畸变产生原因

TIOVX 用户指南:vx_tutorial_image_histogram.c 文件参考

  • 将每个流程的图片给保存下来

  • 相关图片已经保存,但只有lt6911 的图片可以用raw 编辑器打开 RAW file name /opt/vision_apps/test_data/img_2247.raw

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    The raw  image img_width: 1920,img_height: 1080 ,img_format: 1498831189  //UYVY
    imgaddr_width = 1920
    imgaddr_height = 1080
    imgaddr_stride = 3840
    width = 1920
    height = 1080
    Written 4147200 bytes
    4147200 bytes written to /opt/vision_apps/test_data/img_2247.raw
    LDC node send command success!
    YUV file name /opt/vision_apps/test_data/img_msc_2247.yuv
    The yuv image img_width: 1920,img_height: 1080 ,img_format: 842094158 //NV12
    imgaddr_width = 1920
    imgaddr_height = 1080
    imgaddr_stride = 1920
    width = 1920
    height = 1080
    Written 3110400 bytes
    3110400 bytes written to /opt/vision_apps/test_data/img_msc_2247.yuv
    Scaler write node send command success!
    Scaler write node send command success!
    

20220905 ONEX脱敏测试

说明 OPENCV 读取视频与保存视频存在问题

  • 有格式要求 ONEX 直接运行 更换mac 地址 https://blog.csdn.net/zhaoxinfan/article/details/88065240

进入tda4 boot setenv ethaddr 00:0A:35:00:22:05 saveenv

  • 增加动态库 export PATH=/opt/vision_apps/uaes/tuomin/lib:$PATH
    onnxruntiem 安装 pip3 install onnxruntime==1.8.1 -i http://mirrors.aliyun.com/pypi/simple/ –trusted-host mirrors.aliyun.com
  • 离线安装需要注意格式 import pip._internal.pep425tags print(pip._internal.pep425tags.get_supported())

python3 test_video.py –video ./video5.mp4

ONEX 依赖TIDL 方式

  • 没有跑通,需要转换

https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/07_02_00_06/exports/docs/tidl_j7_01_04_00_08/ti_dl/docs/user_guide_html/md_tidl_model_import.html

https://github.com/TexasInstruments/edgeai-tidl-tools/blob/master/README.md#setup

  • 查看ONEX格式 https://blog.csdn.net/qq_33287871/article/details/115742017

edege_al

https://github.com/TexasInstruments/edgeai-tidl-tools/blob/master/README.md#setup

1
2
3
4
5
6
7
8
9
10
git clone https://github.com/TexasInstruments/edgeai-tidl-tools.git
export DEVICE=j7
#export DEVICE=am62
cd edgeai-tidl-tools
source ./setup.sh

export ARM64_GCC_PATH=/mnt/HD2/lm_dcu_sdk81/ti-processor-sdk-rtos-j721e-evm-08_01_00_13/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu
export TIDL_TOOLS_PATH=/mnt/HD2/lm_dcu_sdk81/ti-processor-sdk-rtos-j721e-evm-08_01_00_13/tidl_j7_08_01_00_05/tidl_tools

source ./setup.sh --skip_arm_gcc_download

待完成