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

check mux mode when using digitalWrite #335

Merged
merged 1 commit into from
Dec 14, 2016

Conversation

bigdinotech
Copy link
Contributor

-check and make sure that the pin is in GPIO_MUX_MODE when doing a
digitalWrite()
-this has a slight performance impact of digitalWrite
-it also comsumes an extra byte in SRAM per pin
-it does however give us the ability to track the muxing state of each
pin

-check and make sure that the pin is in GPIO_MUX_MODE when doing a
digitalWrite()
-this has a slight performance impact of digitalWrite
-it also comsumes an extra byte in SRAM per pin
-it does however give us the ability to track the muxing state of each
pin
@bigdinotech
Copy link
Contributor Author

@SidLeung @eriknyquist please review
@khanning @agdl @facchinm this should fix #280 and #334
as I mentioned before there is a slight performance impact but it seems more negligeable than I initially though

@eriknyquist
Copy link
Contributor

I think I2S, I2SDMA and possibly some more need to set pinMuxMode too. See the following two commits, where I removed them, for reference;

3d3c1f9
1a5e3f7

@agdl
Copy link
Member

agdl commented Oct 27, 2016

Works for me!

@noelpaz
Copy link
Contributor

noelpaz commented Oct 27, 2016

@russmcinnis . Can you please verify?

@bigdinotech
Copy link
Contributor Author

@eriknyquist I2S will be added once the @SidLeung finishes the changes for it

@russmcinnis
Copy link
Contributor

I test variations of the examples and it works for me too. I was doing some testing using sketch delayMicroseconds() to just measure the frequency of 100 consecutive digitalRead() or digitalWrite() calls without checking any signals. The digitalWrite() function speed with the mux checking added was about 75% of the speed without it.

@bigdinotech
Copy link
Contributor Author

@russmcinnis please test this with CurieSoftwareSerial library.
It should only affect the tx performance of it and the appropriate changes is already in this commit

@eriknyquist
Copy link
Contributor

@russmcinnis can you see what SoftwareSerial behaviour is like with these changes?

@russmcinnis
Copy link
Contributor

I don't see any difference. I ran the BAT test that hooks up SoftwareSerial pins to Hardware Serial (Serial1) pins. The test runs a lot of transactions and passes.

Next I ran most of the baud rates by looping:
mySerial.write(0x1);
I have some tables of the frequency from the scope and I don't see any difference. I thought I would see a difference since before I was measuring digitalWrite(HIGH and LOW) in a tight loop and saw performance fall by 25%.

@bigdinotech
Copy link
Contributor Author

@calvinatintel please merge this one also. Jenkins merger is also failing for this one

@eriknyquist eriknyquist merged commit 431c781 into arduino:master Dec 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants