SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By mawrob
#248580
Using the latest Artemis Arduino version, the following code toggles pin 19 but not pin 3:
Code: Select all
//digitalWrite does not work with pin3 but it does with pin19
void setup() {
  pinMode(3, OUTPUT);
  pinMode(19, OUTPUT);
}

void loop() {
    digitalWrite(19, HIGH);
    digitalWrite(3, HIGH);
    delay(1000);
    digitalWrite(19, LOW);
    digitalWrite(3, LOW);
    delay(1000);
}
If this is rewritten as follows using the native gpio, pin 3 toggles fine.
Code: Select all
#include <am_hal_gpio.h>
// This works, both pins 3 and 19 toggle as expected
void setup() {
    am_hal_gpio_pinconfig(3, g_AM_HAL_GPIO_OUTPUT);
    am_hal_gpio_pinconfig(19, g_AM_HAL_GPIO_OUTPUT);
    am_hal_gpio_output_set(3);
    am_hal_gpio_output_set(19);
}

void loop() {
    am_hal_gpio_output_toggle(3);
    am_hal_gpio_output_toggle(19);
    delay(1000);
    am_hal_gpio_output_toggle(3);
    am_hal_gpio_output_toggle(19);
    delay(1000);
}
By paulvha
#248588
Thanks.
On a Micromod Artemis "3" or "D3" can be used to perform a 3v3_en signal. On the Micromod Motherboard, there is an (open) VE or EN-jumper (depending on the Micromod motherboard) to make the hardware connection. It feels like a catch-22 as when the processor disables the 3v3.. it also disables the power to the processor.?? As this is a special it is NOT defined in the variantPinStates-structure for the micromod Artemis. This structure, defined for each variant, is used for look-up in case of pin mode & digitalWrite & digitalRead. Hence it does not work.
User avatar
By mawrob
#248590
Thanks. I thought it might be something to do with the variants. I am using the Artemis on a custom board and so I did not pay attention to the SparkFun main board use case but that makes sense.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum