Help scelta port expander

Buongiorno a tutti,
per i miei progetti ho sempre utilizzato Arduino Mega che offre una buona quantità di pin I/O.
Dopo aver fatto alcuni test con ESP32 vorrei provare a "spostare/testare" un progetto su tale dispositivo che però non ha molti I/O.
Mi sono documentato e le scelte sarebbero ricadute su pcf8574 oppure mcp23017.
Il primo è economico ed offre 8 porte, il secondo ne offre 16.
Quel che a me interessa in particolar modo è la possibilità di attivare la resistenza di pull_up interna. Ho trovato documentazione su come abilitarla per mcp23017 mentre per i pcf8574 sembrano esserci problemi.
Qualcuno che li utilizza mi saprebbe consigliare?
Altra mia necessità è che al boot non ci siano pin attivi (quelli impostati come output).

Grazie!

... ma, veramente, più che "problemi" direi ... sembrerebbero NON esserci proprio le pull-up sugli I/O :roll_eyes:. Questo lo schema per uno dei singoli pin di I/O:

... dove vedi il resistore di pull-up ?

Guglielmo

Ciao Guglielmo,
ho utilizzato il termine "problema" perché stavo dando un'occhiata ad altri post dove appunto c'era chi si lamentava del mancato funzionamento delle pull-up (e tu appunto confermi che non ci sono).
A questo punto credo proprio che la risposta al mio quesito sia semplice: devo utilizzare mcp23017.

Grazie!

In effetti nel datasheet non ce n'è traccia, anche se Itrt(pu) lascia sospettare qualcosa...

Gli 8574 non hanno resistenze di pull-up, ma generatori di corrente da 100uA che comunque tengono alte le uscite.
Finche si usano come ingressi non ci sono problemi o quasi, mentre se si usano come uscite possono creare dei livelli logici in uscita non attesi, in quanto al momento dell'accensione le uscite vengono settate alte.
Sconsigliato pertanto accoppiare arrays uln2003

1 Like

... il cui uso interno è molto legato a se il pin è in INPUT o OUTPUT.

In caso di "ingressi", quindi in INPUT:

Input HIGH: The master needs to write 1 to the register to set the port as an input mode if the device is not in the default power-on condition. The master reads the register to check the input status. If the external source pulls the port pin up to VDD or drives logic 1, then the master will read the value of 1.

Input LOW: The master needs to write 1 to the register to set the port to input mode if the device is not in the default power-on condition. The master reads the register to check the input status. If the external source pulls the port pin down to VSS or drives logic 0, which sinks the weak 100 µA current source, then the master will read the value of 0.

In caso di "uscite", quindi in OUTPUT:

Output HIGH: The master writes 1 to the register. There is an additional ‘accelerator’ or strong pull-up current when the master sets the port HIGH. The additional strong pull-up is only active during the HIGH time of the acknowledge clock cycle. This accelerator current helps the port’s 100 µA current source make a faster rising edge into a heavily loaded output, but only at the start of the acknowledge clock cycle to avoid bus contention if an external signal is pulling the port LOW to VSS/driving the port with logic 0 at the same time. After the half clock cycle there is only the 100 µA current source to hold the port HIGH.

Output LOW: The master writes 0 to the register. There is a strong current sink transistor that holds the port pin LOW. A large current may flow into the port, which could potentially damage the part if the master writes a 0 to the register and an external source is pulling the port HIGH at the same time.

Insomma, ha un comportamento simile alle pull-up, ma NON è realmente una pull-up ... :roll_eyes:

Guglielmo

Ah! Ecco perché non mi era chiaro il pilotaggio!

... è questa frasetta che è preoccupante perché dice che per leggere il pin a 1 una sorgente esterna lo deve portare a VDD o comunque a livello 1 ma NON dice che comunque il pin è tenuto stabile a livello 1 se lasciato aperto con il solo generatore di corrente da 100 µA ... :roll_eyes:

Infatti, quel generatore sembra fatto puttosto per l'OUTPUT, come accelerator current, durante un ben preciso periodo.

Anche le indicazioni scritte su questo schema sembrano indicare che comunque occorre una resistenza di pull-up esterna in caso di pin usato come input ...

Insomma ... io non mi sentirei mica tanto tranquillo a considerarlo alla stessa stregua di una vera pull-up ... :wink:

Guglielmo

Diciamo che si comporta come ci fosse una pull-up da 50k e forse meglio.
Il fatto che sia da sempre utilizzato per interfacciarsi con keypad o LCD la dice lunga sulla sua affidabilità.
Diverso discorso se uno lo usa in uscita per controllare attuazioni di vario genere, in questo caso io preferisco il MCP23017 che avendo un reset esterno ci si può inserire un watchdog hardware

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.