如题, 探索者开发板 ucosii +lwip tcpip 客户端 实验例程 添加相关的 摄像头实验的OV2640的相关代码,进入RGB565模式后出现屏幕乱跳的情况。
甚是不解,综合实验集成了ucosii 和 OV2640初始化 及dcmi 配置代码却不会出现这样的异常情况
初始化流程如下 代码
int main(void)
{
u32 total,free;
//u8 t=0;
delay_init(168); //延时初始化
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //中断分组配置
uart_init(115200); //串口波特率设置
usmart_dev.init(84); //初始化USMART
LED_Init(); //LED初始化
KEY_Init(); //按键初始化
LCD_Init(); //LCD初始化
AT24CXX_Init(); //IIC初始化
FSMC_SRAM_Init(); //SRAM初始化
TIM3_Int_Init(10000-1,8400-1);//10Khz计数,1秒钟中断一次
mymem_init(SRAMIN); //初始化内部内存池
mymem_init(SRAMEX); //初始化外部内存池
mymem_init(SRAMCCM); //初始化CCM内存池
POINT_COLOR = RED; //红色字体
LCD_ShowString(30,30,200,20,16,"Explorer STM32F4");
LCD_ShowString(30,50,200,20,16,"TCP CLIENT NETCONN Test");
LCD_ShowString(30,70,200,20,16,"ATOM@ALIENTEK");
LCD_ShowString(30,90,200,20,16,"KEY0:Send data");
LCD_ShowString(30,110,200,20,16,"2014/9/1");
POINT_COLOR = BLUE; //蓝色字体
while(AT24CXX_Check())//检测不到24c02
{
//LCD_ShowString(30,150,200,16,16,"24C02 Check Failed!");
printf("24C02 Check Failed!!\r\n");
delay_ms(500);
//LCD_ShowString(30,150,200,16,16,"Please Check! ");
printf("Please Check!\r\n");
delay_ms(500);
LED0=!LED0;//DS0闪烁
}
//LCD_ShowString(30,150,200,16,16,"24C02 Ready!");
printf("24C02 Ready!\r\n");
sw_sdcard_mode();//io 口复用切换到sd卡功能
while(SD_Init())//检测不到SD卡
{
LCD_ShowString(30,150,200,16,16,"SD Card Error!");
delay_ms(500);
LCD_ShowString(30,150,200,16,16,"Please Check! ");
delay_ms(500);
LED0=!LED0;//DS0闪烁
}
exfuns_init(); //为fatfs相关变量申请内存
f_mount(fs[0],"0:",1); //挂载SD卡
while(exf_getfree("0",&total,&free)) //得到SD卡的总容量和剩余容量
{
LCD_ShowString(30,150,200,16,16,"SD Card Fatfs Error!");
delay_ms(200);
LCD_Fill(30,150,240,150+16,WHITE); //清除显示
delay_ms(200);
LED0=!LED0;//DS0闪烁
}
POINT_COLOR=BLUE;//设置字体为蓝色
LCD_ShowString(30,190,200,16,16,"FATFS OK!");
LCD_ShowString(30,210,200,16,16,"SD Total Size: MB");
LCD_ShowString(30,230,200,16,16,"SD Free Size: MB");
LCD_ShowNum(30+8*14,170,total>>10,5,16); //显示SD卡总容量 MB
LCD_ShowNum(30+8*14,190,free>>10,5,16); //显示SD卡剩余容量 MB
#if 1
sw_ov2640_mode();
while(OV2640_Init())//初始化OV2640
{
LCD_ShowString(30,170,240,16,16,"OV2640 ERR");
delay_ms(200);
LCD_Fill(30,170,239,170,WHITE);
delay_ms(200);
}
printf("OV2640 init success!\r\n");
LCD_ShowString(30,170,200,16,16,"OV2640 OK");
OV2640_RGB565_Mode(); //RGB565模式
My_DCMI_Init(); //DCMI配置
DCMI_DMA_Init((u32)&LCD->LCD_RAM,1,DMA_MemoryDataSize_HalfWord,DMA_MemoryInc_Disable);//DCMI DMA配置
//DCMI_DMA_Init((u32)&LCD->LCD_RAM,0,1,DMA_MemoryDataSize_HalfWord,DMA_MemoryInc_Disable);//DCMI DMA配置
OV2640_OutSize_Set(lcddev.width,lcddev.height);
DCMI_Start(); //启动传输
#endif
OSInit(); //UCOS初始化
while(lwip_comm_init()) //lwip初始化
{
LCD_ShowString(30,130,200,20,16,"Lwip Init failed!"); //lwip初始化失败
delay_ms(500);
LCD_Fill(30,130,230,150,WHITE);
delay_ms(500);
}
LCD_ShowString(30,130,200,20,16,"Lwip Init Success!"); //lwip初始化成功
while(tcp_client_init()) //初始化tcp_client(创建tcp_client线程)
{
LCD_ShowString(30,150,200,20,16,"TCP Client failed!!"); //tcp客户端创建失败
delay_ms(500);
LCD_Fill(30,150,230,170,WHITE);
delay_ms(500);
}
LCD_ShowString(30,150,200,20,16,"TCP Client Success!"); //tcp客户端创建成功
OSTaskCreate(start_task,(void*)0,(OS_STK*)&START_TASK_STK[START_STK_SIZE-1],START_TASK_PRIO);
OSStart(); //开启UCOS
}
|