USB Host Board – CDC Class Serial Software

This software download is for our USB Host Board. It allows you to connect a CDC class device to the Host Board and send and receive data to the device via a serial TTL connection

This is a free software download for our USB Host Board and USB Host IC’s (SOICDIPSSOP).

Please note: This software is free to download but only works on one of our USB boards or chips which must be bought separately.
To order, simply select which of our boards or IC products you wish to have the software loaded onto. See the USB Host Board and IC product pages for details on pricing and installing this software.

NOTE: The CDC class functionality has now been incorporated into the SERIAL software. No further development will be done on the CDC software.


What is the CDC Class

The USB communications device class (or USB CDC) is a composite Universal Serial Bus device class. It is used for modems, mobile phones, two way radios and many other generic serial devices.

The CDC class is also used by Arduino boards (genuine boards not clones) and Teensy boards, which are supported in this software

Now Supports Ublox USB GPS units
 

USB Host Board Configuration

The following Commands are available to configure the USB Host Board

These commands are used to configure the USB Host board and will only function when no device is plugged into the board. If a device is plugged in, these commands will be sent to the device

COMMAND 
BAUD <value>Set Serial Port Baud Rate (default 9600)
[2400|4800|9600|14400|19200|38400|57600|115200]
ECHO ON|OFFTurn local Echo On or Off
INTERFACECDC Communication settings (default 0)
This is for transmission TO the attached USB CDC device.

0 – TEXT mode. Data is transmitted once carriage return is received
1 – BYTE mode. Each character is transmitted as it is received
2 – PACKET mode.
RS232 <value>Set Serial Port Configuration
0 – default TTL (positive logic)
1 – RS232 (negative logic)
HELP or ?Display help

BAUD

The baud rate for communication with the board. Note that this does not effect the communications speed with the attached device.

ECHO

This determines whether data sent to the board is echoed back by the board. This is useful when initially testing communication using a terminal program to issue commands.

When connected to a microcontroller you may not want the data sent to be echoed back. The default is ON

INTERFACE

This determines the type of communication with the CDC device.

This is for transmission TO the attached USB CDC device only. Data FROM the CD device is not affected by these settings.

0 – TEXT mode

Data is transmitted once carriage return is sent

1 – BYTE mode

Each character is transmitted as it is received

2 – PACKET mode

Similar to byte mode, but data is sent once a complete packet of data is received. This is useful for binary data transfer.

The first byte of the packet data is the data length (excluding itself). This is not transmitted.

For instance to transmit the four bytes 0x0A 0x0B 0x0C 0x0D you would send

0x04 0x0A 0x0B 0x0C 0x0D

The packet of data is transmitted once all data bytes have been received.

RS232 Port Configuration

You can now set the serial port to RS232 negative logic (local – not the attached USB device). This will enable you to connect the board directly to serial ports that support the RS232 negative logic format.

There are a few important points to bear in mind

  • This does not effect the bootloader, so program updates will still need a positive logic TTL connection
  • Once you have activated RS232 mode, you will need to communicate with the Host board/chip using RS232
  • RS232 is negative logic, but the host chip will only provide 0V and 3.3V output. It will not produce negative voltages
  • Do not connect to RS232 ports that have high voltages – e.g. old style PC serial ports which operate at +/- 12V


Connections required

  • 5V power in
  • 0V
  • TX out
  • RX in
  • SS pin goes high when CDC device inserted, low when removed


The CDC Class and Mobile Phones

Mobile phones (but excluding all modern smart phones) that connect to a computer via a USB cable do so over a serial connection. Many of these phones supported  the USB Communications Device Class (CDC) ACM connection using standard Hayes type AT modem commands. We couldn’t find a list of supported phones on the internet but Motorola, Samsung and Sony Ericsson phones supported this protocol (although we cannot guarantee a particular model will work)

We used a Motorola V3x to test mobile phone connectivity

Non Supported Phones

All modern smartphones. That includes iPhones, Android, Blackberry. These phone use a proprietory communication system and will not work.

What can you do?

Sending and Receiving SMS Text messages via a microcontroller can be very useful for remote control or monitoring. You can use it for

  • Alarm System – Send an SMS Text Message to your mobile phone if an alarm is tripped
  • Remote Monitoring – Send remote data by SMS for monitoring say temperature  in a remote location
  • Control Equipment  – Send an SMS Text message to it to turn on/off an appliance

The USB Host Board will also charge your phone while it is plugged in so no worries about the battery going flat.

Documents

AVR323: Interfacing GSM modems

Example Communication with Mobile Phone

The following examples show how you can send and receive sms text messages using a Motorola mobile phone. Different models may have different commands so you should check online for the command list for your phone

First test communication by issuing the AT command. The mobile phone will normally echo the command sent and then send an OK response. E.g.

	AT
	AT
	OK

To stop the phone echoing your commands you can turn echo off with

	ATE0

Reading SMS Messages

The following commands are useful for reading text messages

	AT+CMGF=1              set to text mode
	
	AT+CMGL="REC UNREAD"   list all received unread 
                               - listing them marks them as read
	AT+CMGL="REC READ"     list all received read
	AT+CMGL="STO UNSENT"   list all stored unsent
	AT+CMGL="STO SENT"     list all stored sent
	AT+CMGL="ALL"          list all sms present
	
	AT+CMGR=1              read message number 1
	
	AT+CMGD=1              delete message 1

Example Communication

	ATE0
	ATE0
	OK
	AT+CMGF=1
	OK
	AT+CMGL="REC READ"
	+CMGL: 823,"REC READ","+447891123456"
	Hello there
	OK

Sending SMS Messages

To send an SMS message we use the AT+CMGS command to indicate the phone number to send the text to. The phone will respond with a > prompt. We can then send the text part of the message. Carriage returns sent will genereate another > prompt on a new line.

Complete sending the message by sending a Control-Z character

Example Communication

	ATE0
	ATE0
	OK
        AT+CMGF=1
	OK
	AT+CMGS="+447891123456"
	
	> Hello this is a text

	> Next line
	+CMGS: 249

	OK

Deleting SMS Messages

Use AT+CMGL="REC READ" to list messages

Delete a specific message using

	AT+CMGD=x    x=message number

Check on phone status

	AT+CIND?

Get Date and time

	AT+CCLK?
Shopping Basket
Scroll to Top