introduction

VoIP is a hot technology today, and more and more users have proposed to build a wireless network on the user side of the VoIP network. In the traditional sense, the VoIP terminal acts as a VoIP gateway. Many of the current solutions use Bluetooth or other technologies, and it is not difficult to find that these technologies have the disadvantages of high cost and complicated technology. The Freescale MC13192 is a low-power RF chip with low cost, low power consumption, and stable performance for RF chips in low-rate wireless networks. The user can implement the construction of a wireless network through the chip and the zigbee protocol stack, which has been commonly used for home appliance control. This paper introduces a solution to realize VoIP two-way voice communication using this technology, and is a new low-cost, low-power solution for wireless voice networks.

Design Implementation Introduction to MC13192

The Freescale MC13192 transceiver is a typical ZigBee product. The chip uses a 16-channel, 2.4 GHz band with a data rate of 250 kb/s. They can be used in conjunction with 32-bit embedded controllers such as Freescale's MCF523x family. The MC13192 uses a standard 4-wire SPI and 7 GPIOs to communicate with the MCU. The MCU can set and acquire the MC13192 registers by reading and writing to the SPI. It can also set the MC13192 specific pin high by setting the level of a specific GPIO. Or pull it low.

Communication between MC13192 and 32-bit embedded processor

Due to the difference between the processor and the development board, the pins connecting the MCU and the MC13192 will be different. Therefore, in order to achieve normal communication between the MC13192 and the MCU, the direction and function of the related pins must be configured first. The scheme described in this paper is based on flying. The chip MCF5234 platform, the platform's pin correspondence with the MC13192 is shown in Table 1.

The configuration of the pin is divided into three parts: initialization of QSPI, initialization of GPIO, and configuration of interrupt pins. The configuration of QSPI and interrupt pins is relatively simple. Let's first introduce these two parts.

The initialization of QSPI is to complete the initialization of the mode register and the surround register. It is worth mentioning that the mode register initialization needs to set the macro MCF_QSPI_QMR_BAUD(x). This macro is used to set the baud rate of QSPI. The value x in parentheses needs to be based on the hardware environment. And the clock frequency of the QSPI required by the user to determine, the formula is:

x=system clock frequency

4xQSPI clock frequency

The MCF5234 has a clock frequency of 150MHz. The QSPI used in this system has a frequency of 2MHz, so the baud rate is approximately equal to 19. The initialization of the interrupt pin is simpler. The initialization process includes the trigger mode, pin direction, and interrupt enable three steps. The trigger mode needs to select the falling edge trigger, and the pin direction should be set as the output. Since the MC13192 uses IRQ3, the interrupt from IRQ3 is finally allowed.

The initialization of GPIO is mainly divided into three steps: pin configuration, direction register initialization, and initialization of data registers. First, you need to configure the GPIO pins to be used as GPIO functions, and then configure these pins as outputs (because these pins are used by the MCU to control the MC13192, the direction is output from the MCU), and finally on these pins. The data is configured as an initial value.

Through the above steps, the pin connection of the RF chip and the MCU is completed, and the next step can be designed.

Implementation of IEEE 802.15.4 Protocol MAC Layer

Since the solution needs to transmit voice data through the radio frequency chip, it needs a reliable MAC layer protocol support, and part of the IEEE802.15.4 protocol can be used to meet the requirements of the solution. Since the MC13192 includes four timers, it can These four timers are used to divide the time slot to implement time division multiplexing.

Network structure design

The solution implements two-way voice communication, that is, two handheld devices communicate with the gateway through a wireless network, and the gateway connects to the Internet through a wired network. The handheld device can talk to the outside world at the same time.

MAC protocol design

In this solution, the time slot is used to implement the multiplexing of two voices, so the strict synchronization of the time slot between the handheld device and the gateway is required. According to the protocol, every 16 time slots act as a superframe, and the gateway sends a Baecon frame in the first time slot of each superframe. The second to eighth time slots are competing time slots, so these 7 are reserved in this scheme. Time slot, the 9th to the 16th slot is a non-contention time slot, used for time division multiplexing. In this solution, 8 time slots are divided into 4 parts for uplink and downlink data transmission of two handheld devices.

Implementation of MAC protocol

The MC13192 has four timers. Each timer generates an interrupt at the end of the timer. The MC13192 interrupt status register can be used to learn the interrupt source. For example, when the timer 1 timer expires, an interrupt will be generated. The 9th bit of the register is set high, so the processing of the timer interrupt is added to the interrupt service routine, which can realize the division of the time slot, and determine the data transmission and reception according to the current number of time slots, which can be required by the MAC layer protocol. The function. In this design, we use 30ms as the length of a superframe. Taking the gateway as an example, the procedure for processing the timer interrupt is as follows:

If(u16StatusContent & TIMER1_IRQ_MASK)

/ / Interrupt category is timer 1 interrupt

{

TIme_slot++; //Add 1 slot to each timeout

If(TIme_slot==16)

TIme_slot=0; //The legal value of the number of slots is 0-15

PLMEEnableMC13192Timer1(1875);

//The length of each time slot is 1.875ms

Switch(time_slot)

{

Case 0: LoadBaecon(&tx_pkt);//Read a Baecon

MCPSDataRequest(&tx_pkt);//Send Baecon

Break;

Case 8:

MLMERXEnableRequest(&rx_pkt1,0);

/ / Open the receiving antenna and save the data to rx_pkt1

Break;

Case 9:

MLMERXEnableRequest(&rx_pkt2,0);

Break;

Case 10:

LoadPacket(&tx_pkt,0,1); //Read a packet

MCPSDataRequest(&tx_pkt);//send data

Case 11:

LoadPacket(&tx_pkt,0,1); //Read a packet

MCPSDataRequest(&tx_pkt);//send data

//12-15 hours slot

}}

The programming of the handheld device is similar to the gateway design. The difference is that the gateway automatically sends Baecon at the beginning of each superframe, while the handheld device passively receives Baecon, and then opens the timer to divide the time slot each time Baecon is received. After the 15th time slot is completed, the handheld device needs to open the receiving antenna to receive the Baecon of the next superframe.

MC13192 works in conjunction with voice codecs and network equipment

Because the MC13192 supports only 250kbit/s, only the encoded voice data must be transmitted between the gateway and the handheld device. Before selecting a codec scheme, you first need to roughly estimate the bandwidth. Since the limit rate is 250Kbit/s, due to the limitation of the protocol, only half of the time slots are available, that is, 125Kbit/s, for the two devices to use up and down. Thus, the unidirectional limit rate of each device is only 31.25 kbit/s. The switching time of the MC13192 itself is 144us, and as described in Section 2.3.3, 30ms is a superframe, each slot length is 1.875ms, plus the consumption of the physical layer header, the available rate per device is about 20kbit. /s. Therefore, ITU-T G.726 is selected as the speech codec solution in this scheme. G.726 voice coding consumes 16kbit/s of bandwidth, which can meet the bandwidth requirements of MC13192.

For the gateway, it is necessary to record the call object of each handheld device. It obtains the data in the time slot through the MC13192 and the 802.15.4 MAC protocol, and determines which handheld device the data belongs to according to the corresponding time slot. Finally, the received voice data is encapsulated into a destination where the RTP packet is sent to the handheld device. For voice data received from the network, it is necessary to determine which handheld device belongs to it, and then send it out through the MC13192 in a specific time slot.

For handheld devices, it is relatively simple. It only needs to send the data to be encoded in a specific time slot, and then receive the data in a specific time slot.

Design summary

This design has been used in my own MC13192-based zigbee telephony project. After the actual test, in the range of 40M, error-free communication can be realized, and the call quality is excellent. Compared with similar solutions based on other technologies, this solution has the advantages of low cost and low power consumption, and is a design with relatively economic and technical value.

DVI Connector Series

Dvi Connector Series,Dvi To Hdmi Connector,Precision High Current Connectors,Precision Dvi Connectors

Dongguan SOLEPIN Electronics Co., Ltd , https://www.wentae.com