Username:     
Password:     
             

Projects
EVOPrimer to PC Virtual ComPort 1
 
Additions to original Virtual Comport

Code size: Author:STPrime
Source files included:yes Version:1
Use circleOS:no Creation date:2011-10-09 18:22:38
Hardware modification:no Modification date:2011-10-09 18:22:38
Based on the STM32 Primer:EvoPrimer
   
Downloads:2328 Views:28380
   
Vote:
Average ratings:0/5 (0 rates)

Download:    EVOPrimer-to-PC-Virtual-ComPort-1.zip (2901 KB)

Description:

This program is a simple demonstration of how the Virtual Comport can be
used to send and receive data from the PC.  It does not us CircleOS, just
some of the components.  It is a combination of the MODBUS and VirtualComPort
programs found in the Project area of www.stm32circle.com

A simple Serial Port terminal program is also include that allows you to interface
with the EVO.  You can use Hyperteminal and the letters 'u', 'd', 'l', 'r' and 's'
to change LCD display.

The functions you will be dealing with are the USB_SIL_READ and USB_SIL_WRITE.
These manage most of the USB leg work.  Once you know what endpoints are being
used for what, ie. 

EP1_IN would be for data going from the STM32 to the PC
EP3_OUT would be used for reading data from the PC through the USB

    // USB_SIL_READ function gets data from the USB that was sent to
    // the EP3_OUT endpoint from the PC and is then put in the msg_buf1

        USB_SIL_Read(EP3_OUT, msg_buf1);

    // USB_SIL_WRITE function stores data in msg_buf1 along with the number
    // number of data bytes to be sent to the PC.  In this case only byte
    // that was just received is echoed back to hyperterminal

        USB_SIL_Write(EP1_IN, msg_buf1,1);
   
    //  SetEPTxValid function sets the EP_TX_VALID allowing for the data
    //  and size to be sent to the PC using USB endpoint ENDP1

        SetEPTxValid(ENDP1);