9 Replies Latest reply on Oct 5, 2020 12:44 AM by YatheeshK_36

    Cypress Streaming Example With an External Clock.

    raus_1269711

      In the attached streaming  example provided by Cypress, if I  change the firm ware for an external clock, it stops working.

       

      Here is the code;

       

      void TD_Init(void)             // Called once at startup

      {

         int i,j;

       

      CPUCS = 0x12; // CLKSPD[1:0]=10, for 48MHz operation

                                  // CLKOE=1, drive CLKOUT

         SYNCDELAY;

       

         // set the slave FIFO interface to 48MHz

         IFCONFIG |= 0x40;

         SYNCDELAY;

       

          // Default interface uses endpoint 2, zero the valid bit on all others

          // Just using endpoint 2, zero the valid bit on all others

          EP1OUTCFG = (EP1OUTCFG & 0x7F);

      SYNCDELAY;

      EP1INCFG = (EP1INCFG & 0x7F);

      SYNCDELAY;

      EP4CFG = (EP4CFG & 0x7F);

      SYNCDELAY;

      EP6CFG = (EP6CFG & 0x7F);

      SYNCDELAY;

      EP8CFG = (EP8CFG & 0x7F);

      SYNCDELAY;

          EP2CFG = 0xE0;  // EP2 is DIR=IN, TYPE=BULK, SIZE=512, BUF=4x

       

         // We want to get SOF interrupts

         USBIE |= bmSOF;

        

         mycount = 0;

       

         // Prepare data

         for (i=1;i<5;i++)

         {

            EP2FIFOBUF[0] = LSB(mycount);

            EP2FIFOBUF[1] = MSB(mycount);

            EP2FIFOBUF[2] = USBFRAMEL;

            EP2FIFOBUF[3] = USBFRAMEH;

            EP2FIFOBUF[4] = MICROFRAME;

            for (j=5;j<1024;j++)

            {

               EP2FIFOBUF[j] = i;

            }

            EP2BCH = 0x02;

            EP2BCL = 0x00;

         }

       

       

          Rwuen = TRUE;                 // Enable remote-wakeup

      ////////////////////////////////////////////////////////////////////////////////////////////////////////// The following two lines is what I add./////////////////////////////////////////////

      IFCONFIG = 0x43; // Slave FIFO mode of FX2LP

      SYNCDELAY;

      }