Thursday, November 26, 2009

Know more Knowledge about Bluetooth

Author: bettytxzt

Technically bluetooth is an open wireless protocol for interchanging the datas in shorter areas for the creation of personal area networks with the help of fixed moblie devices. Bluetooth earlier consider as wireless option which act as an option of rs232 data cables. The bluetooth has the ability of connecting with several devices avoiding difficulties in synchronization. Historically the word bluetooth is named after anglicised version of old norse blatand which is falling on the name of the tenth century king named harald I of two countries like denmark and norway. The good part of bluetooth is that it does the same operations with communication protocols by keeping them in a single universal standard.

Bluetooth have certain specific functions such as wireless control and communicaiton in different mobile phone and hands free headset, having wierless networking in a limited space in the pc systems with the help of short bandwidth, wierless communication in pc input and output devices coming in mouse, keyboard and printer, transferring the files, contact details, calendar appointments, acting as reminders in several devices with obex, forwarding short advertisement fromt bluetooth enabled advertising hoardings to varied sources, in several infrared usage act as a controller etc. The bluetooth now showing its prescence with shorter bandwidth applications in comparison to largest one. And also those areas where cable fee connection is needed.

Bluetooth earlier consider as wireless option which act as an option of rs232 data cables. The bluetooth has the ability of connecting with several devices avoiding difficulties in synchronization. Historically the word bluetooth is named after anglicised version of old norse blatand which is falling on the name of the tenth century king named harald I of two countries like denmark and norway. The good part of bluetooth is that it does the same operations with communication protocols by keeping them in a single universal standard.

Also bluetooth act as wireless bridge among two industrial ethernet networks coming in the market. Bluetooth aids in replacing traditional usage of serial communication in varied test equipments, gps receivers, medical equipments, bar code scanners, and also in different traffic control devices. The biggest benefit of bluetooth consumers sees in two seventh generation game consoles such as nintendo's wii and sony's playstation3 in many wireless controllers. Prsently bluetooth has shown in several official purposes, homes, and travelling across the globe. It aids in setting up of networks, printing, forwarding presentations and files with pdas into the pc systems. Now bluetooth is having many specific features for this users have to collect information about bluetooth for making best usage of it in elctrical industry.

About the Author:

To read about bluetooth headset and other information, visit the bluetooth headphonessite.

Article Source: ArticlesBase.com - Know more Knowledge about Bluetooth

Wednesday, November 25, 2009

Interaction with FTDI chip

Author: Apriorit Inc.

What is FTDI chip?

FTDI chips are the chips which are developed by Future Technology Devices International (http://www.ftdichip.com/ ).

FTDI chips are used in USB adapters to connect to RS232 and parallel FIFO hardware interfaces. The most frequent usage is USB-2-COM interface.

They are used in:

  1. Mobile phone cables.
    The mobile phones have RS232 or UART output, and PC may have USB only, the chip converts RS232 into USB. And the driver installed on PC creates the virtual device (usually, virtual COM port), which is used for communication.
  2. Service Boxes
    These are service tools used by Phone repair centers and Car repair service. These are the devices which are connected to PC via USB, and - on the other side - to the various hardware.
  3. Hardware Debuggers (JTAG)
  4. Any other device that needs to be USB-connected to PC, and has the RS232 port on the other side.

How to find out if the device is FTDI-based?

Well, you may disassemble it and read the labels on the chips, but it’s not the way you want it. There’s more humane method.

There are original drivers on FTDI site. If you look at the files which are included into the driver package there will be such set of files:

pic1

So if your device has any of these files in the driver list it’s FTDI-based.

To see the drivers for the device:

  1. Go to Device Manager
  2. Select the device
  3. Open context menu and select Properties
  4. Switch to Driver and click Driver Details button.

For example:

pic2

This device has FTD2XX.dll in the driver files list. And the provided name is FTDI. This device is FTDI-based. Some manufacturers may rename the driver (.sys), but the copyright information will reveal the real driver manufacturer.

How to interact with it?

Fortunately, FTDI provides the API. There’s a generic API set which can be used with all FTDI chips.

API is provided via FTD2XX.dll. It’s a DLL which interacts with FTD2XX.SYS driver.

pic3

There’s a header file and library file within FTDI driver package: ftd2xx.h and ftd2xx.lib files.

The .lib file is COFF format, so it can be used in Visual Studio without any problem.

FTDI API usage

The API set has two interfaces “classical” (functions with “FT_” prefix) and “Win32 API” (functions with “FT_W32_” prefix).

“Classical” is cross-platform interface.

“Win32 API” is a set of Windows-only functions. It’s much alike Windows API, which is used to work with serial ports. So porting the code to FTDI functions is quite simple.

The main functions are:

FT_W32_CreateFile() / FT_OpenEx()
Opens the handle to the specified FTDI chip connection

FT_W32_WriteFile() / FT_Write()
Sends data over virtual COM port.

FT_W32_ReadFile() / FT_Read()
Reads data from virtual COM port

FT_W32_CloseHandle() / FT_Close()
Closes connection handle.

There are functions that allow to set up the port:

FT_SetBaudRate()
Sets the baud rate for the connection

FT_SetDataCharacteristics()
Sets the number of bits in the byte, parity, etc

FT_ClrDtr()
Clears DTR signal on the virtual COM port

FT_SetDtr()
Sets DTR signal on the virtual COM port

FT_ClrRts()
Clears RTS signal on the virtual COM port

FT_SetRts()
Sets RTS signal on the virtual COM port

etc.

For Windows there’s no limitation about using the functions of Classical and Win32 API interfaces together. So you may combine it.

Opening the virtual serial port

There are multiple ways to open FTDI device: by index, by description, by serial number, by location. These types of information may be used to open the device via FT_W32_CreateFile();.

To obtain the information about the connected devices FT_ListDevices() should be used.

Example:

ftStatus = FT_ListDevices(0, Buf, FT_LIST_BY_INDEX FT_OPEN_BY_SERIAL_NUMBER);
if (ftStatus!=FT_OK) //Get first device serial number
{
printf("Couldn't get FTDI device name");
return 0;
}

ftHandle = FT_W32_CreateFile(Buf,
GENERIC_READGENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL FILE_FLAG_OVERLAPPED FT_OPEN_BY_SERIAL_NUMBER,
0); // Open device by serial number

There are several functions, which can provide the additional information about the connected devices:

FT_GetDeviceInfoList(),FT_CreateDeviceInfoList(), FT_GetDeviceInfoDetail(), etc.

Setting up the port

The code for setting the typical serial port settings to 115200 Bps, 8 bit per byte, 1 stop bit and no parity will look like this:


ftStatus=FT_SetBaudRate(ftHandle, FT_BAUD_115200);

ftStatus=FT_SetDataCharacteristics(ftHandle,
FT_BITS_8,
FT_STOP_BITS_1,
FT_PARITY_NONE);

ftStatus=FT_ClrDtr(ftHandle);
ftStatus=FT_SetDtr(ftHandle);

Also there are functions to setup the port in Windows style:

FT_W32_GetCommState(),FT_W32_SetCommState(),FT_W32_SetupComm(), etc.

Reading and Writing

Usage of FT_W32_WriteFile() and FT_W32_ReadFile() functions is similar to WriteFile() and ReadFile(). If the handle is opened in OVERLAPPED mode, the functions are asynchronous, otherwise they are synchronous. So reading and writing can be made in standard way:


DWORD Written=0;
unsigned char cmd[]={'A','T','\r','\n'};
ftStatus=FT_W32_WriteFile(ftHandle,cmd,sizeof(cmd),&Written,&Ovl);
if (WaitForSingleObject(Ovl.hEvent,INFINITE)!=WAIT_OBJECT_0)
throw std::exception("Error waiting write to complete");
unsigned char Buf[250];
ftStatus=FT_W32_ReadFile(ftHandle,Buf,sizeof(Buf),&TotalRead,&Ovl);
if (WaitForSingleObject(Ovl.hEvent,1000)!=WAIT_OBJECT_0)
throw std::exception("Error waiting read operation");

EEPROM programming

There are also APIs that allow to program FTDI chip. FTDI chip has EEPROM within it. EEPROM contains the chip settings block and the user area block. It’s possible to read and write both of these blocks.

Warning! Programming EEPROM is dangerous operation. Writing the invalid data may cause improper work of the device. You are doing it at your own risk.

APIs

The APIs to manage user area block:

FT_EE_UASize()
Gets the size of User Area.

FT_EE_UAWrite()
Write data to User Area.

FT_EE_UARead()
Read User Area Data

Reading the area is quite simple:


DWORD UASize=0;
FT_EE_UASize(ftHandle,&UASize);

UCHAR * pUAData=new UCHAR[UASize];
DWORD SizeRead=0;
ftStatus=FT_EE_UARead(ftHandle,pUAData,UASize,&SizeRead);

The APIs to manage whole EEPROM:

FT_EE_Program()
Writes to EEPROM special structure (FT_PROGRAM_DATA), which contains chip settings

FT_EE_ProgramEx()
Writes to EEPROM special structure (FT_PROGRAM_DATA), which contains chip settings, but the USB String descriptors are passed separately from FT_PROGRAM_DATA structure

FT_WriteEE()
Writes data to EEPROM directly.

FT_EE_Read()
Reads FT_PROGRAM_DATA structure from EEPROM data.

FT_EE_ReadEx()
Reads FT_PROGRAM_DATA structure from EEPROM data and USB String descriptors are passed separately

FT_ReadEE()
Reads EEPROM data directly

FT_EraseEE()
Erases EEPROM contents

Dumping EEPROM

Dumping EEPROM is a bit tricky, because some chips have the internal EEPROM, and some may have external one.

Quote:

The FT2232C supports 93C46 (64 x 16 bit), 93C56 (128 x 16 bit), and 93C66 (256 x 16 bit) EEPROMs.

So there can be various sizes.

Here’s the example of EEPROM dumping for 64 x 16 bit:


WORD EEPromData[0x40]={0};
DWORD Offset=0;
while (Offset < (sizeof(EEPromData) / sizeof (WORD)) )
{
WORD DataChunk=0;
ftStatus=FT_ReadEE(ftHandle,Offset,&EEPromData[Offset]);
if (ftStatus!=FT_OK)
break;
Offset++;
}

Here’s a second trick. If you look at the function declaration for FT_ReadEE:


FTD2XX_API
FT_STATUS WINAPI FT_ReadEE(
FT_HANDLE ftHandle,
DWORD dwWordOffset,
LPWORD lpwValue
);

dwWordOffset argument is actually index of the word value in EEPROM, not the offset in the meaning of “data offset”.

Data in the settings block

The settings block contains VID and PID of USB device, so if it’s changed, the device will be treated like some other device. Default values of VID and PID for FTDI chip are 0x0403 and 0x6001 accordingly, but these values are overwritten by the device manufacturers.

The settings block contains the product description strings (USB String descriptors): Manufacturer, Manufacturer ID and Description. Also there’s device serial number, which can be changed by EEPROM programming.

Warning one more time! Changing the EEPROM setting may also cause the software failures if the invalid data is written to EEPROM.

Download sample source code for FTDI interaction.

Links

The information about FTDI chips can be found in Data Sheets part of FTDI official site:
http://www.ftdichip.com/Documents/DataSheets.htm

Additional information about API can be found in FTD2XX Programming Manual:
http://www.ftdichip.com/Documents/ProgramGuides/D2XXPG34.pdf

Driver Package:
http://www.ftdichip.com/Drivers/D2XX.htm

About the Author:

Apriorit is an Ukrainian software development company.


Apriorit develops its own products as well as provide offshore development and QA services in the areas of advanced system programming, driver development, software for devices.


One of the key values of Apriorit's specialists is knowledge generation and sharing of experience.


Learn more about Apriorit and its experience at Apriorit Official site

Article Source: ArticlesBase.com - Interaction with FTDI chip

Monday, November 23, 2009

7 Steps to Make RS232 ExpressCard Download Flash to 218X

Author: jackdrogba

Step One: Install CCS2.2 and check your RS232 Interface

To ensure that your source code can be compiled to Download Source: xxx.out file.

Step two: Install Serial Programming Algorithm project file: sdf28xx_v3_0_serial more information, please read the included: SDFlash_Serial_RefGuide_v3_0.pdf and Expresscard RS232.pdf files.

Step Three: In the algorithm set up the project file, the corresponding clock frequency, and generates. 1 SDFLASH 1.63 download, serial download support. 2 SDFLASH algorithm libraries

(1) In the CC file to import F2812SerialFlash.pjt

File directory: C: \ CCStudio_v3.1 \ specdig \ sdflash \ mydrivers \ DSP281x_v3_0 \ DSP281x_serial \ build \ F28xxSerialFlash

(2) set up your target board clock frequency of the corresponding

The Flash280x_API_Config.h the corresponding PLL clock, I use the 20M crystal Chun chose: define CPU_RATE 10.000L / / for a 100MHz CPU clock speed (SYSCLKOUT) (3) Save and compile the project file, generate F2812SerialFlash.out file stored in: C: \ CCStudio_v3.1 \ specdig \ sdflash \ mydrivers \ DSP281x_v3_0 \ DSP281x_serial \ bin

Note: Make sure your flash program space defined in paragraph (in the CMD file changes). IF there is no RS232 Inteface,just install a RS232 Expresscard serial port adapter.

Step four: Install SdFlashV1.60 or later

Fifth Step: Edit sdopts.cfg file that is stored in your installation of windows of the System32 directory

(1) Use Notepad to open the way sdopts.cfg.

(2) "# End of sdopts.cfg" before adding the following text:

[EmulatorId = C1]

EmuPortAddr = 0xC1

EmuPortMode = RS232

EmuProductName = SERIAL_FLASH

[EmulatorId = C2]

EmuPortAddr = 0xC2

EmuPortMode = RS232

EmuProductName = SERIAL_FLASH

[EmulatorId = C3]

EmuPortAddr = 0xC3

EmuPortMode = RS232

EmuProductName = SERIAL_FLASH

[EmulatorId = C4]

EmuPortAddr = 0xC4

EmuPortMode = RS232

EmuProductName = SERIAL_FLASH

Step six: Open SDFlash, according to the methods provided by SDFlash_Serial_RefGuide_v3_0.pdf specify a file path algorithm

In the Project settings, if you chose to use the PC emulator of COM1 for the C1, COM2 select the C2

Seventh Step: The DSP-SCI_A and PC-RS232 port/Expresscard RS232 connection. Will be as follows DSP-foot tube set to the corresponding level, and then reset

Reset time: GPIOF4 = 0 GPIOF12 = 0 GPIOF3 = 1 GPIOF2 = 1

Note: GPIOf4 for SCI_A TXD terminal, reset should be restored after the completion of the original DSP is able to carry the signal state

Step seven: Click SdFlash menu Flash items --- "Click Start, you can!!!. Check your RS232 or Expresscard 34 RS232 Serial Port can work normally!

About the Author:

jackdrogba is interested in computer technology..

Article Source: ArticlesBase.com - 7 Steps to Make RS232 ExpressCard Download Flash to 218X

Wednesday, November 18, 2009

CAN BUS MESSAGE FRAMES - Overload Frame,Interframe Space


An overload frame, shown in Figure 2-5, has the same
format as an active error frame. An overload frame,
however, can only be generated during an interframe
space. In this way, an overload frame can be differentiated
from an error frame (an error frame is sent during
the transmission of a message). The overload frame
consists of two fields: an overload flag followed by an
overload delimiter. The overload flag consists of six
dominant bits followed by overload flags generated by
other nodes (and, as for an active error flag, giving a
maximum of twelve dominant bits). The overload
delimiter consists of eight recessive bits. An overload
frame can be generated by a node as a result of two
conditions:
1. The node detects a dominant bit during the
interframe space, an illegal condition.
Exception: The dominant bit is detected during
the third bit of IFS. In this case, the receivers will
interpret this as a SOF.
2. Due to internal conditions, the node is not yet
able to begin reception of the next message. A
node may generate a maximum of two
sequential overload frames to delay the start of
the next message.

CAN BUS MESSAGE FRAMES - Interframe Space

The interframe space separates a preceding frame (of
any type) from a subsequent data or remote frame.
The interframe space is composed of at least three
recessive bits called the Intermission. This allows
nodes time for internal processing before the start of
the next message frame. After the intermission, the
bus line remains in the recessive state (bus idle) until
the next transmission starts.

http://ww1.microchip.com/downloads/en/DeviceDoc/21801d.pdf