■ PHOTO 4. The VNC2 programmer/debugger allows
the capture of data to the Vinculum-II IDE's WATCH
window without having to pipe the data out to a
terminal emulator or LCD.
WATCH window, I set a breakpoint at the
toggle_led( 2) statement.
{
LAST_STATE = sATTACH_FT232;
CURRENT_STATE = sERROR;
break;
}
// ProBee runs at 9600 baud
ft232_iocb.ioctl_code = VOS_IOCTL_
USBHOSTFT232_SET_BAUD_RATE;
ft232_iocb.set.uart_baud_rate =
USBHOSTFT232_BAUD_9600;
vos_dev_ioctl(hUSBHOST_FT232,
&ft232_iocb);
ft232_iocb.ioctl_code =
VOS_IOCTL_USBHOSTFT232_START_POLL;
vos_dev_ioctl(hUSBHOST_FT232,
&ft232_iocb);
LAST_STATE = sATTACH_FT232;
CURRENT_STATE = sSETUP;
break;
Use what you learned in the LED code and you’ll
have no problem figuring out what’s going on in the
sATTACH_FT232 state code. The FT232 host driver is
“attached” to the core USB host. Following the attachment,
the Vinco takes on the persona of a PC running FTDI
drivers. When polling is kicked off, we’re ready to instruct
the Vinculum-II to send and receive data using the ProBee
ZU10’s ZigBee radio. The ProBee ZU10/Vinco/debugger
hardware setup is under the Canon lens in Photo 4.
uint8 rbuffer[64];
uint16 num_received, num_read;
//***********************************************
//* FT_232 RECEIVE STATE
//***********************************************
case sRX_FT232:
// wait for data to be received on FT232
//device
ft232_iocb.ioctl_code = VOS_IOCTL_
COMMON_GET_RX_QUEUE_STATUS;
vos_dev_ioctl(hUSBHOST_FT232,
&ft232_iocb);
num_received = ft232_iocb.get.queue_stat;
if (num_received > 64)
num_received = 64;
if (num_received)
{
// read data into buffer
if(vos_dev_read(hUSBHOST_FT232, rbuffer,
num_received, &num_read)!= USBHOSTFT
232_OK)
{
LAST_STATE = sRX_FT232;
CURRENT_STATE = sERROR;
break;
}
LAST_STATE = sRX_FT232;
CURRENT_STATE = sPROCESS_FT232;
}
toggle_led(2);
vos_delay_msecs(50);
break;
Note that we’re accessing the overlaid FT232 host
driver and not the core USB host driver.
SEND DATA
This code sends ‘1A6’ to the ZigBee Coordinator and
every other node in the PAN:
rom char msgBC[19] = {0x12,’A’,’T’,’+’,’B’,
’R’,’O’,’A’,’D’,’C’,’A’,’S’,’T’,’=’,’1’,’A’,’6’,0
x0D,0x0A};
uint8 send_msg(void)
{
uint8 i;
uint8 status;
num_to_write = msgBC[0];
j=1;
for(i=0;i< num_to_write;i++)
{
wbuffer[i] = msgBC[j++];
}
status=vos_dev_write(hUSBHOST_FT232,
wbuffer, num_to_write, &num_written);
return(status);
}
The send_msg function is invoked by the s TX_FT232 state.
RECEIVE DATA
To view the incoming data in the Vinculum-II IDE
74 September 2011
EASY ZIGBEE
I used the ProBee Manager PC application to
preconfigure one of the ProBee ZU10 modules as a
ZigBee Coordinator. The ZigBee Coordinator ProBee
ZU10 was attached to a PC running Hyper Terminal.
The ProBee ZU10 module driven by the Vinco was
set up to be a sleepy end device. I also used the Probee
Manager to configure both of the ProBee ZU10
modules to set up a ZigBee PAN (Personal Area
Network) automatically. So, while we were busy with
making sure we were taking care of FTDI USB
business, the ProBee ZU10 modules were taking
care of ZigBee network business. For the hardcore
of you, yes, we could have used ProBee ZU10 AT
commands to set up the ProBee ZU10 modules using
the Vinco.
The LCD driver is included within the Vinco/ProBee
ZU10 application source code in the download package.
Everything you need to host the ProBee ZU10 with a
Vinculum-II is there and then some. Chalk up two more
disciplines to your Design Cycle: Vinculum-II and the
ProBee ZU10. NV