软件调试 海思提供了一系列调试工具,方便用户调试各个模块功能质量,甚至是硬件通信 等。 工具目录 底层通讯协议和寄存器读写工具: ./Hi3559AV100_SDK/osdrv/tools/board/reg-tools-1.0.0/bin //SDK 中 ├── btools ├── hiddrs -> btools //测试 DDR ├── himd -> btools //读寄存器 ├── himd.l -> btools ├── himm -> btools //写寄存器 ├── i2c_read -> btools //调试 I2C ├── i2c_write -> btools ├── ssp_read -> btools //调试 SPI └── ssp_write -> btools MPP 平台测试工具源码: ./Hi3559AV100_SDK/mpp/tools //SDK 中 ├── ai_dump ├── ai_dump.c ├── avs_chn_dump ├── avs_src_dump ├── fisheye_calibrate ├── mipitx_read ├── mipitx_write ├── vi_bayerdump ├── vi_chn_dump ├── vi_fisheye_attr ├── vi_pipe_yuvdump ├── vo_chn_dump ├── vo_screen_dump ├── vo_wbc_dump ├── vpss_chn_dump ├── vpss_src_dump # 这里的工具都是用于捕获各个模块通道传输的数据,只用于测试调试 PC 主机调试工具: ./Tools //工具包中 ├── AQTools ├── AVS_AutoFineTuning ├── AVS_Calibration ├── Casigntool ├── DEC_LIB ├── HiPro-usb ├── HiTool ├── PQTools └── usb_tools # 这里的工具文档已经有很详细的介绍,具体请参考对应文档 读写寄存器 查看芯片手册,或者引脚复用列表,查看自己需要修改的寄存器基地址和地址偏 移 ./himd.l 0xXXXXXXXX(寄存器地址) 4(读数据长度) ./himm 0xXXXXXXXX(寄存器地址) 0xXXXXXXXX(写数据) 以修改 GPIO3_1 复用为 I2C0_SDA 为例: 1.查看引脚复用列表,./Hi3559AV10 0/ReleaseDoc/zh/00.hardware/chip/Hi3559AV100_PINOUT_CN.xlsx 2.查看到对应寄存器地址为 0x1f00006c, 读寄存器 ./himd.l 0x1f00006c,读 出为 0x00001400 3.修改为 I2C0_SDA ,./himm 0x1f00006c 0x0001403 读写 I2C usage: i2c_read . sample: 0x1 0x56 0x0 0x10 2 2. 0x1 0x56 0x0 0x10 2 2 2. 0x1 0x56 0x0 0x10. default reg_width, data_width, reg_step is 1. usage: i2c_write . sample: 0x1 0x56 0x0 0x28 2 2. 0x1 0x56 0x0 0x28. default reg_width and data_width is 1. 根据原理图、dts 查找设备对应的 I2C 总线(i2c_num) 根据芯片手册、dts 查找设备的 I2C 地址(dev_addr) 根据芯片手册查找需要读写的 I2C 寄存器地址(reg_addr) 根据命令格式进行读写 读写 SPI Usage: ssp_read [num_reg] [dev_width] [reg_width] [data_width] [reg_order] [data_order] . num_reg and dev_width and reg_width and data_width and reg_order and data_order can be omitted, the default is 0x1. eg: ssp_read 0x0 0x0 0x2 0x0 0x10 0x1 0x1 0x1 0x1 0x1. ssp_read 0x0 0x0 0x2 0x0. default num_reg and dev_width and reg_width and data_width and reg_order and data_order is 0x1. Usage: ssp_write [dev_width] [reg_width] [data_width] [reg_order] [data_order]. dev_width and reg_width and data_width and reg_order and data_order can be omitted, the default is 0x1. eg: ssp_write 0x0 0x0 0x2 0x0 0x65 0x1 0x1 0x1 0x1 0x1. ssp_write 0x0 0x0 0x2 0x0 0x65. default dev_width and reg_width and data_width and reg_order and data_orderis 0x1. 根据原理图、dts 确认设备的 SPI 总线(spi_num) 根据原理图确认设备连接的篇选信号(csn) 根据芯片手册确认设备地址(dev_addr) 根据芯片手册确认需要读写的 SPI 寄存器地址(reg_addr) 根据命令格式进行读写 PS: MPP 工具本身就是调用 MPI 接口实现,并且源码中有详细的 Usage 介绍,具体 请参考对应文档和源码。 PC 调试工具请参考 《文档介绍》一节,在 ReleaseDoc 中每一个工具都有独立 详细的介绍。