标签:cti change net wait 培养 assert snippet sni get
Chipscope 仿真VmodCAM IIC程序:
目的:熟悉EDK中建立chipscope
注意:zedboard使用digilent USB下载时,chipscope不能和SDK同一时候使用。否则芯片会死机。
要用仿真器烧敲代码。
0x30,0x00,0x00,0x00, // Chip version. Default 0x1580 !! only for read !! 0x33,0x86,0x05,0x01, // MCU Reset 0x32,0x90,0x00,0x01, // test pattern 0x32,0x92,0x00,0x00, // R pattern 0x32,0x94,0x00,0xff, // G pattern 0x32,0x96,0x00,0x00, // B pattern 0x33,0x86,0x05,0x00, // MCU Release from reset 0x32,0x14,0x0D,0x85, // Slew rate control, PCLK 5, D 5 0x34,0x1E,0x8F,0x09, // PLL control; bypassed, powered down 0x34,0x1C,0x02,0x30, // PLL dividers; M=80,N=2,fMCLK=fCLKIN*M/(N+1)/8=24MHz 0x34,0x1E,0x8F,0x09, // PLL control; Power-up PLL; wait 1ms after this! 0x34,0x1E,0x8F,0x08, // PLL control; Turn off bypass 0x32,0x02,0x00,0x08, // Standby control; Wake up
0x33,0x8C,0x27,0x97, // Output format; Context B shadow 0x33,0x90,0x00,0x20, // RGB with BT656 codes
0x33,0x8C,0x27,0x2F, // Sensor Row Start Context B 0x33,0x90,0x00,0x04, // 4 0x33,0x8C,0x27,0x33, // Sensor Row End Context B 0x33,0x90,0x04,0xBB, // 1211 0x33,0x8C,0x27,0x31, // Sensor Column Start Context B 0x33,0x90,0x00,0x04, // 4
0x33,0x8C,0x27,0x35, // Sensor Column End Context B 0x33,0x90,0x06,0x4B, // 1611 0x33,0x8C,0x27,0x07, // Output width; Context B 0x33,0x90,0x02,0x80, // 640 0x33,0x8C,0x27,0x09, // Output height; Context B 0x33,0x90,0x01,0xE0, // 480
0x33,0x8C,0x27,0x5F, // Crop X0; Context B 0x33,0x90,0x00,0x00, // 0 0x33,0x8C,0x27,0x63, // Crop Y0; Context B 0x33,0x90,0x00,0x00, // 0 0x33,0x8C,0x27,0x61, // Crop X1; Context B 0x33,0x90,0x06,0x40, // 1600 0x33,0x8C,0x27,0x65, // Crop Y1; Context B 0x33,0x90,0x04,0xB0, // 1200
0x33,0x8C,0x27,0x41, // Sensor_Fine_IT_min B 0x33,0x90,0x01,0x69, // 361 0x33,0x8C,0xA1,0x20, // Capture mode options 0x33,0x90,0x00,0xF2, // Turn on AWB, AE, HG, Video 0x33,0x8C,0xA1,0x03, // Refresh Sequencer Mode 0x33,0x90,0x00,0x02, // Capture 0x33,0x90,0x00,0x00, // Read until sequencer in mode 0 (run) 0x30,0x1A,0x02,0xCC, // reset/output control; parallel enable, drive pins, start streaming
/*****************************************************************************/ /** * This function is initial the iic_0. * * @param None. * * @return The number of bytes sent. * * @note None. * ****************************************************************************/ int IIC_Initial( XIic *IicInstance, u16 DeviceId) { XIic_Config *IICConfigPtr; /* Pointer to configuration data */ Xil_AssertNonvoid(IicInstance != NULL); /* * Initialize the IIC driver so that it is ready to use. */ IICConfigPtr = XIic_LookupConfig(DeviceId); if (IICConfigPtr == (XIic_Config *) NULL) { IicInstance->IsReady = 0; return (XST_DEVICE_NOT_FOUND); } return XIic_CfgInitialize(IicInstance, IICConfigPtr,IICConfigPtr->BaseAddress); }
int Vmod_CameraA_IIC_Config() { unsigned ByteCount=0; int i = 0; u8 ReadCamera_ChipVersion_Add[2] = {0x30,0x00}; u8 ReadCamera_ChipVersion_Rdata[2]; u16 Chip_Version = 0; printf("Here we go\n"); printf("Config the Camera\n"); read_camera_config(XPAR_CAMER_IIC_A_BASEADDR,ReadCamera_ChipVersion_Add,ReadCamera_ChipVersion_Rdata); Chip_Version = (ReadCamera_ChipVersion_Rdata[0] << 8) | ReadCamera_ChipVersion_Rdata[1]; printf("Read Chip Version is:0x%x\n",Chip_Version); for(i=0;i<MT9D112_CONFIG_BUFFER_ROWS;i++) { ByteCount += XIic_Send(XPAR_CAMER_IIC_A_BASEADDR,CAMERA_ADDRESS_ID,MT9D112_CONFIG_BUFFER[i],4,XIIC_STOP); } if(MT9D112_CONFIG_BUFFER_ROWS*4 == ByteCount) { printf("Camera Initialize success\n"); printf("Camera Initialize ByteCount is:%d\n",ByteCount); return ByteCount; } else printf("Camera Initialize fail\n"); } void read_camera_config (u32 BaseAddress, u8 *sub_addr, u8 *RdData) { u8 sent_byte_count; u8 received_byte_count; RdData[0] = 0; RdData[1] = 0; xil_printf("Read\t"); sent_byte_count = XIic_Send(BaseAddress, 0x78>>1, sub_addr, 2, XIIC_STOP); //write sub-address if (sent_byte_count != 2) xil_printf("Sent %d bytes\t", sent_byte_count); received_byte_count = XIic_Recv(BaseAddress, 0x79>>1, RdData, 2, XIIC_STOP); //read 2 byte datas if (received_byte_count != 2) xil_printf("Received %d bytes\r\n", received_byte_count); else xil_printf("0x%02x 0x%02x\r\n", RdData[0], RdData[1]); }
硬件写地址0x78 读地址0x79
訪问方式:
1、通过直接的硬件寄存器訪问
2、通过驱动变量进行配置。这样的配置都是靠R[0X338C]与R[0X3390]两个硬件寄存器间接訪问,R[0X338C]是选择驱动变量的寄存器。R[0X3390]则是设置相应驱动变量的值。
图 1 驱动变量地址
寄存器上电的初始值
首先就能够读取摄像头的ID 地址是R[0X3000],读取的ID应该是0X1580.
然后复位MCU
PLL配置包含R[0X341C]用于PLL输出(PCLK)频率设置。PCLK = MCLK*M/((N+1)/8), R[0X341E]用于设置PLL工作与否 还有旁路有否。
假设想要旁路掉PLL那么R[0X341E]【0】必须设置为1,假设有功耗要求,能够将R[0X341E]【1】设置为1来关闭PLL 。
假设要打开PLL。那么以上两位必须设置为0.在默认情况下。都是关闭和旁路掉PLL的。
Any changes to PLL settings must be done with PLL bypassed (R0x341E[0]=1). (当须要改动PLL的參数时必须保持PLL在旁路状态)
PLL programming and power-up sequence is as follows:
1. Program PLL frequency settings, R0x341C (pll_m, pll_n) (master clock frequency is
equal to fVCO_pll/8). With default settings master clock frequency of 80 MHz is
obtained with fCLKIN=16MHz.
2. Power up PLL, R0x341E[1] = 0.
3. Wait for PLL settling time > 1ms.
4. Turn off PLL bypass, R0x341E[0] = 0.
实验室让我失望。生活让我失望。是我没看透还是我看得太透彻了,假设上天是要我早点死亡,那么就请快点吧,我已经厌倦了这个社会,厌倦了这个地方。厌倦了每个人每一件事,讨厌每个人和每一件事,看不惯那些人的嘴脸,看不惯他们的有色眼镜。讨厌那些每天仅仅靠嘴脸生活的人。一个错误的选择真的是能够改变一生,我真的是深深的体会到了,一个选择并非至改变了这件事本身,而是接下来的一些列有关的事情,会让人越陷越深。越来越错误的走下去。霉运也会接踵而至。
不是本命年那么简单。哎这些人的肤浅让我感觉非常郁闷。
如今我最想做的事情就是退学走人。什么都不想做。早日离开这个是非之地是最好的方法。我相信我已经读不完三年了。
这基本是肯定了的。
为什么会是这样的。实验室为什么会是如今这样的状态,人多力量比蚂蚁还不如,管理员带几十个所谓的研究生,并且态度极其恶劣,真不知道这样的学校何时能发展。我敢打赌,学校假设不注意培养学生,迟早有一天会灭亡的。
腐朽之气充满整个校园。话说回来,关我什么事呢。我又不是玉皇大帝,改变不了什么现状。管他的,做自己事情,让别人说去吧。
迟早有一天结果会是和我想的一样。仅仅重视所谓的教学成果,不去实际钻研。迟早会失败的。我是得罪了谁啊。生活折磨我。身体折磨我。死不死由谁决定啊?假设我知道的话我一定会叫他早点把我勾上吧。
标签:cti change net wait 培养 assert snippet sni get
原文地址:http://www.cnblogs.com/mfmdaoyou/p/7134305.html