Skip to content

analogWrite on R4 boards generates spikes #460

Open
@kevinjwalters

Description

@kevinjwalters

An arduino program trying to use analogWrite() to accurately generate a waveform suffers from a lot of brief spikes. I noticed these when trying to make a low frequency triangle wave. A recent Playduino YouTube video (by @olivereybel) shows these although it's possible they aren't shown in full by the oscilloscope. Even setting the midpoint value repeatedly can do this.

Arduino UNO R4 Minima DAC 8bit 127 value repeatedly set

Arduino UNO R4 Minima DAC 12bit sine wave

A more advanced oscilloscope shows this for a sine wave.

Image

Perhaps the issue discussed in the "Hairy output on R4 DAC" forum topic was never fixed? @TriodeGirl provided some code to deal with this in https://github.com/TriodeGirl/Arduino-UNO-R4-code-DAC-ADC-Ints-Fast_Pins/

Arduino Forum discussion: Spikes on UNO R4 DAC output using analogWrite()


Other analogWrite issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions