4 Replies Latest reply on May 23, 2017 5:10 AM by NoSheng

    SE C1000 : USB CDC-ACM project Start ARC sequence

    NoSheng

      Hi, I use USB CDC-ACM project and work with ARC core.

       

      Using MOUNT ATLAS FAB C (Intel® Quark™ SE Microcontroller C1000 Development Platform)

       

       

      The result : the LED will blink after using terminal to connect USB CDC-ACM serial console.

      (The program free run without Debug perspective.)

       

       

      How to run ARC core without waiting for the connection through Terminal with host machine?

       

       

       

      There is the software environment

      1

      OS

      Windows 8.1 64-bits

      2

      ISSM Version

      ISSM_2016.2.090

      3

      MCU ROM

      For Intel® QMSI [1.4.0]

      4

      Quark Project

      USB_Communication_Device_Class__Abstract_Control_Model_

      5

      ARC Project

      LED_Blinky

       

       

       

      USB_Communication_Device_Class__Abstract_Control_Model_ Quark (LakeMount)

         QM_PUTS("CDC ACM Initialized. Waiting for DTR.");

         do {

            cdc_acm_line_ctrl_get(LINE_CTRL_DTR, &dtr);

         } while (!dtr);

         /* Start ARC. */ /* NoSheng May 19, 2017 */

         sensor_activation(); /* NoSheng May 19, 2017 */

       

       

      LED_Blinky ARC ( Sensor subsystem )

      int main(void)

      {

       

         static qm_gpio_port_config_t cfg;

       

         /* Set the GPIO pin muxing. */

         pin_mux_setup();

       

         /* Set the GPIO pin direction to out and write the config. */

         cfg.direction = (BIT(USB_VBUS_GPIO_PIN)|BIT(PIN_OUT));/* NoSheng May 19, 2017 */

         qm_gpio_set_config(QM_GPIO_0, &cfg);

         qm_gpio_set_pin(USB_VBUS_GPIO_PORT, USB_VBUS_GPIO_PIN);

         /* Loop indefinitely while blinking the LED. */

         while (1) {

            qm_gpio_set_pin(QM_GPIO_0, PIN_OUT);

            clk_sys_udelay(DELAY);

            qm_gpio_clear_pin(QM_GPIO_0, PIN_OUT);

            clk_sys_udelay(DELAY);

         }

      }

       

       

      Another bad result, on my observation : 

       

      If “Start ARC” before “cdc_acm_line_ctrl_get” while loop, the LED will blink until the terminal to connect USB CDC-ACM serial console.

      And, nothing happened to USB Device of host machine ( Can’t find USB device )

      It’s seems the ARC core suspended while the USB connect to host machine.

      /* Start ARC. */ /* NoSheng May 19, 2017 */

         sensor_activation(); /* NoSheng May 19, 2017 */

       

         QM_PUTS("CDC ACM Initialized. Waiting for DTR.");

         do {

      cdc_acm_line_ctrl_get(LINE_CTRL_DTR, &dtr);

         } while (!dtr);

       

      Thanks,

       

      NoSheng.

        • 1. Re: SE C1000 : USB CDC-ACM project Start ARC sequence
          MichelleC_Intel

          Apologies for the delay getting back to you on this - we are currently looking into this issue.

           

          I can re-produce what you are seeing on QMSI 1.4.  When I add the sensor_activation(); before the CDC-ACM initialization the USB device fails to initialize correctly.

           

           

          On QMSI 1.3.1 however it would appear to be working as expected ...  adding the sensor_activation(); at the start of the CDC_ACM sample application has no impact on the USB initialization and the application on the ARC proceeds whether the USB cable is connected or not. Once the cable is connected the USB Device is correctly found.

           

          I will get back to you as soon as I have any update.

           

          -Michelle

          • 2. Re: SE C1000 : USB CDC-ACM project Start ARC sequence
            NoSheng

            Dear Michelle :

             

            Thanks for your reply.

             

            I duplicated the work about you mentioned with QMSI [1.3.1].

             

            I have the same result with you.

             

             

            1

            OS

            Windows 8.1 64-bits

            2

            ISSM Version

            ISSM_2016.2.090

            3

            MCU ROM

            For Intel® QMSI [1.3.1]

            4

            Quark Project

            USB_Communication_Device_Class__Abstract_Control_Model_ ( QMSI [1.3.1] )

            5

            ARC Project

            LED_Blinky ( QMSI [1.3.1] )

             

            On the other hand, if I add sensor_activation(); at the back of the CDC-ACM initialization while loop.

             

             

            The result :

            ARC core Running until the connection of the terminal.

             

            But the terminal break immediately with Error Message : “Unable to open connection to COM11 Unable configure serial port”

            ( ExtraPuTTY 0.29_RC2 )

             

            And no longer find the USB Device correctly.

             

             

             

            By the way, the Intel® QMSI [1.3.1] is no longer exist in the new ISSM version 2016 Update 2 ( ISSM_2016.2.094 )

             

            Edit : May 23, 2017 13:50 ( UTC+8:00 ) :

            MichelleC_Intel

            Keep the VBUS enable function in the ARC core with GPIO Configuration.
            I think it is useful to avoid USB CDC-ACM terminal breaking.

             

                /* Set the GPIO pin direction to out and write the config. */

                cfg.direction = (BIT(PIN_OUT)|BIT(USB_VBUS_GPIO_PIN));/* NoSheng May 23,2017*/

                qm_gpio_set_config(QM_GPIO_0, &cfg);/* NoSheng May 23,2017*/

             

                qm_gpio_set_pin(QM_GPIO_0, USB_VBUS_GPIO_PIN);/* NoSheng May 23,2017*/

             

             

            Thanks,

            NoSheng.

            • 3. Re: SE C1000 : USB CDC-ACM project Start ARC sequence
              MichelleC_Intel

              Hi NoSheng

               

              I put the sensor_activation();  at the start of the code and everything worked fine for me on the QMSI 1.3.1 (Ensure you also have a 1.3.1 ROM file flashed)

               

              QMSI 1.3.1 is not installed by default with the latest ISSM but it is available via the 'Help'->'Install New Firmware' menu. Just select 1.3.1, click Apply and it will be installed.

               

              If you are behind a proxy  then you may need to make sure Eclipse is configured correctly.

               

              1.        Go to Window -> Preferences -> General -> Network Connections
              2.        Change the provider to "Manual"
              3.        Select the "HTTPS" line and click the edit button.
              4.        Add the IP address and port number.
              5.        Click Apply.
              6.        Click OK.

               

               

              - Michelle

              • 4. Re: SE C1000 : USB CDC-ACM project Start ARC sequence
                NoSheng

                Dear Michelle :

                 

                Maybe I misunderstand the result about QMSI [1.3.1]

                It's succeed, after I try again with QMSI [1.3.1] and mass_erase first.

                 

                1

                OS

                Windows 8.1 64-bits

                2

                ISSM Version

                ISSM_2016.2.094

                3

                MCU ROM

                For Intel® QMSI [1.3.1]

                4

                Quark Project

                USB_Communication_Device_Class__Abstract_Control_Model_
                QMSI [1.3.1]

                5

                ARC Project

                LED_Blinky QMSI [1.3.1]

                 

                Quark (LMT):

                 

                int main(void)

                {

                    uint32_t baudrate, dtr = 0;

                    int bytes_read;

                 

                    QM_PUTS("Starting: USB CDC ACM Example");

                 

                    qm_irq_request(QM_IRQ_USB_0_INT, qm_usb_0_isr);

                 

                    /* Enable the USB VBUS on Quark SE DevBoard. */

                    enable_usb_vbus();

                    /* Start ARC. */

                    sensor_activation();/*WPI NoSheng May 23,2017*/

                 

                    /* Init USB CDC ACM. */

                    cdc_acm_init();

                 

                    QM_PUTS("CDC ACM Initialized. Waiting for DTR.");

                    do {

                        cdc_acm_line_ctrl_get(LINE_CTRL_DTR, &dtr);

                    } while (!dtr);

                 

                    QM_PUTS("DTR set, start test.");

                 

                    /* Wait 1 sec for the host to do all settings. */

                    clk_sys_udelay(ONE_SEC_UDELAY);

                 

                    if (cdc_acm_line_ctrl_get(LINE_CTRL_BAUD_RATE, &baudrate)) {

                        QM_PUTS("Failed to get baudrate, ret code.");

                    } else {

                        QM_PRINTF("Baudrate detected: %d\n", baudrate);

                    }

                 

                    QM_PUTS("USB CDC ACM set. Switch to the USB Serial Console.");

                    cdc_acm_irq_callback_set(interrupt_handler);

                    write_data(banner1, strlen(banner1));

                    write_data(banner2, strlen(banner2));

                 

                    /* Enable RX interrupts. */

                    cdc_acm_irq_rx_enable();

                 

                    /* Echo the received data. */

                    while (1) {

                        read_and_echo_data(&bytes_read);

                    }

                 

                    return 0;

                }

                 

                Sensor Subsystem :

                 

                #include "clk.h"

                #include "qm_gpio.h"

                #include "qm_pinmux.h"

                 

                /* The following defines the pin and pin mux details for each SoC. */

                #if (QUARK_SE)

                #define PIN_OUT 25

                #define LED_PIN_ID (QM_PIN_ID_59)

                #elif(QUARK_D2000)

                #define PIN_OUT 24

                #define LED_PIN_ID (QM_PIN_ID_24)

                #endif

                #define PIN_MUX_FN (QM_PMUX_FN_0)

                #define DELAY 250000UL /* 0.25 seconds. */

                 

                int main(void)

                {

                    static qm_gpio_port_config_t cfg;

                 

                    /* Set the GPIO pin muxing. */

                    qm_pmux_select(LED_PIN_ID, PIN_MUX_FN);

                 

                    /* Set the GPIO pin direction to out and write the config. */

                #if 1   /*NoSheng May 23,2017*/

                    cfg.direction = (BIT(PIN_OUT)|BIT(28));/*NoSheng May 23,2017*/

                #else   /*NoSheng May 23,2017*/

                    cfg.direction = BIT(PIN_OUT);

                #endif  /*NoSheng May 23,2017*/

                    qm_gpio_set_config(QM_GPIO_0, &cfg);

                #if 1   /*NoSheng May 23,2017*/

                    qm_gpio_set_pin(QM_GPIO_0, 28);/*NoSheng May 23,2017*/

                #endif  /*NoSheng May 23,2017*/

                 

                    /* Loop indefinitely while blinking the LED. */

                    while (1) {

                        qm_gpio_set_pin(QM_GPIO_0, PIN_OUT);

                        clk_sys_udelay(DELAY);

                        qm_gpio_clear_pin(QM_GPIO_0, PIN_OUT);

                        clk_sys_udelay(DELAY);

                    }

                }

                 

                 

                Thanks,

                NoSheng.