210 likes | 228 Views
This project presentation outlines the idea, aim, and implementation details of creating a radio controlled via JavaTM language using the TEA5764 radio chip through the I2C protocol. It covers the hardware connections, OSI layers involved, and the use of JNI for interfacing with the parallel port. Challenges faced and the solutions provided are also discussed.
E N D
JAVA RADIO iTÜ COMPUTER ENGINEERING INTERCONNECTION PROTOCOLS PROJECT PRESENTATION Ersan Öztürk-504041515 26/12/2005
OUTLINE • Idea • Aim • Radio Chip: TEA5764 • I2C • Parallel Port • Hardware Connection • OSI layers: physical, logical link • JNI • To do list • Problems encountered • Conclusion
IDEA • Cell phones that does not have radio on • 64% of cell phones support Java applications.* • People request music everytime, everywhere • *Source:GFK
AIM • IO control of the phones requires longer time, • So aim is: • Radio control via a PC using JavaTM language • A radio that can be controlled via PC: • TEA5764 • Can be controlled via I2C
Radio Chip:TEA5764 • Chip produced by Philips, • One of the smallest radio chips • It supports Radio Display System (RDS) • RDS: station, song, artist display • Control can be done via I2C • Consumes low power
I2C - definition • Inter Integrated Circuit • Syncronious Serial Communication COST COMPLEXITY SPEED LOW • Developed by Philips semiconductors in 1980’s • Used to control signal processing devices such as:RF tuners, video decoders,audio processors, EEPROMS, real time clocks etc.
I2C - Basics • Two lines: bidirectional communitaction Dev. 1 Master SDA:Serial Data Dev. 2 Slave SCL:Serial Clock • Intiates and finishes communication • Establishes syncronization by clock • Determines data direction • Responds when addressed, at the time given by master
I2C – Communication1 • SEND / WRITE START address R/W A_S Byte1 A_S ..... A_S STOP 0010000 0 XXXXXXXX .... RECEIVE / READ START address R/W A_S Byte1 A_M ..... NAMSTOP 0010000 0 XXXXXXXX A_S: Acknowledge by slave A_M:Acknowledge by master NAM:Non Acknowledge by master
I2C – Communication2 SDA:HIGH > LOW • START SCL:HIGH STOP SDA:LOW > HIGH SCL:HIGH ACK_MASTER SDA:LOW BY MAS. SCL:PULSE ACK_SLAVE SDA:LOW BY SLA. SCL:PULSE NON_ACK_MASTER SDA:HIGH BY MAS. SCL:PULSE
Parallel Port - 1 • 8 pins are bidirecitional used for data accessed via DATA PORT • 5 pins are input accessed via STATUS PORT • (one is inverted) • 4 pins are output accesses via CONTROL PORT (three are inverted) • Remaining pins are Grounded
Parallel Port - 2 DATA (378|278|3BC) STATUS (DATA+1) CONTROL (DATA+2) D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0 BUSY D7 D6 D5 D4 D3 D2 D1 D0 RESERVED DATA7 DATA6 ~ACK RESERVED DATA5 PE DIRECTION DATA4 SELECT IRQENABLE DATA3 ~ERROR ~SELECTIN DATA2 IRQ INIT DATA1 RESERVED ~AUTOFEED DATA0 RESERVED ~STROBE Windows NT,2000 and XP does not let user programs to reach memory addesses. Windows 98,ME let it!
Hardware Connection PIN2 PIN16 SDA TEA5764 SPEAKER PARALLEL PORT SCL PIN18-25 GND VCC VDD VREFDIG PIN2: DATA PORT 0 PIN16:CONTROL PORT 2
Coding – Physical Layer • void Zero() • { • SDA(LOW); • delay (DELAY_MILIS,DELAY_NANOS); • SCL(HIGH); • delay (DELAY_MILIS,DELAY_NANOS); • SCL(LOW); • delay (DELAY_MILIS,DELAY_NANOS); • } void One() { SDA(HIGH); delay (DELAY_MILIS,DELAY_NANOS); SCL(HIGH); delay (DELAY_MILIS,DELAY_NANOS); SCL(LOW); delay (DELAY_MILIS,DELAY_NANOS); } void SDA(int state) { if(state==0)lpt1.write_data (0x0000); elselpt1.write_data (0x0001); }
Coding – Network & Procol Layer • void radio_power(int onoff){ • FMWrite(); • if(ack_slave()==0) • writebyte(0x00ff); // byte0W • if(ack_slave()==0) • writebyte(0x002f); // byte1W : 00101111 • if(ack_slave()==0) // 100.0 mhz • writebyte(0x00ca); // byte2W : 11011010 • if(ack_slave()==0) • if(onoff==1) • writebyte(0x0040); // byte3W : 01000000 • else • writebyte(0x0000); // byte3W : 00000000 • if(ack_slave()==0) • Stop(); • }
Java Native Interface (JNI) • A framework that enables Java codes to call native applications and libraries of languages such as C, C++ and assembly • It is mostly used for operating system and hardware related functions
JNI - Parport • import parport.ParallelPort; • class SimpleIO { • public static void main ( String []args ) • { • ParallelPort lpt1 = new ParallelPort(0x378); • int aByte; • aByte = lpt1.read(); // read a byte from the port's STATUS pins • aByte = aByte >> 2; // a simple and irrelevant operation • lpt1.write(aByte); // write a byte to the port's DATA pins • System.out.println("Output to port: " + aByte); • } • } Java Radio lpt1.read_data() In C language inportb(DATA) Java Radio lpt1.write_data(aByte) In C language outportb(DATA,aByte)
Problems Encountered • P1)Unsigned bytes are not avaliable in Java • S1)Integers were used instead of bytes • P2)Win XP not allow to reach parallel port • S2)Userport and DirectIO used then Win98 is used • P3)Java Comm is not flexible enough • S3)JNI is used, • P4)Data port used as unidirectional • S4)Parallel Port is set to Enhanced Parallel Port (EPP) from BIOS and direction selection is used on Control Port • P5)Can not get output from radio • S5)Still working on it!!!
To do list • Finish the code and test functions in details • Establish RDS • Implement the code in mobile phone emulators • Differenciate code according to different mobile phone IOs and Java supports • Marketing the radio to manufacturers nationwide • Marketing the radio worldwide • Make money$
Conclusion • Project taught: • One of the basic interconnection protocols I2C • One of the basic connection components of PC: The Parallel Port • Control mechanisms of chips • Use of Java in low level (JNI) • At the end it can be a success in business.