Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).
Hi!
Iam doing the i2c programming for video encoder in the BF533 EZ-kit lite ...
Actually i want to brief my coding thats why iam explaining all these..please
see upto end...........and help me
Here start cond is sdata=1 to 0 when sclk is high and sdata is PF1 and SCLK is PF0... Slave
Address of video encoder specified in data sheet is:01010110 lsb is for writing 1st bit is for
ALSB bit(tied to gnd)..
Iam pasting my example code here.......i don't know the problem
Actually i want to test whether the slave is responding or not so uptothat only have written
the code..
First i have configured the PF0 and PF1 as outputs and i have given the start condition and
after that i have sent the slave address then to have ACK i have configured the PF1(SDATA) as
input and i have checked the condtion whether the slave pulled the line low or not if it is low
means i have glown some led in the kit for the identification..
#include <cdefBF533.h>
#define pFlashA_PortB_Dir (volatile unsigned char *)0x20270007
#define pFlashA_PortB_Data (volatile unsigned char *)0x20270005
#define pFlashA_PortA_Dir (volatile unsigned char *)0x20270006
#define pFlashA_PortA_Data (volatile unsigned char *)0x20270004
void Init_EBIU(void)
{
*pEBIU_AMBCTL0 = 0x7bb07bb0; // <--|Write access time = 7 cycles, read access time = 11
cycles, no ARDY
*pEBIU_AMBCTL1 = 0x7bb07bb0; // |Hold time = 2 cycles, setup time = 3 cycles, transition time =
4 cycles
*pEBIU_AMGCTL = 0x000F; // |Enable all memory banks
}//end Init_EBIU
void main()
{
unsigned int a=1,i=4000,t;
Init_EBIU();
///////////we have to reset the video encoder
////////////////////////////////////////////////
*pFlashA_PortA_Dir=0x0004;
*pFlashA_PortA_Data=0x0000;//reset the encoder
*pFlashA_PortA_Data=0x0004;//enable the encoder
////////////////////////////////////////////////
*pFIO_DIR=0x0003;
//issue START condition PF0=1 and PF1=1 to 0
*pFIO_FLAG_D=0x0001;
t=i;
while(t--);
*pFIO_FLAG_D=0x0003;
t=i;
while(t--);
*pFIO_FLAG_D=0x0001;
//send the slave address and wait for ACK signal(LOW signal on DATA bus)
//Slave address 01010110 for 0--->PF0 0 to 1(1 cycle) and PF1=0;
// 1--->PF0 0 to 1(1 cycle) and PF1=1;
*pFIO_FLAG_D=0x0000;
*pFIO_FLAG_D=0x0001;
*pFIO_FLAG_D=0x0002;
*pFIO_FLAG_D=0x0003;
*pFIO_FLAG_D=0x0000;
*pFIO_FLAG_D=0x0001;
*pFIO_FLAG_D=0x0002;
*pFIO_FLAG_D=0x0003;
*pFIO_FLAG_D=0x0000;
*pFIO_FLAG_D=0x0001;
*pFIO_FLAG_D=0x0002;
*pFIO_FLAG_D=0x0003;
*pFIO_FLAG_D=0x0002;
*pFIO_FLAG_D=0x0003;
*pFIO_FLAG_D=0x0000;
*pFIO_FLAG_D=0x0001;
// Wait for the ACK signal............
*pFIO_DIR =0x0002; //PF1 is now input
*pFIO_POLAR=0x0000;
*pFIO_EDGE =0x0000;
*pFIO_INEN =0x0002;
*pFIO_FLAG_C=0x0001;
if((*pFIO_FLAG_D) & 0x0002 == 0)
*pFlashA_PortB_Data=0x0001;
else *pFlashA_PortB_Data=0x0020;
*pFIO_FLAG_D=0x0001;
}
Thank u in adwance.......