This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

cdc problem

Hi,
I am trying to send data from AT91SAM7X256 to PC via virtual com port(usb)using cdc.I dont know how to do it exactly, I've tried keil example for cdc. And I used hyperterminal. But I could'nt see anything in hyperterminal. I don't know wich function use to send my data.
Thank you very much in advance

  • Look in this part of the example code.
    - VCOM_Serial2Usb() is repeatedly called in the while loop of vcomdemo() task
    - In VCOM_Serial2Usb() routine, if CDC_DepInEmpty, serBuf[] is filled, and it is passed to the bulk IN endpoint using USB_WriteEP().

    C:\Keil\ARM\Boards\Atmel\AT91SAM7X-EK\RL\USB\RTX_CDC\vcomdemo.c
    
    void VCOM_Serial2Usb(void) {
      static char serBuf [USB_CDC_BUFSIZE];
             int  numBytesRead, numAvailByte;
    
      ser_AvailChar (&numAvailByte);
      if (numAvailByte > 0) {
        if (CDC_DepInEmpty) {
          numBytesRead = ser_Read (&serBuf[0], &numAvailByte);
    
          CDC_DepInEmpty = 0;
              USB_WriteEP (CDC_DEP_IN, (unsigned char *)&serBuf[0], numBytesRead);
        }
      }
    
    }
    
    __task void vcomdemo (void) {
    
      VCOM_Init();                              /* VCOM Initialization */
    
      USB_Init();                               /* USB Initialization */
      USB_Connect(__TRUE);                      /* USB Connect */
    
      while (!USB_Configuration) ;              /* wait until USB is configured */
    
      while (1) {                               /* Loop forever */
        VCOM_Serial2Usb();                      /* read serial port and initiate USB event */
        VCOM_CheckSerialState();
            VCOM_Usb2Serial();
      }
    }
    

    Tsuneo