Ameba-rtos-pro2 SDK media_fmp4 example fails to initialize sensor

I have tried Arduino SDK camera examples and they work. I am trying to use Ameba SDK since I need to use RTOS. The thing is that even the example does not recognize the sensor.

ram mkfs and mount OK

[video_voe_presetting] fps:30 w:1920 h:1080

voe heap size = 11124480

fwin(1),enc_en(0),IQ_OFFSET = 0x17940

fwin(1),enc_en(0),SENSOR_OFFSET = 0x2a260

sensor id 1 iq_data 17940 sensor_data 2a260

set ASP print off

ctx->enc_info.frameLength * 2 = 2048

part_count = 0

miso_video_aac_fmp4 started

hal_voe_ready 0x0 0xbf1208

read fcs_status 0x000000bf

[video_init] uvcd iq is null, use default.

[video_init] uvcd SNR is null, use default.

IQ:FW size (76042)

sensor:date 2024/9/12 version:RTL8735B_VOE_1.5.7.0

sensor:FW size (3996)

sensor timestamp: 2024/09/12

iq timestamp: 0000/00/00 00:00:00

voe_heap malloc 0x7128f900, size 11124480

ISP:1 ENC:1 H265:1 NN:1

hal_voe_ready 0x0 0xbf1208

voe :RTL8735B_VOE_1.6.4.0

sensor:RTL8735B_VOE_1.5.7.0

hal :RTL8735B_VOE_1.6.4.0

load time sensor:52us iq:941us itcm:0us dtcm:0us ddr:0us ddr2:0us

Set H264 default HIGH profile

rc_version RC_v1

[video_pre_init_procedure] START

hal_voe_send2voe too long 163122 cmd 0x00000206 p1 0x00000000 p2 0x00000000

VOE command 0x206 fail ret 0xff

VOE_OPEN_CMD command fail 98400400

hal_video_open fail ret=98400400, group=3

hal_voe_ready 0x0 0x1718

Hi @MoisesD2001

The Arduino SDK updates sensor.h automatically, whereas the FreeRTOS SDK requires manual updates.

sensor.h: ameba-rtos-pro2/project/realtek_amebapro2_v0_example/inc/sensor.h at main · Ameba-AIoT/ameba-rtos-pro2 · GitHub

To enable the JXF37 camera on the AMB82-Mini, you can update the following in sensor.h.

#define SENSOR_MAX         2
static const unsigned char sen_id[SENSOR_MAX] = {
	SENSOR_DUMMY,
	SENSOR_F37,
};

#define USE_SENSOR      	SENSOR_F37

static const      char manual_iq[SENSOR_MAX][64] = {
	"iq",
	"iq_f37",
};

Hi,

Thank you. I made the changes that you pointed out. The code does not compile anymore. I understand that it is because it has problems finding the iq file.

[ 1%] Built target bootloader
[ 2%] Generating firmware_isp_iq.bin, isp_iq.bin
make[3]: *** [application/CMakeFiles/fcs_isp_iq.dir/build.make:74: application/firmware_isp_iq.bin] Segmentation fault
make[2]: *** [CMakeFiles/Makefile2:394: application/CMakeFiles/fcs_isp_iq.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:297: CMakeFiles/flash.dir/rule] Error 2
make: *** [Makefile:203: flash] Error 2

Hi @MoisesD2001 ,

Can you share your sensor.h file with me? Thank you.

/**
 ******************************************************************************
 *This file contains sensor configurations for AmebaPro platform
 ******************************************************************************
*/


#ifndef __SENSOR_H
#define __SENSOR_H

#ifdef __cplusplus
extern "C" {
#endif

struct sensor_params_t {
	unsigned int sensor_width;
	unsigned int sensor_height;
	unsigned int sensor_fps;
};
//                                      | Normal |  Fcs   |        |   ISP  |
//                                      | Driver | Driver |   IQ   |   HDR  |
//                                      ---------|--------|--------|--------|
#define SENSOR_DUMMY          0x00  //  |   v    |   v    |   -    |   -    |  /* For dummy sensor, no support fast camera start */
#define SENSOR_SC2336         0x01  //  |   v    |   v    |   v    |   -    |
#define SENSOR_GC2053         0x02  //  |   v    |   v    |   v    |   -    |
#define SENSOR_GC4653         0x03  //  |   v    |   v    |   v    |   -    |
#define SENSOR_F37            0x04  //  |   v    |   v    |   v    |   -    |
#define SENSOR_IMX327         0x05  //  |   v    |   -    |   v    |   v    |  
#define SENSOR_F51            0x06  //  |   v    |   v    |   v    |   v    |  
#define SENSOR_PS5258         0x07  //  |   v    |   -    |   v    |   -    |  /* don't support multi sensor function */
#define SENSOR_SC301          0x08  //  |   v    |   v    |   v    |   v    |  
#define SENSOR_IMX307         0x09  //  |   v    |   -    |   v    |   -    |
#define SENSOR_SC2333         0x0A  //  |   v    |   v    |   v    |   -    |
#define SENSOR_GC4023         0x0B  //  |   v    |   v    |   v    |   -    |
#define SENSOR_PS5420         0x0C  //  |   v    |   v    |   v    |   -    |
#define SENSOR_PS5270         0x0D  //  |   v    |   v    |   v    |   -    |
#define SENSOR_GC5035         0x0E  //  |   v    |   v    |   v    |   -    |
#define SENSOR_PS5268         0x0F  //  |   v    |   -    |   v    |   -    |
#define SENSOR_SC2310         0x10  //  |   v    |   -    |   v    |   -    |
#define SENSOR_PS5420_HDR     0x11  //  |   v    |   v    |   v    |   -    | 
#define SENSOR_PS5270_HDR     0x12  //  |   v    |   v    |   v    |   -    | 
#define SENSOR_F53            0x13  //  |   v    |   v    |   v    |   -    |
#define SENSOR_F55            0x14  //  |   v    |   -    |   v    |   v    |
#define SENSOR_GC4663         0x15  //  |   v    |   v    |   v    |   v    |
//#define SENSOR_GC4663_HDR   0x16  //  |   -    |   -    |   -    |   -    |  /* use SENSOR_GC4663 with init_hdr_mode = 1 */
#define SENSOR_K351           0x17  //  |   v    |   v    |   v    |   v    |
//#define SENSOR_K351_HDR     0x18  //  |   -    |   -    |   -    |   -    |  /* use SENSOR_K351   with init_hdr_mode = 1 */
#define SENSOR_OV50A40        0x19  //  |   v    |   -    |   v    |   -    |  /* Full FOV with (1/4)*(1/4) sub-sample */
//#define SENSOR_SC301_HDR    0x1A  //  |   -    |   -    |   -    |   -    |  /* use SENSOR_SC301  with init_hdr_mode = 1 */
//#define SENSOR_F51_HDR      0x1B  //  |   -    |   -    |   -    |   -    |  /* use SENSOR_F51    with init_hdr_mode = 1 */
#define SENSOR_OS04A10        0x1C  //  |   v    |   -    |   v    |   -    |
//#define SENSOR_F55_HDR      0x1D  //  |   -    |   -    |   -    |   -    |  /* use SENSOR_F55    with init_hdr_mode = 1 */
#define SENSOR_GC1084         0x1E  //  |   v    |   -    |   v    |   -    |
#define SENSOR_SC5356         0x1F  //  |   v    |   v    |   v    |   -    |
#define SENSOR_F38            0x20  //  |   v    |   -    |   v    |   -    |
#define SENSOR_PS5262         0x21  //  |   v    |   -    |   v    |   -    |
#define SENSOR_K05            0x22  //  |   v    |   -    |   v    |   -    |
#define SENSOR_MIS2008        0x23  //  |   v    |   -    |   v    |   -    |
#define SENSOR_NT99236        0x24  //  |   v    |   -    |   v    |   -    |
#define SENSOR_VD550G         0x25  //  |   v    |   -    |   v    |   -    |
#define SENSOR_GC3003         0x26  //  |   v    |   v    |   v    |   -    |
#define SENSOR_IMX662         0x27  //  |   v    |   v    |   v    |   v    |
#define SENSOR_GC2083         0x28  //  |   v    |   -    |   v    |   -    |
#define SENSOR_OV2735         0x29  //  |   v    |   v    |   v    |   -    |
#define SENSOR_SC400AI        0x2A  //  |   v    |   -    |   v    |   -    |
#define SENSOR_OV50A40_CROP   0x2B  //  |   v    |   -    |   v    |   -    | /* Crop FOV with 1/16 window size */
#define SENSOR_OV9734         0x2C  //  |   v    |   -    |   v    |   -    |
#define SENSOR_CV2003         0x2D  //  |   v    |   -    |   -    |   -    |
#define SENSOR_GC2093         0x2E  //  |   v    |   -    |   -    |   -    |
#define SENSOR_F35            0x2F  //  |   v    |   -    |   -    |   -    |
#define SENSOR_OV5693         0x30  //  |   v    |   -    |   -    |   -    |
#define SENSOR_SC3336         0x31  //  |   v    |   -    |   v    |   -    |
#define SENSOR_K06A           0x32  //  |   v    |   -    |   -    |   -    |
#define SENSOR_K306P          0x33  //  |   v    |   -    |   -    |   -    |
#define SENSOR_OV9734_SD      0x34  //  |   v    |   -    |   v    |   -    |
#define SENSOR_IMX471         0x35  //  |   v    |   v    |   v    |   -    |
#define SENSOR_IMX471_12M     0x36  //  |   v    |   -    |   v    |   -    |
#define SENSOR_IMX471_12M_SEQ 0x37  //  |   v    |   -    |   v    |   -    |
#define SENSOR_IMX681         0x38  //  |   v    |   v    |   v    |   -    |
#define SENSOR_IMX681_12M     0x39  //  |   v    |   -    |   v    |   -    |
#define SENSOR_IMX681_12M_SEQ 0x3A  //  |   v    |   -    |   v    |   -    |
#define SENSOR_FIXP_5M        0x3B  //  |   v    |   -    |   -    |   -    |
#define SENSOR_FIXP_2K        0x3C  //  |   v    |   -    |   -    |   -    |
#define SENSOR_SC5356_2M      0x3D  //  |   v    |   v    |   v    |   -    |

static const struct sensor_params_t sensor_params[] = {
	[SENSOR_DUMMY]        = {1920, 1080, 30},
	[SENSOR_SC2336]       = {1920, 1080, 30},
	[SENSOR_GC2053]       = {1920, 1080, 30},
	[SENSOR_GC4653]       = {2560, 1440, 24},
	[SENSOR_F37]          = {1920, 1080, 30},
	[SENSOR_IMX327]       = {1920, 1080, 24},
	[SENSOR_F51]          = {1536, 1536, 20},
	[SENSOR_PS5258]       = {1920, 1080, 30},
	[SENSOR_SC301]        = {2048, 1536, 20},
	[SENSOR_IMX307]       = {1920, 1080, 30},
	[SENSOR_SC2333]       = {1920, 1080, 30},
	[SENSOR_GC4023]       = {2560, 1440, 24},
	[SENSOR_PS5420]       = {1952, 1944, 24},
	[SENSOR_PS5270]       = {1536, 1536, 30},
	[SENSOR_GC5035]       = {2592, 1944, 15},
	[SENSOR_PS5268]       = {1920, 1080, 30},
	[SENSOR_SC2310]       = {1920, 1080, 30},
	[SENSOR_PS5420_HDR]   = {1952, 1944, 24},
	[SENSOR_PS5270_HDR]   = {1536, 1536, 25},
	[SENSOR_F53]          = {1920, 1080, 30},
	[SENSOR_F55]          = {1920, 1080, 30},
	[SENSOR_GC4663]       = {2560, 1440, 24},
//  [SENSOR_GC4663_HDR]   = {2560, 1440, 20},
	[SENSOR_K351]         = {2000, 2000, 20},
//  [SENSOR_K351_HDR]     = {2000, 2000, 20},
	[SENSOR_OV50A40]      = {2048, 1536, 30},
//  [SENSOR_SC301_HDR]    = {2048, 1536, 20},
//  [SENSOR_F51_HDR]      = {1536, 1536, 20},
	[SENSOR_OS04A10]      = {2560, 1440, 24},
//  [SENSOR_F55_HDR]      = {1920, 1080, 30},
	[SENSOR_GC1084]       = {1280,  720, 30},
	[SENSOR_SC5356]       = {2592, 1944, 15},
	[SENSOR_F38]          = {1920, 1080, 30},
	[SENSOR_PS5262]       = {1920, 1080, 30},
	[SENSOR_K05]          = {2592, 1944, 15},
	[SENSOR_MIS2008]      = {1920, 1080, 30},
	[SENSOR_NT99236]      = {1920, 1080, 30},
	[SENSOR_VD550G]       = { 640,  600, 60},
	[SENSOR_GC3003]       = {2304, 1296, 30},
	[SENSOR_IMX662]       = {1920, 1080, 30},
	[SENSOR_GC2083]       = {1920, 1080, 30},
	[SENSOR_OV2735]       = {1920, 1080, 30},
	[SENSOR_SC400AI]      = {2560, 1440, 24},
	[SENSOR_OV50A40_CROP] = {2048, 1536, 30},
	[SENSOR_OV9734]       = {1280,  720, 30},
	[SENSOR_CV2003]       = {1920, 1080, 30},
	[SENSOR_GC2093]       = {1920, 1080, 30},
	[SENSOR_F35]          = {1920, 1080, 30},
	[SENSOR_OV5693]       = {2592, 1944, 15},
	[SENSOR_SC3336]       = {2304, 1296, 30},
	[SENSOR_K06A]         = {2560, 1440, 24},
	[SENSOR_K306P]        = {2560, 1440, 24},
	[SENSOR_OV9734_SD]    = { 640,  360, 60},
	[SENSOR_IMX471]       = {2304, 1728, 24},
	[SENSOR_IMX471_12M]       = {4032, 3024, 5},
	[SENSOR_IMX471_12M_SEQ]   = {2032, 3024, 5}, //width = 2016 + 16(overlap)
	[SENSOR_IMX681]       = {2000, 1500, 30},
	[SENSOR_IMX681_12M]       = {4016, 3008, 4},
	[SENSOR_IMX681_12M_SEQ]   = {2032, 3008, 4}, //width = 2008 + 24(overlap)
	[SENSOR_FIXP_5M]        = {2592, 1944, 30}, //fix pattern
	[SENSOR_FIXP_2K]        = {2560, 1440, 30},
	[SENSOR_SC5356_2M]       = {1088, 1944, 30},
};

#define SENSOR_MAX         5
//#define SENSOR_MAX         2

//static const unsigned char sen_id[SENSOR_MAX] = {
//	SENSOR_DUMMY,
//	SENSOR_GC2053,
//	SENSOR_GC4653,
//	SENSOR_GC4023,
//	SENSOR_SC2333
//};

static const unsigned char sen_id[SENSOR_MAX] = {
	SENSOR_DUMMY,
	SENSOR_F37,
	SENSOR_DUMMY,
	SENSOR_DUMMY,
	SENSOR_DUMMY
};

//#define USE_SENSOR      	SENSOR_GC2053
#define USE_SENSOR      	SENSOR_F37

//static const      char manual_iq[SENSOR_MAX][64] = {
//	"iq",
//	"iq_gc2053",
//	"iq_gc4653",
//	"iq_gc4023",
//	"iq_sc2333",
//};

static const      char manual_iq[SENSOR_MAX][64] = {
	"iq",
	"iq_f37",
	"iq",
	"iq",
	"iq",
};

#define MANUAL_SENSOR_IQ	0xFF

#define ENABLE_FCS      	0

#define MULTI_DISABLE       0x00
#define MULTI_ENABLE        0x01

#define MULTI_SENSOR  		MULTI_DISABLE
#define NONE_FCS_MODE       0
#define FW1_IQ_ADDR        0xF20000
#define FW2_IQ_ADDR        0xF60000
#define FW_IQ_SIZE         256*1024
#define FW_CAL_IQ_SIZE     16*1024
#define FW_SENSOR_SIZE     16*1024
#define FW_VOE_SIZE        600*1024
#define VIDEO_MPU_VOE_HEAP  0
#define SENSOR_SINGLE_DEFAULT_SETUP     0x00
#define SENSOR_MULTI_DEFAULT_SETUP      0X01
#define SENSOR_MULTI_SAVE_VALUE         0X02
#define SENSOR_MULTI_SETUP_PROCEDURE	0X03
#ifdef __cplusplus
}
#endif


#endif /* __AMEBAPRO_SENSOR_EVAL_H */

Hi @pammyleong. Here is my sensor.h file. The example that I was trying still does not compile. I have tried with other example mmf2_video_example_h264_pcmu_array_mp4_init and it compiles, but sensor still can not initialize.

May I know which example you are compiling?

kindly try with the following.

sensor.zip (2.0 KB)

You can refer to ISP — AmebaPro2's Documentation v0.1 documentation

Hi @MoisesD2001

To take note,

After modifying the sensor.h, you need to do a clean build, and amebapro2_sensor_set.json will be automatically updated.

  1. Modify sensor.h (Refer to ISP — AmebaPro2's Documentation v0.1 documentation )
  2. cd to build folder and rm -rf * to clean up build folder
  3. rebuild the example

Now you should be able to use the sensor.

The updated amebapro2_sensor_set.json can be found in \GCC-RELEASE\build\application after compiling.

Thanks.

If the clean build not worked, just direct to edit the json file.

Do you want to switch to a customize sensor or existing sensors supported?

Steps change sensor for RTL8735B freertos SDK

  1. refer to env setup setting-up-gcc-building-environment
  2. Before compile. Edit the sensor.h refer to how-to-apply-sensor-h-file-to-fit-to-customized-usage
  3. If you facing any issue, delete the “build“ folder and redo compilation. “build“ path is “project\realtek_amebapro2_v0_example\GCC-RELEASE”