Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

digitalRead() pull-down not working #88

Closed
fgaetani opened this issue Jun 26, 2020 · 5 comments
Closed

digitalRead() pull-down not working #88

fgaetani opened this issue Jun 26, 2020 · 5 comments

Comments

@fgaetani
Copy link

Hi, I have noticed a serious issue on digitalRead () on any pin. I have a system with a 47k pull-down resistor, and a switch that pull the pin high. However, I noticed that if I don't run the digitalRead () function the pin remains low (measured with a multimeter), when I run the digitalRead () function the pin goes high (about 2.6 Volt) unless I use a very low pull-down resistance (about 4.7 k).

How can I solve it?

Thank you

@facchinm
Copy link
Member

facchinm commented Jun 29, 2020

Hi @fgaetani ,
the issue should be solved by beta branch (that I plan to release this week) as well as from upcoming mbed core (already released for PortentaH7 but it also contains support for the Nano33BLE).

Short explanation: the current porting layer for gpios wraps mbed's DigitalInOut objects in an ephemeral way; unfortunately, the mbed constructor that gets continuously called has a default pull (an internal PullUp in case of nRF52 platforms) that gets activated every time you create one of these objects.

The new layer only initializes the object once to fix this in a sane way.

@fgaetani
Copy link
Author

Hi @facchinm ,

thanks a lot for the info.
I solved momentarily by editing wiring_digital.cpp file. I have edited pinMode and digitalRead functions by including the code of the beta version (also modifying other linked files).
So will a new branch of this library come out or will we need to use ArduinoCore-mbed from now on?
I was not able to compile with ArduinoCore-mbed beta library because I had several errors from other libraries (e.g. ArduinoBLE).

Thank you

Best regards,

@facchinm
Copy link
Member

ArduinoBLE compatibility with ArduinoCore-mbed should be solved by this arduino-libraries/ArduinoBLE@3b228dc (planning to release today 🙂 )

@fgaetani
Copy link
Author

ArduinoBLE compatibility with ArduinoCore-mbed should be solved by this arduino-libraries/ArduinoBLE@3b228dc (planning to release today 🙂 )

So the new reference to use will be ArduinoCore-mbed? Will ArduinoCore-nRF528x-mbedos be deprecated?

@facchinm
Copy link
Member

That's the plan, keeping ArduinoCore-nRF528x-mbedos on mbed 5.x (and making it obsolete) and moving to mbed 6 with ArduinoCore-mbed

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

No branches or pull requests

2 participants