I made some changes and a test function.
Code: Select all
#define send_buff_size 1280
#define FIFO_Pin_3 14
#define FIFO_Pin_4 15
#define FIFO_Pin_5 32
#define FIFO_Pin_6 33
#define FIFO_Pin_7 34
#define FIFO_Pin_8 35
//#define RESET
#define FIFO_WEN 2
#define FIFO_WRST 4
#define FIFO_RCK 26//16
#define FIFO_RRST 17
#define VSYNC 18
uint8_t ov7670_read(void){
gpio_set_level(FIFO_RCK, 1);
uint8_t val = (uint8_t)((gpio_get_level(FIFO_Pin_1) << 7)
| (gpio_get_level(FIFO_Pin_2) << 6)
| (gpio_get_level(FIFO_Pin_3) << 5)
| (gpio_get_level(FIFO_Pin_4) << 4)
| (gpio_get_level(FIFO_Pin_5) << 3)
| (gpio_get_level(FIFO_Pin_6) << 2)
| (gpio_get_level(FIFO_Pin_7) << 1)
| (gpio_get_level(FIFO_Pin_8) << 0));
gpio_set_level(FIFO_RCK, 0);
return val;
}
static void get_image_task(void* arg){
uint8_t *databuff = (uint8_t *)malloc(send_buff_size);//send_buff_size
while (1){
uint8_t i = 0;
uint16_t j = 0;
LED_ON();
ESP_LOGD(main_TAG, "%s","capture");
ov7670_capture();
ESP_LOGD(main_TAG, "%s","~capture");
ESP_LOGD(main_TAG, "%s","rrst");
ov7670_rrst();
ESP_LOGD(main_TAG, "%s","~rrst");
LED_OFF();
ESP_LOGI(main_TAG, "%s","get_image_buf start");
for (i = 0; i < 120; i ++)
for (j = 0; j < send_buff_size; j ++){
databuff[j] = ov7670_read();//read one byte from the buffer
ESP_LOGI(main_TAG,"i = %d ,j = %d == %d",i,j,databuff[j]);
vTaskDelay(10 / portTICK_RATE_MS);
}
//for (j = 0; j < send_buff_size; j ++){
// vTaskDelay(10 / portTICK_RATE_MS);
// ESP_LOGI(main_TAG,"i = %d ,j = %d == %d",i,j,databuff[j]);
//}
ESP_LOGI(main_TAG, "%s","get_image_buf end");
vTaskDelay(1000 / portTICK_RATE_MS);
}
free(databuff);
}
void app_main()
{
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK( ret );
ov7670_gpio_ini();
i2c_init();
board_led_ini();
xTaskCreate(get_image_task, "get_image_task", 1024 * 4, (void* ) 0, 5, NULL);
}
I get the following result.
Code: Select all
[0;32mI (20502) Mymain_TAG: i = 1 ,j = 531 == 150.[0m
.[0;32mI (20512) Mymain_TAG: i = 1 ,j = 532 == 250.[0m
.[0;32mI (20522) Mymain_TAG: i = 1 ,j = 533 == 165.[0m
.[0;32mI (20532) Mymain_TAG: i = 1 ,j = 534 == 141.[0m
.[0;32mI (20542) Mymain_TAG: i = 1 ,j = 535 == 174.[0m
.[0;32mI (20552) Mymain_TAG: i = 1 ,j = 536 == 134.[0m
.[0;32mI (20562) Mymain_TAG: i = 1 ,j = 537 == 9.[0m
.[0;32mI (20572) Mymain_TAG: i = 1 ,j = 538 == 39.[0m
.[0;32mI (20582) Mymain_TAG: i = 1 ,j = 539 == 197.[0m
.[0;32mI (20592) Mymain_TAG: i = 1 ,j = 540 == 108.[0m
.[0;32mI (20602) Mymain_TAG: i = 1 ,j = 541 == 204.[0m
.[0;32mI (20612) Mymain_TAG: i = 1 ,j = 542 == 102.[0m
.[0;32mI (20622) Mymain_TAG: i = 1 ,j = 543 == 232.[0m
.[0;32mI (20632) Mymain_TAG: i = 1 ,j = 544 == 174.[0m
.[0;32mI (20642) Mymain_TAG: i = 1 ,j = 545 == 233.[0m
.[0;32mI (20652) Mymain_TAG: i = 1 ,j = 546 == 197.[0m
.[0;32mI (20662) Mymain_TAG: i = 1 ,j = 547 == 114.[0m
.[0;32mI (20672) Mymain_TAG: i = 1 ,j = 548 == 16.[0m
.[0;32mI (20682) Mymain_TAG: i = 1 ,j = 549 == 137.[0m
.[0;32mI (20692) Mymain_TAG: i = 1 ,j = 550 == 82.[0m
.[0;32mI (20702) Mymain_TAG: i = 1 ,j = 551 == 162.[0m
.[0;32mI (20712) Mymain_TAG: i = 1 ,j = 552 == 229.[0m
.[0;32mI (20722) Mymain_TAG: i = 1 ,j = 553 == 6.[0m
.[0;32mI (20732) Mymain_TAG: i = 1 ,j = 554 == 149.[0m
.[0;32mI (20742) Mymain_TAG: i = 1 ,j = 555 == 152.[0m
.[0;32mI (20752) Mymain_TAG: i = 1 ,j = 556 == 217.[0m
.[0;32mI (20762) Mymain_TAG: i = 1 ,j = 557 == 45.[0m
.[0;32mI (20772) Mymain_TAG: i = 1 ,j = 558 == 202.[0m
.[0;32mI (20782) Mymain_TAG: i = 1 ,j = 559 == 154.[0m
.[0;32mI (20792) Mymain_TAG: i = 1 ,j = 560 == 134.[0m
.[0;32mI (20802) Mymain_TAG: i = 1 ,j = 561 == 26.[0m
.[0;32mI (20812) Mymain_TAG: i = 1 ,j = 562 == 210.[0m
.[0;32mI (20822) Mymain_TAG: i = 1 ,j = 563 == 226.[0m
.[0;32mI (20832) Mymain_TAG: i = 1 ,j = 564 == 84.[0m
.[0;32mI (20842) Mymain_TAG: i = 1 ,j = 565 == 85.[0m
.[0;32mI (20852) Mymain_TAG: i = 1 ,j = 566 == 221.[0m
.[0;32mI (20862) Mymain_TAG: i = 1 ,j = 567 == 254.[0m
.[0;32mI (20872) Mymain_TAG: i = 1 ,j = 568 == 38.[0m
.[0;32mI (20882) Mymain_TAG: i = 1 ,j = 569 == 6.[0m
.[0;32mI (20892) Mymain_TAG: i = 1 ,j = 570 == 148.[0m
.[0;32mI (20902) Mymain_TAG: i = 1 ,j = 571 == 177.[0m
.[0;32mI (20912) Mymain_TAG: i = 1 ,j = 572 == 73.[0m
.[0;32mI (20922) Mymain_TAG: i = 1 ,j = 573 == 1.[0m
.[0;32mI (20932) Mymain_TAG: i = 1 ,j = 574 == 42.[0m
.[0;32mI (20942) Mymain_TAG: i = 1 ,j = 575 == 55.[0m
.[0;32mI (20952) Mymain_TAG: i = 1 ,j = 576 == 126.[0m
.[0;32mI (20962) Mymain_TAG: i = 1 ,j = 577 == 119.[0m
.[0;32mI (20972) Mymain_TAG: i = 1 ,j = 578 == 16.[0m
.[0;32mI (20982) Mymain_TAG: i = 1 ,j = 579 == 99.[0m
.[0;32mI (20992) Mymain_TAG: i = 1 ,j = 580 == 253.[0m
.[0;32mI (21002) Mymain_TAG: i = 1 ,j = 581 == 231.[0m
.[0;32mI (21012) Mymain_TAG: i = 1 ,j = 582 == 107.[0m
.[0;32mI (21022) Mymain_TAG: i = 1 ,j = 583 == 254.[0m
.[0;32mI (21032) Mymain_TAG: i = 1 ,j = 584 == 11.[0m
.[0;32mI (21042) Mymain_TAG: i = 1 ,j = 585 == 42.[0m
.[0;32mI (21052) Mymain_TAG: i = 1 ,j = 586 == 27.[0m
.[0;32mI (21062) Mymain_TAG: i = 1 ,j = 587 == 0.[0m
.[0;32mI (21072) Mymain_TAG: i = 1 ,j = 588 == 139.[0m
.[0;32mI (21082) Mymain_TAG: i = 1 ,j = 589 == 203.[0m
.[0;32mI (21092) Mymain_TAG: i = 1 ,j = 590 == 104.[0m
.[0;32mI (21102) Mymain_TAG: i = 1 ,j = 591 == 214.[0m
.[0;32mI (21112) Mymain_TAG: i = 1 ,j = 592 == 104.[0m
.[0;32mI (21122) Mymain_TAG: i = 1 ,j = 593 == 159.[0m
.[0;32mI (21132) Mymain_TAG: i = 1 ,j = 594 == 17.[0m
.[0;32mI (21142) Mymain_TAG: i = 1 ,j = 595 == 96.[0m
.[0;32mI (21152) Mymain_TAG: i = 1 ,j = 596 == 162.[0m
.[0;32mI (21162) Mymain_TAG: i = 1 ,j = 597 == 172.[0m
.[0;32mI (21172) Mymain_TAG: i = 1 ,j = 598 == 141.[0m
.[0;32mI (21182) Mymain_TAG: i = 1 ,j = 599 == 202.[0m
.[0;32mI (21192) Mymain_TAG: i = 1 ,j = 600 == 79.[0m
.[0;32mI (21202) Mymain_TAG: i = 1 ,j = 601 == 6.[0m
.[0;32mI (21212) Mymain_TAG: i = 1 ,j = 602 == 131.[0m
.[0;32mI (21222) Mymain_TAG: i = 1 ,j = 603 == 238.[0m
.[0;32mI (21232) Mymain_TAG: i = 1 ,j = 604 == 77.[0m
.[0;32mI (21242) Mymain_TAG: i = 1 ,j = 605 == 76.[0m
.[0;32mI (21252) Mymain_TAG: i = 1 ,j = 606 == 164.[0m
.[0;32mI (21262) Mymain_TAG: i = 1 ,j = 607 == 46.[0m
.[0;32mI (21272) Mymain_TAG: i = 1 ,j = 608 == 232.[0m
.[0;32mI (21282) Mymain_TAG: i = 1 ,j = 609 == 202.[0m
.[0;32mI (21292) Mymain_TAG: i = 1 ,j = 610 == 104.[0m
.[0;32mI (21302) Mymain_TAG: i = 1 ,j = 611 == 78.[0m
.[0;32mI (21312) Mymain_TAG: i = 1 ,j = 612 == 172.[0m
.[0;32mI (21322) Mymain_TAG: i = 1 ,j = 613 == 173.[0m
.[0;32mI (21332) Mymain_TAG: i = 1 ,j = 614 == 108.[0m
.[0;33mW (5) boot: PRO CPU has been reset by WDT..[0m
.[0;33mW (5) boot: WDT reset info: PRO CPU PC=0x0.[0m
.[0;33mW (5) boot: WDT reset info: APP CPU PC=0x40088023.[0m
.[0;32mI (9) boot: ESP-IDF v3.1-dev-361-g62f92454-dirty 2nd stage bootloader.[0m
.[0;32mI (16) boot: compile time 21:11:28.[0m
.[0;32mI (20) boot: Enabling RNG early entropy source....[0m
.[0;32mI (25) boot: SPI Speed : 40MHz.[0m
.[0;32mI (29) boot: SPI Mode : DIO.[0m
.[0;32mI (33) boot: SPI Flash Size : 4MB.[0m
.[0;32mI (37) boot: Partition Table:.[0m
.[0;32mI (41) boot: ## Label Usage Type ST Offset Length.[0m
.[0;32mI (48) boot: 0 nvs WiFi data 01 02 00009000 00006000.[0m
.[0;32mI (56) boot: 1 phy_init RF data 01 01 0000f000 00001000.[0m
.[0;32mI (63) boot: 2 factory factory app 00 00 00010000 00100000.[0m
.[0;32mI (71) boot: End of partition table.[0m
.[0;32mI (75) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x07ac0 ( 31424) map.[0m
.[0;32mI (95) esp_image: segment 1: paddr=0x00017ae8 vaddr=0x3ffb0000 size=0x021a0 ( 8608) load.[0m
.[0;32mI (98) esp_image: segment 2: paddr=0x00019c90 vaddr=0x40080000 size=0x00400 ( 1024) load.[0m
.[0;32mI (102) esp_image: segment 3: paddr=0x0001a098 vaddr=0x40080400 size=0x05f78 ( 24440) load.[0m
.[0;32mI (120) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x16924 ( 92452) map.[0m
.[0;32mI (153) esp_image: segment 5: paddr=0x00036944 vaddr=0x40086378 size=0x03620 ( 13856) load.[0m
.[0;32mI (159) esp_image: segment 6: paddr=0x00039f6c vaddr=0x400c0000 size=0x00000 ( 0) load.[0m
.[0;32mI (165) boot: Loaded app from partition at offset 0x10000.[0m
.[0;32mI (165) boot: Disabling RNG early entropy source....[0m
.[0;32mI (171) cpu_start: Pro cpu up..[0m
.[0;32mI (175) cpu_start: Starting app cpu, entry point is 0x40080e9c.[0m
.[0;32mI (0) cpu_start: App cpu up..[0m
.[0;32mI (185) heap_init: Initializing. RAM available for dynamic allocation:.[0m
.[0;32mI (192) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM.[0m
.[0;32mI (198) heap_init: At 3FFB29C0 len 0002D640 (181 KiB): DRAM.[0m
.[0;32mI (204) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM.[0m
.[0;32mI (211) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM.[0m
.[0;32mI (217) heap_init: At 40089998 len 00016668 (89 KiB): IRAM.[0m
.[0;32mI (223) cpu_start: Pro cpu start user code.[0m
.[0;32mI (241) cpu_start: Starting scheduler on PRO CPU..[0m
.[0;32mI (0) cpu_start: Starting scheduler on APP CPU..[0m
.[0;32mI (1030) Mymain_TAG: get_image_buf start.[0m
.[0;32mI (1030) Mymain_TAG: i = 0 ,j = 0 == 0.[0m
.[0;32mI (2332) Mymain_TAG: i = 0 ,j = 1 == 0.[0m
.[0;32mI (2342) Mymain_TAG: i = 0 ,j = 2 == 0.[0m
.[0;32mI (2352) Mymain_TAG: i = 0 ,j = 3 == 0.[0m
.[0;32mI (2362) Mymain_TAG: i = 0 ,j = 4 == 0.[0m
If I do so
Code: Select all
static void get_image_task(void* arg){
uint8_t *databuff = (uint8_t *)malloc(send_buff_size);//send_buff_size
while (1){
uint8_t i = 0;
uint16_t j = 0;
LED_ON();
ESP_LOGD(main_TAG, "%s","capture");
ov7670_capture();
ESP_LOGD(main_TAG, "%s","~capture");
ESP_LOGD(main_TAG, "%s","rrst");
ov7670_rrst();
ESP_LOGD(main_TAG, "%s","~rrst");
LED_OFF();
ESP_LOGI(main_TAG, "%s","get_image_buf start");
for (i = 0; i < 120; i ++)
for (j = 0; j < send_buff_size; j ++){
databuff[j] = ov7670_read();//read one byte from the buffer
//ESP_LOGI(main_TAG,"i = %d ,j = %d == %d",i,j,databuff[j]);
//vTaskDelay(10 / portTICK_RATE_MS);
}
for (j = 0; j < send_buff_size; j ++){
vTaskDelay(10 / portTICK_RATE_MS);
ESP_LOGI(main_TAG,"i = %d ,j = %d == %d",i,j,databuff[j]);
}
ESP_LOGI(main_TAG, "%s","get_image_buf end");
vTaskDelay(1000 / portTICK_RATE_MS);
}
free(databuff);
}
Code: Select all
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5632
ho 0 tail 12 room 4
load:0x40078000,len:0
load:0x40078000,len:13904
entry 0x40078fd8
.[0;32mI (30) boot: ESP-IDF v3.1-dev-361-g62f92454-dirty 2nd stage bootloader.[0m
.[0;32mI (30) boot: compile time 21:11:28.[0m
.[0;32mI (32) boot: Enabling RNG early entropy source....[0m
.[0;32mI (37) boot: SPI Speed : 40MHz.[0m
.[0;32mI (41) boot: SPI Mode : DIO.[0m
.[0;32mI (45) boot: SPI Flash Size : 4MB.[0m
.[0;32mI (49) boot: Partition Table:.[0m
.[0;32mI (53) boot: ## Label Usage Type ST Offset Length.[0m
.[0;32mI (60) boot: 0 nvs WiFi data 01 02 00009000 00006000.[0m
.[0;32mI (68) boot: 1 phy_init RF data 01 01 0000f000 00001000.[0m
.[0;32mI (75) boot: 2 factory factory app 00 00 00010000 00100000.[0m
.[0;32mI (83) boot: End of partition table.[0m
.[0;32mI (87) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x07ac0 ( 31424) map.[0m
.[0;32mI (107) esp_image: segment 1: paddr=0x00017ae8 vaddr=0x3ffb0000 size=0x021a0 ( 8608) load.[0m
.[0;32mI (110) esp_image: segment 2: paddr=0x00019c90 vaddr=0x40080000 size=0x00400 ( 1024) load.[0m
.[0;32mI (114) esp_image: segment 3: paddr=0x0001a098 vaddr=0x40080400 size=0x05f78 ( 24440) load.[0m
.[0;32mI (132) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x16938 ( 92472) map.[0m
.[0;32mI (165) esp_image: segment 5: paddr=0x00036958 vaddr=0x40086378 size=0x03620 ( 13856) load.[0m
.[0;32mI (171) esp_image: segment 6: paddr=0x00039f80 vaddr=0x400c0000 size=0x00000 ( 0) load.[0m
.[0;32mI (177) boot: Loaded app from partition at offset 0x10000.[0m
.[0;32mI (178) boot: Disabling RNG early entropy source....[0m
.[0;32mI (183) cpu_start: Pro cpu up..[0m
.[0;32mI (187) cpu_start: Starting app cpu, entry point is 0x40080e9c.[0m
.[0;32mI (178) cpu_start: App cpu up..[0m
.[0;32mI (198) heap_init: Initializing. RAM available for dynamic allocation:.[0m
.[0;32mI (204) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM.[0m
.[0;32mI (210) heap_init: At 3FFB29C0 len 0002D640 (181 KiB): DRAM.[0m
.[0;32mI (217) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM.[0m
.[0;32mI (223) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM.[0m
.[0;32mI (229) heap_init: At 40089998 len 00016668 (89 KiB): IRAM.[0m
.[0;32mI (236) cpu_start: Pro cpu start user code.[0m
.[0;32mI (254) cpu_start: Starting scheduler on PRO CPU..[0m
.[0;32mI (0) cpu_start: Starting scheduler on APP CPU..[0m
.[0;32mI (2170) Mymain_TAG: get_image_buf start.[0m
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction)
. Exception was unhandled.
Core 1 register dump:
PC : 0x400d26ae PS : 0x00060330 A0 : 0x800d2216 A1 : 0x3ffb74d0
A2 : 0x00000061 A3 : 0x3ffb25dc A4 : 0x3f402950 A5 : 0x00000008
A6 : 0x00000002 A7 : 0x00000005 A8 : 0x800d26ac A9 : 0x3ffb74a0
A10 : 0x3ff44000 A11 : 0x3ff44000 A12 : 0x3ffb74b0 A13 : 0x0000000c
A14 : 0x00000000 A15 : 0x3ffb5220 SAR : 0x00000006 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffa
Backtrace: 0x400d26ae:0x3ffb74d0 0x400d2213:0x3ffb74f0
Rebooting...