Photon DAC pin output not working - stuck at 3.26V

I’m running a simple program to test the DAC output, making sure to use the pinMode before each analogWrite:


int led = D7;

void setup() {
  pinMode(led, OUTPUT);
}

void loop() 
{
  pinMode(DAC1, OUTPUT); 
  analogWrite(DAC1, 1024);
  digitalWrite(led, HIGH);

  delay(5000);

  pinMode(DAC1, OUTPUT);
  analogWrite(DAC1, 0);   
  digitalWrite(led, LOW);

  delay(5000);
}

I’m just reading a constant 3.26V on the DAC pin. I’ve tried changing the code to use the DAC2 pin (A3) and I’m also seeing a constant 3.26V there.

I’ve confirmed that I can read the voltage change on the D7 pin, so I don’t think it’s my meter. I’m using the Sparkfun Photon Redboard. Any thoughts?

I think you are seeing this issue

3 Likes

Confirmed.

I was able to get it working by flashing back to 0.4.5.

Thanks!

@spoff hopefully not a stupid question. To flash back to 0.4.5 just select it from the build Devices menu and then click flash??

Also on the same tone of silly questions. Is anyone having issues with analog read from A0, A1 and A2 with firmware 0.4.6?

Unfortunately no. I was also hoping it was just a matter of selecting 0.4.5 in the menu as well.

To go back to 0.4.5, I had to install the Particle CLI and then flash the 0.4.5 version to my device through the CLI. But in order to do that, it was a somewhat laborious process of installing all the supporting software (I don’t work with this stuff often so it was a learning experience).

I would start here: Tutorial: Particle-cli on Windows [07 Jun 2015]

I believe I got the 0.4.5 files (there’s a part 1 and part 2) from the github page, but honestly don’t remember where. I think if you search the forums there’s a guidance on flashing the firmware. Hopefully that helps!

Once you got your system set up, in order to downgrade you need to make sure to flash part2 before flashing part1 (reverse order than upgrade).

Similar question with a link to the pre-built binaries here
analogWrite DAC only once for each pinMode( ,OUTPUT)

@spoff @ScruffR. Can you clear something up for me? Does the Photon automatically upgrade to new firmware on a regular basis or just when you boot up for the first time? If it does automatically, can this ability be controlled in code? I would only like to upgrade the firmware when I know my Wifi strength is good.

The Photon only upgrades automatically when you flash new code that is targeting this new version.
Which currently is the default behaviour of Particle Dev and CLI, but on Web IDE you got the choice.
If you change the target version from currently latest (0.4.6) to 0.4.6 or any of the previous ones your Photon will not be upgraded automatically when 0.4.7 arrives.

That makes sense. So @spoff just sets his to 0.4.5 and it will not update even if he flashes new code. Thank you very much.

1 Like