Skip to content

Commit

Permalink
Merge branch 'dev_xel' into 'dev'
Browse files Browse the repository at this point in the history
Fix k230d rtt only can not auto probe sensor.

See merge request maix_sw/k230_canmv!263
  • Loading branch information
kendryte747 committed Jun 26, 2024
2 parents 45af351 + d881ba3 commit 6558b97
Show file tree
Hide file tree
Showing 7 changed files with 440 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ __pycache__
# lvgl build files
micropython/port/lextab.py
micropython/port/yacctab.py

.clangd
compile_commands.json
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[submodule "micropython"]
path = micropython/micropython
url = https://github.com/micropython/micropython.git
ignore = dirty
[submodule "k230_sdk"]
path = k230_sdk
url = https://github.com/kendryte/k230_sdk.git
[submodule "micropython_port/lvgl/lv_binding_micropython"]
path = micropython/port/3d-party/lvgl/lv_binding_micropython
url = https://github.com/lvgl/lv_binding_micropython.git
ignore = dirty
[submodule "micropython_port/3d-party/freetype/freetype"]
path = micropython/port/3d-party/freetype/freetype
url = https://github.com/freetype/freetype.git
ignore = dirty
[submodule "micropython_port/3d-party/wrap/micropython-wrap"]
path = micropython/port/3d-party/wrap/micropython-wrap
url = https://github.com/stinos/micropython-wrap.git
ignore = dirty
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ k230_sdk_build: .sync_overlay

.PHONY: micropython
micropython_freetype: .sync_overlay
@rm -rf $(K230_CANMV_BUILD_DIR)/images/res/font/
@mkdir -p $(K230_CANMV_BUILD_DIR)/images/res/font/
@cp -f fs_resource/font/SourceHanSansSC-Normal-Min.ttf $(K230_CANMV_BUILD_DIR)/images/res/font
@cp -f fs_resource/font/LICENSE.txt $(K230_CANMV_BUILD_DIR)/images/res/font/LICENSE.txt
Expand All @@ -115,6 +116,7 @@ micropython_freetype_clean: .sync_overlay
.PHONY: micropython
micropython: k230_sdk_build micropython_freetype
@make -C micropython/port
@rm -rf $(K230_CANMV_BUILD_DIR)/images/app/
@mkdir -p $(K230_CANMV_BUILD_DIR)/images/app/tests/kmodel/
@cp -f $(K230_CANMV_BUILD_DIR)/micropython/micropython $(K230_CANMV_BUILD_DIR)/images/app

Expand Down
247 changes: 247 additions & 0 deletions k230_sdk_overlay/src/big/mpp/include/comm/k_board_config_comm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
/**
* @file k_ao_comm.h
* @author
* @sxp
* @version 1.0
* @date 2022-10-21
*
* @copyright
* Copyright (c) 2023, Canaan Bright Sight Co., Ltd
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __K_BOARD_CONFIG_COMM_H__
#define __K_BOARD_CONFIG_COMM_H__


#include "k_autoconf_comm.h"

#ifdef __cplusplus
extern "C" {
#endif /* End of #ifdef __cplusplus */


// sip gpio board config
#if defined(CONFIG_BOARD_K230D)
// display gpio
#define DISPLAY_LCD_RST_GPIO 21
#define DISPLAY_LCD_BACKLIGHT_EN 20

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 37
#define VICAP_IMX335_MASTER_GPIO 33
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 35
#define OV5647_IIC "i2c1"
#define OV5647_CAM_PIN 20
#define OV5647_CAM_PIN_CSI2 (24)
#define OV5647_CAM_PIN_CSI1 (23)

#define OV5647_CSI2_IIC "i2c1"
#define OV5647_CSI1_IIC "i2c0"
#define OV9732_RST_PIN (28)

#define LT9611_RESET_GPIO 42
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c4"

#elif defined(CONFIG_BOARD_K230_EVB)
// usip evb gpio config
// display gpio
#define DISPLAY_LCD_RST_GPIO 9
#define DISPLAY_LCD_BACKLIGHT_EN 31

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 46
#define VICAP_IMX335_MASTER_GPIO 28
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 49
#define OV5647_IIC "i2c1"
#define OV5647_CAM_PIN 20
#define OV5647_CAM_PIN_CSI2 (24)
#define OV5647_CAM_PIN_CSI1 (23)

#define OV5647_CSI2_IIC "i2c1"
#define OV5647_CSI1_IIC "i2c0"
#define OV9732_RST_PIN (28)

#define LT9611_RESET_GPIO 42
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c4"

#elif defined(CONFIG_BOARD_K230_CANMV)
// usip evb gpio config
// display gpio
#define DISPLAY_LCD_RST_GPIO 20
#define DISPLAY_LCD_BACKLIGHT_EN 25

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 46
#define VICAP_IMX335_MASTER_GPIO 28
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 23
#define OV5647_IIC "i2c3"
#define OV5647_CAM_PIN 0
#define OV5647_CAM_PIN_CSI2 (24)
#define OV5647_CAM_PIN_CSI1 (23)

#define OV5647_CSI2_IIC "i2c1"
#define OV5647_CSI1_IIC "i2c0"
#define OV9732_RST_PIN (24)

#define LT9611_RESET_GPIO 42
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c4"

#elif defined(CONFIG_BOARD_K230D_CANMV)
// usip evb gpio config
// display gpio
#define DISPLAY_LCD_RST_GPIO 24
#define DISPLAY_LCD_BACKLIGHT_EN 25

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 46
#define VICAP_IMX335_MASTER_GPIO 28
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 20
#define OV5647_IIC "i2c1"
#define OV5647_CAM_PIN 20
#define OV5647_CAM_PIN_CSI2 (24)
#define OV5647_CAM_PIN_CSI1 (23)
#define OV9732_RST_PIN (24)

#define OV5647_CSI2_IIC "i2c4"
#define OV5647_CSI1_IIC "i2c0"


#define LT9611_RESET_GPIO 42
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c3"

#elif defined(CONFIG_BOARD_K230_CANMV_01STUDIO)
// usip evb gpio config
// display gpio
#define DISPLAY_LCD_RST_GPIO 24
#define DISPLAY_LCD_BACKLIGHT_EN 25

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 46
#define VICAP_IMX335_MASTER_GPIO 28
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 20
#define OV5647_CSI2_IIC "i2c4"
#define OV5647_CSI1_IIC "i2c1"
#define OV5647_IIC "i2c0"
#define OV5647_CAM_PIN 45
#define OV5647_CAM_PIN_CSI2 (62)
#define OV5647_CAM_PIN_CSI1 (10)
#define OV9732_RST_PIN (28)


#define LT9611_RESET_GPIO 22
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c3"

#elif defined(CONFIG_BOARD_K230_CANMV_V2)
// usip evb gpio config
// display gpio
#define DISPLAY_LCD_RST_GPIO 22
#define DISPLAY_LCD_BACKLIGHT_EN 25

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 46
#define VICAP_IMX335_MASTER_GPIO 28
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 20

#define OV5647_IIC "i2c0"
#define OV5647_CAM_PIN 61

#define OV5647_CSI1_IIC "i2c1"
#define OV5647_CSI2_IIC "i2c4"

#define OV5647_CAM_PIN_CSI2 (21)
#define OV5647_CAM_PIN_CSI1 (60)

#define OV9732_RST_PIN (28)

#define LT9611_RESET_GPIO 24 //42
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c3"//"i2c4"

#elif defined(CONFIG_BOARD_K230_CANMV_DONGSHANPI)
// usip evb gpio config
// display gpio
#define DISPLAY_LCD_RST_GPIO 22
#define DISPLAY_LCD_BACKLIGHT_EN 25

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 46
#define VICAP_IMX335_MASTER_GPIO 28
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 20

#define OV5647_IIC "i2c0"
#define OV5647_CAM_PIN 61

#define OV5647_CSI1_IIC "i2c1"
#define OV5647_CSI2_IIC "i2c4"

#define OV5647_CAM_PIN_CSI2 (21)
#define OV5647_CAM_PIN_CSI1 (60)

#define OV9732_RST_PIN (28)

#define LT9611_RESET_GPIO 24 //42
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c3"//"i2c4"

#else

#define DISPLAY_LCD_RST_GPIO 9
#define DISPLAY_LCD_BACKLIGHT_EN 31

// imx335 gpio config
#define VICAP_IMX335_RST_GPIO 46
#define VICAP_IMX335_MASTER_GPIO 28
//OV9286 gpio cinfig
#define VICAP_OV9286_RST_GPIO 49
#define OV5647_IIC "i2c1"
#define OV5647_CAM_PIN 20
#define OV5647_CSI2_IIC "i2c1"
#define OV5647_CSI1_IIC "i2c0"
#define OV5647_CAM_PIN_CSI2 (24)
#define OV5647_CAM_PIN_CSI1 (23)
#define OV9732_RST_PIN (24)

#define LT9611_RESET_GPIO 42
#define LT9611_SLAVE_ADDR 0x3b
#define LT9611_I2C_BUS "i2c4"

#endif

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif
23 changes: 18 additions & 5 deletions k230_sdk_overlay/src/big/mpp/kernel/sensor/src/ov5647_csi2_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,20 @@ static k_sensor_mode ov5647_mode_info[] = {
.data_type = 0x2B, //RAW10
},
.reg_list = ov5647_640x480_10bpp,
.mclk_setting = {{K_FALSE}, {K_FALSE}, {K_FALSE}},
#if defined(CONFIG_BOARD_K230_CANMV) || defined(CONFIG_BOARD_K230D_CANMV)
.mclk_setting = {{K_FALSE}, {K_FALSE}, {K_FALSE}},
#else
.mclk_setting = {
{
.mclk_setting_en = K_TRUE,
.setting.id = SENSOR_MCLK2,
.setting.mclk_sel = SENSOR_PLL0_CLK_DIV4,
.setting.mclk_div = 16,
},
{K_FALSE},
{K_FALSE},
},
#endif
},
{
.index = 3,
Expand Down Expand Up @@ -852,13 +865,13 @@ static k_sensor_mode ov5647_mode_info[] = {
.data_type = 0x2B, //RAW10
},
.reg_list = mode_1280x720_60fps, //mode_1280x720_60fps,
#if defined(CONFIG_BOARD_K230_CANMV)
#if defined(CONFIG_BOARD_K230_CANMV) || defined(CONFIG_BOARD_K230D_CANMV)
.mclk_setting = {{K_FALSE}, {K_FALSE}, {K_FALSE}},
#else
.mclk_setting = {
{
.mclk_setting_en = K_TRUE,
.setting.id = SENSOR_MCLK0,
.setting.id = SENSOR_MCLK2,
.setting.mclk_sel = SENSOR_PLL0_CLK_DIV4,
.setting.mclk_div = 16,
},
Expand Down Expand Up @@ -888,14 +901,14 @@ static k_sensor_mode ov5647_mode_info[] = {
.data_type = 0x2B, //RAW10
},
.reg_list = ov5647_1280x960p30_10bpp, //mode_1280x720_60fps,
#if defined(CONFIG_BOARD_K230_CANMV)
#if defined(CONFIG_BOARD_K230_CANMV) || defined(CONFIG_BOARD_K230D_CANMV)
.mclk_setting = {{K_FALSE}, {K_FALSE}, {K_FALSE}},

#else
.mclk_setting = {
{
.mclk_setting_en = K_TRUE,
.setting.id = SENSOR_MCLK0,
.setting.id = SENSOR_MCLK2,
.setting.mclk_sel = SENSOR_PLL0_CLK_DIV4,
.setting.mclk_div = 16,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static const k_vicap_sensor_info sensor_info_list[] = {
VICAP_FLASH_FOLLOW_STROBE,
VICAP_VI_FIRST_FRAME_FS_TR0,
0,
30,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_LINEAR_IR
},
{
Expand Down Expand Up @@ -481,7 +482,7 @@ static const k_vicap_sensor_info sensor_info_list[] = {
OV_OV9286_MIPI_1280X720_60FPS_10BIT_LINEAR_SPECKLE
},
{
"ov5647",
"ov5647_csi2",
1920,
1080,
VICAP_CSI2,
Expand Down
Loading

0 comments on commit 6558b97

Please sign in to comment.