-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from tipoman9/main
Add imx335 sensor driver with higher FPS modes for FPV
- Loading branch information
Showing
9 changed files
with
6,988 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.o | ||
*.so | ||
*.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
|
||
#to compile for HiSilicon | ||
export SDK_CODE=0x3516E200 | ||
#export PATH=/home/home/src/openipc/output/host/bin:$PATH | ||
|
||
#this compiles but giver error on cam | ||
#make CROSS_COMPILE=arm-openipc-linux-musleabi- CHIPARCH=hi3516ev200 | ||
|
||
# This will compile it correctly ! Set CHIPARCH and SDK_CODE accordingly !!! | ||
``` | ||
make \ | ||
PATH="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin:/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/sbin:/home/home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" AR="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-gcc-ar" AS="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-as" LD="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-ld" NM="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-gcc-nm" CC="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-gcc" GCC="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-gcc" CPP="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-cpp" CXX="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-g++" FC="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-gfortran" F77="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-gfortran" RANLIB="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-gcc-ranlib" READELF="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-readelf" STRIP="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-strip" OBJCOPY="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-objcopy" OBJDUMP="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/ccache /usr/bin/gcc" GCC_FOR_BUILD="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/ccache /usr/bin/gcc" CXX_FOR_BUILD="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/ccache /usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/include" CFLAGS_FOR_BUILD="-O2 -I/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/include" CXXFLAGS_FOR_BUILD="-O2 -I/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/include" LDFLAGS_FOR_BUILD="-L/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/lib -Wl,-rpath,/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-as" DEFAULT_LINKER="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/arm-openipc-linux-musleabi-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 " CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 " LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/bin/pkg-config" STAGING_DIR="/home/home/src/openipc/output/per-package/hisilicon-opensdk/host/arm-buildroot-linux-musleabi/sysroot" INTLTOOL_PERL=/usr/bin/perl \ | ||
CHIPARCH=hi3516ev200 SDK_CODE=0x3516E200 -C /home/home/src/openhisilicon/openhisilicon/libraries all | ||
``` | ||
|
||
copy driver to device: | ||
scp /home/home/src/openhisilicon/openhisilicon/libraries/sensor/hi3516ev200/sony_imx335_fpv/libsns_imx335.so root@192.168.1.88:/usr/lib/sensors/libsns_imx335ex.so | ||
|
||
CHIPARCH=hi3516ev200 | ||
export SDK_CODE=0x3516E200 | ||
or | ||
CHIPARCH=gk7205v200 | ||
export SDK_CODE=0x7205200 | ||
|
||
|
||
# To compile via copying over current drivers: | ||
Compile OpenIPC for Hisilicon in ```/home/home/src/openipc/```. | ||
Change code and copy over stock drivers: | ||
cp imx335_sensor_ctl.c /home/home/src/openipc/output/build/hisilicon-opensdk/libraries/sensor/hi3516ev200/sony_imx335 | ||
cp imx335_cmos.c /home/home/src/openipc/output/build/hisilicon-opensdk/libraries/sensor/hi3516ev200/sony_imx335 | ||
cp Makefile /home/home/src/openipc/output/build/hisilicon-opensdk/libraries/sensor/hi3516ev200/sony_imx335 | ||
|
||
This will rebuild it: | ||
make -C /home/home/src/openipc/output/ hisilicon-opensdk-rebuild | ||
|
||
copy driver to device: | ||
scp /home/home/src/openipc/output/build/hisilicon-opensdk/libraries/sensor/hi3516ev200/sony_imx335/libsns_imx335.so root@192.168.1.88:/usr/lib/sensors/libsns_imx335ex.so | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
LIB_NAME := libsns_imx335_fpv | ||
|
||
override CFLAGS += -DSDK_CODE=$(SDK_CODE) -fPIC -I$(CURDIR)/../../../../include -DCHIPARCH=$(CHIPARCH) | ||
|
||
SRCS := $(wildcard *.c) | ||
OBJS := $(SRCS:%.c=%.o) $(ASM_SRCS:%.S=%.o) | ||
|
||
all: $(LIB_NAME).so $(LIB_NAME).a | ||
|
||
$(LIB_NAME).so: $(OBJS) | ||
$(CC) -shared -o $@ $(OBJS) | ||
|
||
$(LIB_NAME).a: $(OBJS) | ||
$(AR) -rcs $(LIB_NAME).a $(OBJS) | ||
|
||
clean: | ||
-rm $(OBJS) $(LIB_NAME).so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Higher FPS imx335 sensor driver on Goke/Hisilicon SoCs. | ||
Sensor modes added: | ||
### 2592x1520 50fps , slightly cropped vertically to 16:9 | ||
for on hi356ev300 : Isp_FrameRate=50 , majestic set to 1920x1080 50fps => 50fps | ||
for gk7205v300 : Isp_FrameRate=48 , majestic set to 1920x1080 48fps => 47fps | ||
|
||
### 2592x1944 fullscale mode boosted to 40fps | ||
for on hi356ev300 set Isp_FrameRate=45, majestic to 1920x1080 fps: 45 to get 39fps | ||
for on gk7205v300 set Isp_FrameRate=36, majestic to 1920x1080 fps: 36 to get 33fps | ||
|
||
### 1920x1080 cropped, max 90fps , zoom 1.5x | ||
Isp_FrameRate=90 # can work at 90fps only when majestic is set to 1280x720 !!! | ||
Max Isp_FrameRate=55 for 1920x1080 | ||
|
||
### 1296x972 binning max 65fps, | ||
Isp_FrameRate=68 # # max supported value on hi356ev300 at 1280x720 | ||
|
||
### 2592x1944 stock fullscale 30fps mode | ||
set Isp_FrameRate=30 to enable this mode | ||
|
||
|
||
# To configure. | ||
Copy new driver to camera as ```usr/lib/sensors/libsns_imx335_fpv.so``` | ||
|
||
Copy imx335_fpv.ini to ```/etc/sensors/imx335_fpv.ini``` | ||
|
||
in /etc/majestic.yaml set: | ||
``` | ||
video0: | ||
codec: h265 | ||
rcMode: cbr | ||
gopSize: 1.5 | ||
size: 1920x1080 | ||
fps: 45 | ||
... | ||
isp: | ||
sensorConfig: /etc/sensors/imx335_fpv.ini | ||
``` | ||
|
||
follow instructions in /etc/sensors/imx335_fpv.ini | ||
|
||
|
||
|
||
### Follow instructions in imx335_fps.ini to set the sensor mode | ||
All modes will work at fps: 45, some of them can run at higher refresh rate. |
Oops, something went wrong.