Cos'è ElectroYou | Login Iscriviti

ElectroYou - la comunità dei professionisti del mondo elettrico

Problema a far funzionare l'MCP4728

Progetti, interfacciamento, discussioni varie su questa piattaforma.

Moderatori: Foto UtenteWALTERmwp, Foto Utentexyz

0
voti

[41] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto UtenteGioArca67 » 22 ott 2021, 15:06

Ma verso i 5V
Avatar utente
Foto UtenteGioArca67
4.580 4 6 9
Master EY
Master EY
 
Messaggi: 4591
Iscritto il: 12 mar 2021, 9:36

0
voti

[42] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto Utentepusillus » 22 ott 2021, 15:07

Si, 4.7k vanno bene
Avatar utente
Foto Utentepusillus
3.207 3 6 11
Master
Master
 
Messaggi: 1031
Iscritto il: 5 mar 2016, 15:19
Località: Latina

0
voti

[43] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto UtenteGioCosco » 22 ott 2021, 15:09

Confermo per i pullup, a 5 V se vanno al micro a 5 V. Io metterei anche un ritardo tra la scansione di un indirizzo e il successivo, i 5 secondi alla fine servono a poco. Potrebbe anche essere un problema di velocità del bus I2C. Domanda sciocca ma... non hai un oscilloscopio per vedere cosa passa sul bus ? Giusto per vedere se i SCL e SDA sono decenti.
Avatar utente
Foto UtenteGioCosco
70 1
 
Messaggi: 25
Iscritto il: 14 giu 2019, 14:28

0
voti

[44] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto Utentepusillus » 22 ott 2021, 15:13

Ho guardato solo ora lo schema.
Anche MCP4728 va alimentato a 5v
Avatar utente
Foto Utentepusillus
3.207 3 6 11
Master
Master
 
Messaggi: 1031
Iscritto il: 5 mar 2016, 15:19
Località: Latina

0
voti

[45] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto Utentealien75 » 23 ott 2021, 8:32

Ho messo le resistenze di pull up da 4,7K verso i 5V poi ho modiifcato il codice come segue:

Codice: Seleziona tutto
#include <Wire.h>

int num=0;

void setup()
{
  Wire.begin();

  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      delay(500);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknow error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }   
  }
  if (nDevices == 0)
  {
    Serial.println("No I2C devices found\n");
    Serial.println(num);
    ++num;
  }
  else
    Serial.println("done\n");
}


Mi sono fermato alla scansione 2400 circa e procede ad una velocità sostenuta.
Continua a darmi: "No device found"
Non trova nessuna porta libera.
perché?
Avatar utente
Foto Utentealien75
1 1 4 8
Sostenitore
Sostenitore
 
Messaggi: 589
Iscritto il: 31 lug 2011, 14:08

0
voti

[46] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto Utentepusillus » 23 ott 2021, 10:42

A questo punto inizio a sospettare che possa essere guasto il dac o arducoso. Potresti vedere che tira fuori i2c con un analizzatore logico. Oppure collegare un altro device i2c, come una eeprom, e vedere se risponde allo scanner.
Avatar utente
Foto Utentepusillus
3.207 3 6 11
Master
Master
 
Messaggi: 1031
Iscritto il: 5 mar 2016, 15:19
Località: Latina

0
voti

[47] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto UtenteGioArca67 » 23 ott 2021, 10:44

Non capisco questo 2400 da dove venga visto che scandisce da 0 a 127
Avatar utente
Foto UtenteGioArca67
4.580 4 6 9
Master EY
Master EY
 
Messaggi: 4591
Iscritto il: 12 mar 2021, 9:36

0
voti

[48] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto Utentepusillus » 23 ott 2021, 10:47

Non capisco dove vedi questo 2400
Avatar utente
Foto Utentepusillus
3.207 3 6 11
Master
Master
 
Messaggi: 1031
Iscritto il: 5 mar 2016, 15:19
Località: Latina

0
voti

[49] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto Utentealien75 » 23 ott 2021, 10:48

ARDUINO YUN funziona altrimenti non ci sarebbero sisposte da parte del teminale rivolte verso l'IDE e da parte dello scanner I2C.
Avatar utente
Foto Utentealien75
1 1 4 8
Sostenitore
Sostenitore
 
Messaggi: 589
Iscritto il: 31 lug 2011, 14:08

0
voti

[50] Re: Problema a far funzionare l'MCP4728

Messaggioda Foto UtenteGioArca67 » 23 ott 2021, 10:57

Richiediamo: da dove esce fuori 2400? Che cosa è?
Avatar utente
Foto UtenteGioArca67
4.580 4 6 9
Master EY
Master EY
 
Messaggi: 4591
Iscritto il: 12 mar 2021, 9:36

PrecedenteProssimo

Torna a Arduino

Chi c’è in linea

Visitano il forum: Nessuno e 22 ospiti