KNOT GPIO pin5 output functionality

Hi all,

We’re configuring a KNOT to use the three GPIO digital pins to switch additional LEDs. As per the documentation https://help.mikrotik.com/docs/spaces/ROS/pages/68944101/GPIO pins 4 and 6 are permanently set to output and are working as expected. We’ve set pin5 to direction OUTPUT but the behaviour doesn’t match that of pins 4 and 6. When we set pin5 to output=0 it doesn’t short the connection like pins 4 and 6, and there is a 2.45V reading. When we set it to output=1 the voltage increases to 2.9V. We wouldn’t expect any significant voltage across the pins.

Our expectation was that by setting the direction to OUTPUT pin5 would behave the same as the other 2 digital output pins (4 and 6). Has anyone else experienced this, or have any recommendations on how to fix?

Thanks,
Ewen.

You might want to look at the KNOT user manual, which has the GPIO assignments. The main GPIO docs do note that they vary by device, but it’s easy to forgot there is an KNOT specific page that has a bit more specifics:

https://help.mikrotik.com/docs/spaces/UM/pages/41680915/RB924i-2nD-BT5+BG77#RB924i2nDBT5%26BG77-GPIOpinout

Thanks, we’ve been working from those specs. It is exactly that and https://help.mikrotik.com/docs/spaces/ROS/pages/68944101/GPIO#GPIO-%2Fiotgpiodigital which leads us to believe pin5 should act the same as pin4 and pin6 when the direction is set to output. However that does not seem to be the case.

I haven’t test GPIO much, so IDK.

But the photo shows pin5 as “Digital input”, so perhaps it’s not changeable to output (even if GPIO docs suggest otherwise):
image2021-5-28_8-10-49.png

Result from this statement

/iot gpio digital print
Columns: NAME, DIRECTION, OUTPUT
# NAME  DIRECTION  OUTPUT
0 pin4  output          0
1 pin5  output          0
2 pin6  output          0

suggests we can set it to output (so it has changed here to output), and we can set the output value to 0 or 1, it just behaves differently on the GPIO board to pin4/6. But I agree, the docs imply pin5 works as input or output by not stating pin5 can only be input, but do not explicitly say it works as output.

Might want to file a ticket at help.mikrotik.com to ask. Either it’s a bug, or docs are wrong. What you’re doing seems like it should work based on my reading too.

Glad my reading of the docs matches yours. I’ve raised a ticket. I’ll report back any response / solution.

Response from MikroTik support:

This is an expected behaviour - the pin 5 is a digital input pin, it is directly connected to the SoC, wheres the digital output pins (4 and 6) have transistors that can short the connection to GND.

I’ve suggested they make this clearer in the documentation that although it can be changed to output it does not behave in the same way as the other digital output pins.

The usual nonsensical non-explanation. :open_mouth:

Pin 5 is described as being selectable as either input or output.

That a digital pin may (or may not) sink to 0 V (and how much current it can sink) depends of course on the implementation, but the nature of output of the pin is clear.

To me the 2.45 vs. 2.9 V don’t sound as a good digital 0/1 anyway, neither along the traditional TTL 5 V logic, nor following the newish Arduino (more tolerant) one:
https://learn.sparkfun.com/tutorials/logic-levels/all
but maybe that depends on the exact way you measured the voltage levels.