Sunday, May 5, 2013

Almost any wireless device (Cellular, Wifi, Bluetooh etc) has following states:
- System selection mode
- Idle mode
- Random Access mode
- Connected mode

Why this categorization is needed? In order to understand the issues, and the challenges that a wireless device might face, its necessary to break it down under basic states first and then analyze each state in detail (Something we are planning to do in future posts). Though this applies to almost any wireless device, our discussion here is more confined and relevant to cellular technologies.
Down below is a state machine diagram talking about these basic states.


1. System Selection:
Let's talk from real user perspective. Joe got his new smartphone shipped. He opens up the box, puts his AT&T SIM in, and turns on his smartphone. The first thing his smartphone does is to look for a network (<Carrier, GSM/UMTS/LTE/CDMA2000/TDSCDMA Technology, Frequency bands>). This involves PLMN selection at higher layers(Non-Access Stratum), and cell selection mechanisms at lower layers (Access stratum). A network/carrier (PLMN) that can provide services (e.g. voice calls, SMS, Internet) Joe is entitled to have (Provisioned via SIM card). Once a "suitable" network is found, the smartphone would attempt to register/authenticate itself on suitable network. After successful registration is done, device enters into idle mode. If no suitable PLMN is found in a given period, device would declare 'No Service' (or 'Out of Service' as some may prefer to call).


2. Idle mode:
Now that Joe's iphone is showing full signal bars, the door bell rings. It's his friend and he gets Joe into talking. Smartphone is now in idle more. In idle mode, smartphone goes into sleep mode to wakeup only at periodic intervals, say every 1.28 sec (DRX: Discontinuous reception) and listen to any possible page network send. If in case, current signal goes bad and no good cell is found, phone declares "out of service" and goes back to System selection state. For now, let's assume all is good here, and phone never looses full signal bars. Joe is back now, and makes a phone call to his family. This forces his phone to move from idle to random access mode.


3. Random Access Mode:
For the phone be able to make a call, it needs a connection with network. The phone needs to send a connection request message (Signalling) to network first. Since there are many other people in Joe's neighborhood using AT&T service, AT&T cannot allocate its network resources to Joe's phone for all the time as network resources are limited. It's not wise to allocate dedicated resources to every single user all the time, either. After all, Joe hardly uses his phone for more than 10 mins every hour (And he doesn't use it at all while sleeping). So resource allocation has to be need basis. AT&T network just keeps listening for any new request on a common channel (Random Access Channel), and allocates resources on first-come, first-serv basis till its resources last. If Joe's and say, his neighbor's phone are trying to access this common channel at the same time, then AT&T network can't listen to any of them. To resolve this dilemma (Contention resolution), Joe's phone just waits for some random duration, and then tries to access AT&T common channel (Hence random access mode)- assuming other phone would be sending request to network some other random time. If it's lucky, it would happen to be the only phone talking to network on common channel that instance of time, and network grants it resources required to make a phone call (Random access procedure) and phone and network get into "sync" i.e. Each of them know when to listen for other. All this happens in order of hundreds of millisecond. Now Joe's phone is moved to connected mode. If network refuses to accommodate Joe's phone or just could not hear the request (Collision), it would just move back to idle, and may retry after some random interval again. If it looses service during this time, it just moves to state 1 and try to acquire  service first. 

4. Connected Mode:
Once moved to connected mode, Joe's phone tells network the phone no. of the family member Joe wanted to talk to. AT&T locates what area (LA/URA) this phone is in, and sends page to it (Paging procedure). Once this phone responds to page, network rings this phone with Joe's phone no, and Joe can now hear rings too. Other party picks up, and Joe starts talking. After few mins, Joe moves out of his apartment while talking. Let's say cellular coverage in his apartment is poor, but there is a base station with better signal strength outside. Joe's phone would report to AT&T about signal strength of base station, and this new base station. AT&T would see that new base station is fairly better than current one, and commands phone to start talking to new base station (AT&T would also commands to new base station to accommodate Joe's phone). Finally, Joe hangs up, and his phone moves back to idle state. If this new base station were not there, and coverage of current base station is even poorer outside Joe's apartment is even worse, his call would drop, and radio link failure would happen. This moves phone to service acquisition state.