User Manual
Version 1.1
2011-07-15
deRFnode and deRFgateway
dresden elektronik
ingenieurtechnik gmbh
Enno-Heidebroek-Str. 12
12 7 Dr
n
rm  n
Tel.: +49 351 31 85 00
Fax: +49 351 3 18 50 10
wireless@dresden-elektronik.de
www. r
n- l k r nik.
Page 44 of 56
If you own a dresden elektronik deRFdevelopment-Kit, the included kit CD provides a com-
plete I
2
C-library as well as out-of-the box working application examples for AVR and ARM
which may be easily modified according to your needs.
9.4.3. Using the USB interface
The onboard USB interface is realized either native (on deRFnode/gateway for ARM) or
based on a FTDI USB to parallel FIFO (on deRFnode/gateway for AVR). In USB-speech,
native means the MCU is able to talk directly to the USB-DM-/-DP-lines which is true for
ARM MCUs, but not for AVRs. So if using an AVR MCU on a ARM-baseboard, USB is non-
functional. When incorporating the USB FIFO, 12 GPIO (8 data, 4 control) lines are reserved,
AND-/OR-gates and a octal driver equalize level differences.
Besides other applications of the USB interface, we focus only on a Communication Device
Class (CDC)-device here which simplified is a RS232-port tunneled over USB providing a
virtual COM-Port on the PC-side.
For native USB with ARM MCUs, again the AT91Lib provides ready-to-use functions which
are   to   be   found   in   usb/device/core/USBD_UDP.c   and    usb/device/cdc-
serial/CDCDSerial-Driver.c. A typical initialization looks like:
CDCDSerialDriver_Initialize(); // initializes the CDC driver
USBD_Connect(); // connects external Pullup to USBDP
Afterwards data could be shared with the device driver with CDCDSerialDriver_Read()
and CDCDSerialDriver_Write(), i.e. in your applications main loop.
When working with FTDI, the chip encapsulates the USB-protocol. The only interface are the
control (RD, WR, RXF, TXE)- and data lines. Here the initialization procedure consists of:
(1) switching RD and WR to output pins, internal pull-ups enabled,
(2) set RXF, TXE and data lines as input pins,
(3) optionally empty USB FIFO buffer by performing dummy reads.
Data bytes available for reading are signalized by RXF being L as long as the buffer is not
completely empty. A byte can be read by toggling RD from H to L, then get the state on all 8
data lines and put RD back to H level.
Writing bytes is performed vice versa: First check the level on TXE - If it is H, the transceiver
is busy or the internal buffer is full. Otherwise the transmission may start by setting the 8 data
lines according to the transmit byte, then toggle WR from H to L and back. To improve per-
formance, writing should always be done block wise.
The octal bus driver is automatically enabled by the internal USB_CE-signal if at least one of
the RD- or WR- goes L (means reception/ transmission in progress). On the other side you
should ensure that RD and WR are permanently driven H if you do not use the USB over
FDTI to prevent the bus driver energizing back the FTDI circuit.
For simplified detecting whether a USB cable is plugged or not, the VBUS signal may be
used (active high). On the FTDI variant this only works reliable if RD and WR are driven H.
The device driver required on the PC side can be downloaded from the dresden elektronik
website <>. If you bought a dresden elektronik deRFdevelopment-Kit, the included kit
CD also provides the drivers and complete application examples which may be easily modi-
fied according to your needs.