AnsweredAssumed Answered

STM32 USB CDC

Question asked by kyky.sergey on Feb 15, 2012
Latest reply on Feb 16, 2012 by kyky.sergey
Hello. 

Sorry my english language -- i am russian.

I am develop design with use microcontroller STM32F107.
I solve use USB connection, as USB CDC.
Find and download  example of this implementation.

I learn some and i have some questions.(sorry if roughly, i don`t know how right assembler sentence).

1. How can i know, when i can repeat transfer(from mc to PC)
     (i think that callback function EP1_IN_Callback() is called when data was transfered, but ...).

2. I think, that, if data is resived, callback function EP3_OUT_Callback() call. Is it true?

3. I realize some example:
     i transfer one any digital from PC to COM3 (STM32 OTG_FS),
     then callback function EP3_OUT_Callback() is called, where i      set flag f_Zapros = 1. Main program check this flag and flag     fReady_to_Write then, if true, call function USB_SIL_Write().

     That is i want start IN transfer (from mc to PC) after recive request from PC.
     
     But... 

     When i test this idea(PC transmiter - programm Terminal v.1b)
      PC buzz( don`t ansver on action).

     Example:

          main.c

       fZapros = 0;
       fReady_to_Write = 1;
       offset = 0;

     while(1)
     {
                if(fZapros)
                {
                      if(fReady_to_Write)
                  {
                         fReady_to_Write = 0;
            
                         USB_SIL_Write(EP1_IN, &USB_Tx_Buffer[0] + offset, 1);
          
                         offset += 64;
          
                         if(offset >= NumPoint)
                                fZapros = 0;
             }
     }

Flag fReady_to_Write i set in callback function EP1_IN_Callback().
offset - for transfer data whith size more than 64 bytes.
NumPoint - number bytes, which will be transfer.(for example 1024).

       If can, help please.


Outcomes