help with using registers to chagne pin dirrections and states.

ulaoulao
Posts: 21
Joined: Thu Jun 13, 2024 6:25 pm

Re: help with using registers to chagne pin dirrections and states.

Postby ulaoulao » Sat Nov 09, 2024 8:16 pm

I can change the mode easy enough with I can change the mode easy enough with GPIO_MODE_INPUT_OUTPUT_OD

but I'm still not able to find the way to change directions when using bundles. Seems if I write low, the device can not talk ( good ) if I pull high the device cant talk ( good) but I can not write to the bus now.

To clarify.
I want to use the bundles for accuracy and speed.
using GPIO_MODE_INPUT_OUTPUT I can write to the bus high or low. but cna not change to input
using GPIO_MODE_INPUT_OUTPUT_OD I can allow the other device to write, and I can stop the device from writing but can not write to the bus.


maybe there is a way to change the bundle to GPIO_MODE_INPUT_OUTPUT_OD and back to GPIO_MODE_INPUT_OUTPUT after its set up?
like a ee register for od ?

MicroController
Posts: 1701
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: help with using registers to chagne pin dirrections and states.

Postby MicroController » Sat Nov 09, 2024 10:36 pm

If you had read about open drain outputs by now, you would have read that you need a pull-up resistor (or current source) on the line.
The internal pull-ups of the ESP (~50kOhm) may or may not be strong enough in your case (you just need to enable them); if not, you will want to try an external pull-up of approriate value.

To clarify: You do not want to directly connect two or more push-pull outputs, unless you can make sure that at no time one output is high while another one is low.
A common, and the easiest, way to avoid this short-circuit is to use open-drain outputs, instead of push-pull, to connect to the bus, with a corresponding pull-up resistor or current source.
Less common is a resistor in-line between the push-pull outputs to prevent damage in case of temporary/accidental high+low output 'collisions'.

ulaoulao
Posts: 21
Joined: Thu Jun 13, 2024 6:25 pm

Re: help with using registers to chagne pin dirrections and states.

Postby ulaoulao » Tue Nov 12, 2024 5:29 pm

This does work, but the time form high to low is a minimum of 696 ns. that won't work unfortunately.

Who is online

Users browsing this forum: No registered users and 151 guests