Go Down

Topic: GPIO r/w on Due (84MHz) slower than on a M0 (48MHz) (Read 542 times) previous topic - next topic

westfw

You know how on an AVR, you can activate pullups on a pin by writing HIGH while the pin is in input mode?  That's the way the AVR hardware works, and it got documented for Arduino back before "pinMode(pin, INPUT_PULLUP)" was implemented.

The SAM and SAMD hardware doesn't work that way, but the behavior of digitalWrite() has been preserved for the sake of backward-compatibility.  The digitalWrite() code for the arms contains an explicit check to see if the pin is in input mode (a function call to libsam code), and if so it activates the pullup...

IIRC, the SAM3X "ports" are on a relatively slow "peripheral bus" that runs at half the speed of the CPU...
(The SAMD "ports" are on a different type of bus.  They're also accessible by a "single cycle bus", but the Arduino code doesn't currently use that.)

dsyleixa

hi,
thanks again for your input! That again explaines very lucidly where those issues may come from, to my great surprise.
So I must therefore also resign with this issue, but good to know where it comes from...

again, thanks a lot!

westfw

Quote
So I must therefore also resign with this issue
You can always write a faster version...
See also https://forums.adafruit.com/viewtopic.php?f=57&t=133497

dsyleixa

thank you for your link! I will have a close look on that!

pert

It looks like a new release of Arduino SAM Boards might be required to fix some screwiness of the Arduino Web Editor:
https://github.com/arduino/ArduinoCore-sam/pull/53

On the other hand, the way they run the Arduino Web Editor, they might not even use release versions. I know they decided to chuck the unfinished and known-buggy arduino-preprocessor in there, even though it hasn't even been considered stable enough for the hourly build of the Arduino IDE.

So if anyone wants to try to get some changes made that have a chance of being in a release this decade, it might be a good time to submit those PRs.

Go Up