Skip to content

Mere presence of (even unused) function with PinName argument makes DigitalWriteFast slower 10x #159

@dvhx

Description

@dvhx

I'm using STM32F103C8T6 blue pill. I'm bitbangin DAC8830. Everything works fine, the output is sawtooth at around 4kHz. But if I add this function:

void asdf(PinName zz) {
  digitalWriteFast(zz, LOW);
}

Even though it's not even used, the speed drops to 500Hz which is almost 10x slowdown.

fast.ino.txt - this is fast version
slow.ino.txt - this is slow version
DSC00304 - scope comparing fast and slow version

The only difference is really only the presence of one unused function. Of course in real code this function is used and does something but I was able to minimize the code to still cause the slowdown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions