6 Replies Latest reply on Jan 16, 2017 9:07 AM by MichelleC_Intel

    How to configure two or more digital pins in quark D2000 kit?

    qudor

      I want to Blink two LEDs on the intel quark D2000 kit but only the last pin configured working.

      There is no example or project provided to use two digital pins.

      Please help me and write down the code for me

        • 1. Re: How to configure two or more digital pins in quark D2000 kit?
          MichelleC_Intel

          Just make sure you have the GPIO Direction set correctly - below code will blink 2 LED's on the D2000 Development Platform.

           

          PIN 24 -  mapped to DIO9 on the Arduino shield interface on the board (& the onboard LED)

          PIN 11 - mapped to DIO2 on the Arduino shield interface

           

          /* 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)

          #define PIN_OUT2 11

          #define LED_PIN_ID2 (QM_PIN_ID_11)

          #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);

            qm_pmux_select(LED_PIN_ID2, PIN_MUX_FN);

           

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

            cfg.direction = BIT(PIN_OUT)| BIT(PIN_OUT2);

            qm_gpio_set_config(QM_GPIO_0, &cfg);

           

           

            /* Loop indefinitely while blinking the LED. */

            while (1) {

            qm_gpio_set_pin(QM_GPIO_0, PIN_OUT);

            qm_gpio_set_pin(QM_GPIO_0, PIN_OUT2);

            clk_sys_udelay(DELAY);

            qm_gpio_clear_pin(QM_GPIO_0, PIN_OUT);

            qm_gpio_clear_pin(QM_GPIO_0, PIN_OUT2);

            clk_sys_udelay(DELAY);

            }

          }

          • 2. Re: How to configure two or more digital pins in quark D2000 kit?
            qudor

            Thank you MichelleC_Intel

            my mistake as you expected in GPIO direction setup

            • 3. Re: How to configure two or more digital pins in quark D2000 kit?
              estebaan

              Hi

               

              I wanted to use your code, but it did not work, it presents many errors and uses the two quark interface

              • 4. Re: How to configure two or more digital pins in quark D2000 kit?
                MichelleC_Intel

                Hi ,

                 

                Can you please post the errors you encountered so that we can try to determine the issue.

                 

                -Michelle.

                • 5. Re: How to configure two or more digital pins in quark D2000 kit?
                  estebaan

                  /* 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)

                  #define PIN_OUT2 11

                  #define LED_PIN_ID2 (QM_PIN_ID_11)

                  #endif

                  #define PIN_MUX_FN (QM_PMUX_FN_0) /*Error 'QM_PMUX_FN_0' undeclared (first use in this function)*/

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

                   

                  int main(void)

                  {

                    static qm_gpio_port_config_t cfg; /* unknown type name 'qm_gpio_port_config_t'*/

                   

                   

                    /* Set the GPIO pin muxing. */

                    qm_pmux_select(LED_PIN_ID, PIN_MUX_FN); /*'LED_PIN_ID' undeclared (first use in this function)*/

                    qm_pmux_select(LED_PIN_ID2, PIN_MUX_FN); /*'LED_PIN_ID2' undeclared (first use in this function)*/

                   

                   

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

                  cfg.direction = BIT(PIN_OUT)| BIT(PIN_OUT2); /*'PIN_OUT2' undeclared (first use in this function)*/

                    qm_gpio_set_config(QM_GPIO_0, &cfg);/*'QM_GPIO_0' undeclared (first use in this function)*/

                   

                   

                   

                   

                    /* Loop indefinitely while blinking the LED. */

                    while (1) {

                    qm_gpio_set_pin(QM_GPIO_0, PIN_OUT);

                    qm_gpio_set_pin(QM_GPIO_0, PIN_OUT2);

                    clk_sys_udelay(DELAY);

                    qm_gpio_clear_pin(QM_GPIO_0, PIN_OUT);

                    qm_gpio_clear_pin(QM_GPIO_0, PIN_OUT2);

                    clk_sys_udelay(DELAY);

                    }

                  }

                  • 6. Re: How to configure two or more digital pins in quark D2000 kit?
                    MichelleC_Intel

                    You will need to ensure you include the qm_pinmux.h 

                     

                    #include "clk.h"
                    #include "qm_gpio.h"
                    #include "qm_pinmux.h"

                     

                     

                    -- regards,

                    Michelle.