Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dvhx opened this issue Apr 11, 2024 · 2 comments

Comments

@dvhx
Copy link

dvhx commented Apr 11, 2024

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.

@VimalO2
Copy link

VimalO2 commented Apr 18, 2024

can you provide the circuit connectiion

@dvhx
Copy link
Author

dvhx commented Apr 18, 2024

dac8830 png cropped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants