UNC at Charlotte Embedded Systems Lab

Lab Exercises / Educational Materials

  Home page - Educational Materials   |  Home page - James Conrad |  UNC at Charlotte ECE Dept.  |   UNC at Charlotte
 

Building an IR Communication Device

This page updated

May 12, 2004



 

 

Infra Red Communication Device Lab 1

This lab introduced students to interfacing two MSV30262-SKP boards via an Infrared (IR) Link.  In this lab Student utilized onboard timers, serial UARTs, and I/O ports of the starter kit to create an IR communications device. The main objective was to create a board which can attach to a PC and transmit/receive data via an IR link. Two boards were programmed with the same code and had the same IR hardware. IR hardware was provided. Two serial cables and one PC with two serial ports were needed.

 

Requirements

 

Req. 1 – The code generated is written in C for the Renesas MSV30262-SKP

Req. 2 – Both boards should run the same code

Req. 3 – The serial communications with the PC should operate at 9600 baud 8,N,1

Req. 4 – HyperTerm will be used to transmit and receive characters (you can run it on one PC with two serial ports, but with two HyperTerm applications open).

Req. 5 – The general operation will be that a character will be typed in a HyperTerm window, transmitted via RS-232 link to one board, transmitted via IR link to another board, then transmitted

via RS-232 link to another HyperTerm window. This transmission is bi-directional.

Req. 6 – Transmit via IR with three start bits, seven data bits, one parity bit (odd), and two stop bits.

Req. 7 – Transmit via IR only valid ASCII character, between 0x20 and 0x7F, except ACK and NAK

Req. 8 – Each IR transmitted byte should be acknowledged. The receiving board should acknowledge a valid transmission with a NAK character (0x06). If the transmission is invalid, acknowledge with a NAK (0x15).

Req. 9 – A valid IR transmission will be characterized by the correct number and type of start, data, parity, and stop bits.

Req. 10 – A valid IR transmission will have the correct parity.

Req. 11 – Each byte transmitted via IR should be acknowledged within 0.01 seconds.

Req. 12 – The LCD does not need to show characters, but can be used during debug.

Req. 13 – Use the Vishay IR hardware provided by the professor.

Req. 14 – The minimum transmission distance is 1.5 meters .

Req. 15 – The IR hardware should be powered by the Renesas boards.

Req. 16 – The PC will send one character every 5 seconds (no need for queues).

 

 

Infra Red Communication Device  and “Speeding it up” Lab 2

This lab extended lab 1 (interfacing two MSV30262-SKP boards via an Infrared (IR) Link) by making the link run faster, and operate in duplex.

 

Requirements

Changes to the Requirements (from lab 1) are in bold lettering.

Req. 1 – The code generated is written in C for the Renesas MSV30262-SKP

Req. 2 – Both boards should run the same code

Req. 3 – The serial communications with the PC should operate at 19200 baud 8,N,1

Req. 4 – HyperTerm will be used to transmit and receive characters (you can run it on one PC with two serial ports, but with two HyperTerm applications open).

Req. 5 – The general operation will be that a character will be typed in a HyperTerm window, transmitted via RS-232 link to one board, transmitted via IR link to another board, then transmitted via RS-232 link to another HyperTerm window. This transmission is bi-directional.

Req. 6 – Transmit via IR with three start bits, eight data bits, one parity bit (odd), and two stop bits.

Req. 7 – Transmit via IR all values between 0x00 and 0xFF, including ACK and NAK

Req. 8 – Each IR transmitted byte should be acknowledged. The receiving board should acknowledge a valid transmission with a NAK character (0x06). If the transmission is invalid, acknowledge with a NAK (0x15).

Req. 9   – A valid IR transmission will be characterized by the correct number and type of start, data, parity, and stop bits.

Req. 10 – A valid IR transmission will have the correct parity.

Req. 11 – Each byte transmitted via IR should be acknowledged within 0.01 seconds.

Req. 12 – The LCD does not need to show characters, but can be used during debug.

Req. 13 – Use the Vishay IR hardware provided by the professor.

Req. 14 – The minimum transmission distance is 1.5 meters .

Req. 15 – The Vishay IR hardware should be powered by the Renesas boards.

Req. 16 – The PC will send one character every 0.01 seconds (you will need queues to transmit the data fast enough).

 

Infra Red Communication Device and Sending Packet data Lab 3

This lab extended  lab 2 (interfacing two MSV30262-SKP boards via an Infrared (IR) Link  by making the link run faster, operate in duplex, and send data more efficiently using packets.

Lab 1 and 2 required users to send data one byte at a time, with a large number of overhead bits (3 start, 1 parity, and 2 stop bits). If you consider the ACK/NAK response to a sent byte, you would need to send 28 bits for every 8 bits of useful data (29% of bits sent are useful data). In the world of computer data communications, we often “pack” together many bytes of data into a “packet”. Each

packet had a starting byte for synchronization and must carried other information to indicate packet details. Specifically, the pack for this lab had:

  •  Byte 1: Sync byte (xA5)

  •  Byte 2: Source board identifier – Board sending this packet (each group was given two identifiers, one for each board)

  •  Byte 3: Destination board identifier – board which received the packet (each group was given two identifiers, one for each board)

  • Byte 4: Size – size, in bytes, of the DATA of the packet (didn't count header or tail info)

  • Byte 5 to n+4: The n bytes of data (maximum of 80 bytes of data)

  • Byte n+5: Checksum – added all of the header and data bytes together (not the checksum byte),

    send only the lowest 8 bits of the sum (performed an unsigned add, discarded all of the carry bits each addition)

                  For this lab student had an option to implement the protocol using wired link or IR hardware. While implementing this lab assignment students faced problem while sampling as board timer didn't give the desired level of precision. Later on students where given option to transmit each packet with start bit.

 

Requirements

 

Changes to the Requirements (from lab 2) are in bold lettering.

Req. 1 – The code generated is written in C for the Renesas MSV30262-SKP

Req. 2 – Both boards should run the same code

Req. 3 – The serial communications with the PC should operate at 19200 baud 8,N,1

Req. 4 – HyperTerm will be used to transmit and receive characters (you can run it on one PC with

two serial ports, but with two HyperTerm applications open).

Req. 5 – The general operation will be that a character will be typed in a HyperTerm window,

transmitted via RS-232 link to one board, transmitted via IR or wired link to another board, then

transmitted via RS-232 link to another HyperTerm window. This transmission is bi-directional.

Req. 6 – Transmit via IR or wired link with four header bytes, up to 80 data bytes, and one checksum byte is a single transmission.

Req. 7 – Transmit via IR or wired link all values between 0x00 and 0xFF, including ACK and NAK

Req. 8 – Each IR or wired link transmitted packet should be acknowledged. The receiving board should acknowledge a valid transmission with a NAK data character (0x06). If the transmission is invalid, acknowledge with a NAK (0x15). ACK and NAK packets also need the 4 byte header and checksum bytes (and will be 1 data byte).

Req. 9 – A valid IR or wired link transmission will be characterized by the correct packet information (correct sync byte, correct source, correct number of data bytes compared to what should have been sent) and checksum.

Req. 10 – A valid IR or wired link transmission will have the correct parity.

Req. 11 – Each byte transmitted via IR or wired link should be acknowledged within 0.01 seconds.

Req. 12 – The LCD does not need to show characters, but can be used during debug.

Req. 13 – Use the Vishay IR hardware provided by the professor (if IR is used).

Req. 14 – The minimum transmission distance is 1.5 meters .

Req. 15 – The Vishay IR hardware should be powered by the Renesas boards.

Req. 16 – The PC will send one character every 0.01 seconds (you will need queues to buffer the input). Send the buffered data to the other board when the CR or LF byte is sent from the PC (x0D or x0A)

Req. 17 – Ignore all packets where you are not the destination packet. If the source was not your “paired” board, send a NAK.

Req. 18 – Ignore all “garbage” messages (cannot determine correct header information).

Req. 19 – The same code should be used on both boards. Determine the board number (between the two provided to your group) based on a SW2/SW3 button press.