// Configure IOMUX
// GPIO Port A 0 to pin 39 as Output.
vos_iomux_define_output(39,
IOMUX_OUT_GPIO_PORT_A_0); // LED1#
// GPIO Port A 1 to pin 40 as Output.
vos_iomux_define_output(40,
IOMUX_OUT_GPIO_PORT_A_1); // LED2#
// GPIO Port A 2 to pin 41 as Output.
vos_iomux_define_output(41,
IOMUX_OUT_GPIO_PORT_A_2); // PWREN#
// GPIO Port C 0 to pin 24 as Output.
vos_iomux_define_output(24,
IOMUX_OUT_GPIO_PORT_C_0); // DB4
// GPIO Port C 1 to pin 25 as Output.
vos_iomux_define_output(25,
IOMUX_OUT_GPIO_PORT_C_1); // DB5
// GPIO Port C 2 to pin 26 as Output.
vos_iomux_define_output(26,
IOMUX_OUT_GPIO_PORT_C_2); // DB6
// GPIO Port C 3 to pin 27 as Output.
vos_iomux_define_output(27,
IOMUX_OUT_GPIO_PORT_C_3); // DB7
// GPIO Port C 4 to pin 28 as Output.
vos_iomux_define_output(28,
IOMUX_OUT_GPIO_PORT_C_4); // RS
// GPIO Port C 5 to pin 29 as Output.
vos_iomux_define_output(29,
IOMUX_OUT_GPIO_PORT_C_5); // E
■ SCREENSHOT 2. The FTDI FT_PROG utility is a free
download from the FTDI site. This utility reveals what type
of FTDI IC is plugged into the USB portal and what it is
programmed to do. You can also use this utility to program
an attached FTDI FT232RL device.
ride on the Vinco’s unused PORTC pins. I used the VNC2
IOMux config utility to add the PORTC LCD definitions.
Everything we did to get PORTA operational is also done
for PORTC within the main function.
The Vinculum-II API provides a host driver that is
written specifically to drive FTDI-based slave devices like
the FT232R in our ProBee ZU10 module. Once the core
USB host is established, the FT232 host driver is logically
attached to it in the ProBee ZU10 application code. We
initialize the FT232R host driver in the main function:
// Initialize USB Host FT232 Driver
usbHostFt232_init(VOS_DEV_USBHOST_FT232);
The thread called firmware holds all of the application
code and falls under the control of the VOS scheduler.
You can operationally think of the Vinculum-II firmware
function as a standard C main function. The major
difference is that there can be multiple thread functions in
a Vinculum-II application code set. The ProBee ZU10
application contains a single thread. Here’s how we
created it:
//***********************************************
//* VOS APPLICATION THREADS
//***********************************************
vos_tcb_t *tcbFIRMWARE;
tcbFIRMWARE = vos_create_thread_ex(20, 4096,
firmware, “Application”, 0);
As you would expect, vos_tcb_t is a structure located
in the vos.h file. Our thread (firmware) is tied to an
instance of vos_tcb_t via the pointer tcbFIRMWARE. Now
that we have a place to run some code, we can start the
scheduler:
vos_start_scheduler();
The main function can now be jettisoned to endless
loop land.
THE APPLICATION CODE
The addition of the active-low PWREN# gives us a
programmable way to apply USB host power to the
ProBee ZU10 via the Type A USB portal. The LCD will
Take a look inside of the firmware thread. You will see
that all of the USB host and GPIO control blocks are
instantiated inside of the firmware braces. You will also
find that the necessary devices are opened and their
associated handles are assigned
with the confines of the firmware
thread. Hardware and firmware
■ PHOTO 3. There is a complete
ZigBee radio behind that USB
connector. All we have to do is
figure out how to talk to it without
plugging the ProBee ZU10 into a PC.
72
September 2011