Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,265 Views

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

Jump to solution

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

0 Kudos
1 Solution
Michelle_C_Intel
Employee
77 Views

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

}

}

View solution in original post

6 Replies
Michelle_C_Intel
Employee
78 Views

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

}

}

View solution in original post

idata
Community Manager
77 Views

Thank you MichelleC_Intel

my mistake as you expected in GPIO direction setup

idata
Community Manager
77 Views

Hi

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

Michelle_C_Intel
Employee
77 Views

Hi ,

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

-Michelle.

idata
Community Manager
77 Views

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

}

}

Michelle_C_Intel
Employee
77 Views

You will need to ensure you include the qm_pinmux.h

# include "clk.h"

 

# include "qm_gpio.h"

 

# include "qm_pinmux.h"

-- regards,

Michelle.

Reply