[gelöst:] ENC28J60 + Arduino NANO + Firmata

Begonnen von JensS, 07 Januar 2015, 19:45:46

Vorheriges Thema - Nächstes Thema

JensS

Hallo,

ich bekomme die Kombination ENC28J60 + Arduino NANO + Firmata nicht hin.
Nicht mal ein Ping funktioniert.
Kann mir bitte jemand die PIN-Belgung und notwendigen Änderungen im ConfigurableFirmata-Sketch mitteilen?
Derzeit ist die PIN-Belegung zwischen LAN-Adapter und Arduino NANO wie beim UNO:
(http://www.geeetech.com/wiki/images/d/d7/ENC-table.jpg)

Gruß Jens
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

JensS

Nach dem Auskommentieren von I2C im Sketch wird der Arduino NANO im Netzwerk und von FHEM erkannt.
An PIN 5 habe ich eine LED angeschlossen und diese lässt sich auch per FRM_OUT definieren bzw. schalten.
Zwar wollte ich zum Arduino die dort über OneWire gemessene Bodenfeuchte auf ein Display per I2C zurücksenden, aber OneWire und I2C gleichzeitig scheint nicht zu funktionieren.
In der Portkonfiguration der ConfigurableFirmata habe ich folgende Ergänzungen/Anderungen vorgenommen:
for (byte i=0; i < TOTAL_PINS; i++) {
    if (IS_PIN_SPI(i)
        || 2==i
        || 10==i
        || 11==i
        || 12==i
        || 13==i
        )

pinMode(PIN_TO_DIGITAL(2), OUTPUT);
pinMode(PIN_TO_DIGITAL(10), OUTPUT);
pinMode(PIN_TO_DIGITAL(11), OUTPUT);
pinMode(PIN_TO_DIGITAL(12), OUTPUT);
pinMode(PIN_TO_DIGITAL(13), OUTPUT);
   digitalWrite(PIN_TO_DIGITAL(10), HIGH);

Das ist bestimmt nicht ganz richtig. In FHEM werden mir auch die verfügbaren PINs nicht angezeigt.
Das Handshake zur Initialisierung scheint nicht vollständig durchzulaufen:
ZitatReadings
error Unhandled sysex command


Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

ntruchsess

Zitat von: dirigent am 08 Januar 2015, 11:49:16
In FHEM werden mir auch die verfügbaren PINs nicht angezeigt.
Das Handshake zur Initialisierung scheint nicht vollständig durchzulaufen:

-> FirmataExt muss drin bleiben.
while (!asleep()) {sheep++};

JensS

Danke für die Antwort! ich dachte schon, das Thema wäre im Anfängerbereich besser platziert.
FirmataExt ist drin.
I2C, Servo, analog in & out, Stepper sind auskommentiert.
Als Zusatzinfo: UDP hatte ich in der conf auskommentiert - wegen Speichermangel.

Gruß Jens
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

JensS

#4
Seltsam ist, wenn ich I2C mit reinnehme, ist der Arduino im Netzwerk nicht mehr ansprechbar.
Habe ich beim Verkabeln was falsch gemacht?
So sieht der Sketch aus:
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please click on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/

/*
  Copyright (C) 2006-2008 Hans-Christoph Steiner.  All rights reserved.
  Copyright (C) 2010-2011 Paul Stoffregen.  All rights reserved.
  Copyright (C) 2009 Shigeru Kobayashi.  All rights reserved.
  Copyright (C) 2009-2013 Jeff Hoefs.  All rights reserved.
  Copyright (C) 2013 Norbert Truchsess. All rights reserved.
  Copyright (C) 2014 Nicolas Panel. All rights reserved.
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  See file LICENSE.txt for further informations on licensing terms.

  formatted using the GNU C formatting and indenting
*/


#include <Firmata.h>

/*
* by default Firmata uses the Serial-port (over USB) of Arduino.
* ConfigurableFirmata may also comunicate over ethernet using tcp/ip.
* To configure this 'Network Firmata' to use the original WIZ5100-based
* ethernet-shield or Arduino Ethernet uncomment the includes of 'SPI.h' and 'Ethernet.h':
*/

//#include <SPI.h>
//#include <Ethernet.h>

/*
* To configure 'Network Firmata' to use an ENC28J60 based board include
* 'UIPEthernet.h' (no SPI.h required). The UIPEthernet-library can be downloaded
* from: https://github.com/ntruchsess/arduino_uip
*/

#include <UIPEthernet.h>

/*
* To execute Network Firmata on Yun uncomment Bridge.h and YunClient.h.
* Do not include Ethernet.h or SPI.h in this case.
* On Yun there's no need to configure local_ip and mac in the sketch
* as this is configured on the linux-side of Yun.
*/

//#include <Bridge.h>
//#include <YunClient.h>

#if defined ethernet_h || defined UIPETHERNET_H || defined _YUN_CLIENT_H_
/*==============================================================================
* Network configuration for Network Firmata
*============================================================================*/
#define NETWORK_FIRMATA
//replace with ip of server you want to connect to, comment out if using 'remote_host'
#define remote_ip IPAddress(192,168,1,222)
//replace with hostname of server you want to connect to, comment out if using 'remote_ip'
//#define remote_host "server.local"
//replace with the port that your server is listening on
#define remote_port 3031
//replace with arduinos ip-address. Comment out if Ethernet-startup should use dhcp. Is ignored on Yun
#define local_ip IPAddress(192,168,1,224)
//replace with ethernet shield mac. It's mandatory every device is assigned a unique mac. Is ignored on Yun
const byte mac[] = {0x90,0xA2,0xDA,0x0D,0x07,0x03};
#endif

// To configure, save this file to your working directory so you can edit it
// then comment out the include and declaration for any features that you do
// not need below.

// Also note that the current compile size for an Arduino Uno with all of the
// following features enabled is about 22.4k. If you are using an older Arduino
// or other microcontroller with less memory you will not be able to include
// all of the following feature classes.

#include <utility/DigitalInputFirmata.h>
DigitalInputFirmata digitalInput;

#include <utility/DigitalOutputFirmata.h>
DigitalOutputFirmata digitalOutput;

//#include <utility/AnalogInputFirmata.h>
//AnalogInputFirmata analogInput;

//#include <utility/AnalogOutputFirmata.h>
//AnalogOutputFirmata analogOutput;

#include <Servo.h> //wouldn't load from ServoFirmata.h in Arduino1.0.x
//#include <utility/ServoFirmata.h>
//ServoFirmata servo;

#include <Wire.h> //wouldn't load from I2CFirmata.h in Arduino1.0.x
//#include <utility/I2CFirmata.h>
//I2CFirmata i2c;

//#include <utility/OneWireFirmata.h>
//OneWireFirmata oneWire;

#include <Wire.h> //wouldn't load from I2CFirmata.h in Arduino1.0.x
//#include <utility/DS2482Firmata.h>
//DS2482Firmata ds2482;

//#include <utility/StepperFirmata.h>
//StepperFirmata stepper;

#include <utility/FirmataExt.h>
FirmataExt firmataExt;

#include <utility/FirmataScheduler.h>
FirmataScheduler scheduler;

#include <utility/EncoderFirmata.h>
EncoderFirmata encoder;


// dependencies. Do not comment out the following lines
#if defined AnalogOutputFirmata_h || defined ServoFirmata_h
#include <utility/AnalogWrite.h>
#endif

#if defined AnalogInputFirmata_h || defined I2CFirmata_h || defined EncoderFirmata_h
#include <utility/FirmataReporting.h>
FirmataReporting reporting;
#endif

// dependencies for Network Firmata. Do not comment out.
#ifdef NETWORK_FIRMATA
#if defined remote_ip && defined remote_host
#error "cannot define both remote_ip and remote_host at the same time!"
#endif
#include <utility/EthernetClientStream.h>
#ifdef _YUN_CLIENT_H_
YunClient client;
#else
EthernetClient client;
#endif
#if defined remote_ip && !defined remote_host
#ifdef local_ip
  EthernetClientStream stream(client,local_ip,remote_ip,NULL,remote_port);
#else
  EthernetClientStream stream(client,IPAddress(0,0,0,0),remote_ip,NULL,remote_port);
#endif
#endif
#if !defined remote_ip && defined remote_host
#ifdef local_ip
  EthernetClientStream stream(client,local_ip,IPAddress(0,0,0,0),remote_host,remote_port);
#else
  EthernetClientStream stream(client,IPAddress(0,0,0,0),IPAddress(0,0,0,0),remote_host,remote_port);
#endif
#endif
#endif

/*==============================================================================
* FUNCTIONS
*============================================================================*/

void systemResetCallback()
{
  // initialize a defalt state

  // pins with analog capability default to analog input
  // otherwise, pins default to digital output
  for (byte i=0; i < TOTAL_PINS; i++) {
    if (IS_PIN_ANALOG(i)) {
#ifdef AnalogInputFirmata_h
      // turns off pullup, configures everything
      Firmata.setPinMode(i, ANALOG);
#endif
    } else if (IS_PIN_DIGITAL(i)) {
#ifdef DigitalOutputFirmata_h
      // sets the output to 0, configures portConfigInputs
      Firmata.setPinMode(i, OUTPUT);
#endif
    }
  }

#ifdef FirmataExt_h
  firmataExt.reset();
#endif
}

/*==============================================================================
* SETUP()
*============================================================================*/

void setup()
{
#ifdef NETWORK_FIRMATA
#ifdef _YUN_CLIENT_H_
  Bridge.begin();
#else
#ifdef local_ip
  Ethernet.begin((uint8_t*)mac,local_ip);  //start ethernet
#else
  Ethernet.begin((uint8_t*)mac); //start ethernet using dhcp
#endif
#endif
  delay(1000);
#endif
  Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);

#if defined AnalogOutputFirmata_h || defined ServoFirmata_h
  /* analogWriteCallback is declared in AnalogWrite.h */
  Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
#endif

  #ifdef FirmataExt_h
#ifdef DigitalInputFirmata_h
  firmataExt.addFeature(digitalInput);
#endif
#ifdef DigitalOutputFirmata_h
  firmataExt.addFeature(digitalOutput);
#endif
#ifdef AnalogInputFirmata_h
  firmataExt.addFeature(analogInput);
#endif
#ifdef AnalogOutputFirmata_h
  firmataExt.addFeature(analogOutput);
#endif
#ifdef ServoFirmata_h
  firmataExt.addFeature(servo);
#endif
#ifdef I2CFirmata_h
  firmataExt.addFeature(i2c);
#endif
#ifdef OneWireFirmata_h
  firmataExt.addFeature(oneWire);
#endif
#ifdef DS2482Firmata_h
  firmataExt.addFeature(ds2482);
#endif
#ifdef StepperFirmata_h
  firmataExt.addFeature(stepper);
#endif
#ifdef FirmataReporting_h
  firmataExt.addFeature(reporting);
#endif
#ifdef FirmataScheduler_h
  firmataExt.addFeature(scheduler);
#endif
#ifdef EncoderFirmata_h
  firmataExt.addFeature(encoder);
#endif
#endif
  /* systemResetCallback is declared here (in ConfigurableFirmata.ino) */
  Firmata.attach(SYSTEM_RESET, systemResetCallback);

  // Network Firmata communicates with Ethernet-shields over SPI. Therefor all
  // SPI-pins must be set to IGNORE. Otherwise Firmata would break SPI-communication.
  // add Pin 10 and configure pin 53 as output if using a MEGA with Ethernetshield.
  // No need to ignore pin 10 on MEGA with ENC28J60, as here pin 53 should be connected to SS:
#ifdef NETWORK_FIRMATA
  // ignore SPI and pin 4 that is SS for SD-Card on Ethernet-shield
  for (byte i=0; i < TOTAL_PINS; i++) {
    if (IS_PIN_SPI(i)
        || 2==i
        || 10==i
        || 11==i
        || 12==i
        || 13==i
        // || 10==i //explicitly ignore pin 10 on MEGA as 53 is hardware-SS but Ethernet-shield uses pin 10 for SS
        ) {
      Firmata.setPinMode(i, IGNORE);
    }
  }
//  pinMode(PIN_TO_DIGITAL(53), OUTPUT); configure hardware-SS as output on MEGA
  pinMode(PIN_TO_DIGITAL(2), OUTPUT); // switch off SD-card bypassing Firmata
  pinMode(PIN_TO_DIGITAL(10), OUTPUT);
  pinMode(PIN_TO_DIGITAL(11), OUTPUT);
  pinMode(PIN_TO_DIGITAL(12), OUTPUT);
  pinMode(PIN_TO_DIGITAL(13), OUTPUT);
  digitalWrite(PIN_TO_DIGITAL(10), HIGH); // SS is active low;

  // start up Network Firmata:
  Firmata.begin(stream);
#else
  // start up the default Firmata using Serial interface:
  Firmata.begin(57600);
#endif
  systemResetCallback();  // reset to default config
}

/*==============================================================================
* LOOP()
*============================================================================*/
void loop()
{
#ifdef DigitalInputFirmata_h
  /* DIGITALREAD - as fast as possible, check for changes and output them to the
   * stream buffer using Firmata.write()  */
  digitalInput.report();
#endif

  /* STREAMREAD - processing incoming messagse as soon as possible, while still
   * checking digital inputs.  */
  while(Firmata.available()) {
    Firmata.processInput();
#ifdef FirmataScheduler_h
    if (!Firmata.isParsingMessage()) {
      goto runtasks;
    }
  }
  if (!Firmata.isParsingMessage()) {
runtasks: scheduler.runTasks();
#endif
  }

  /* SEND STREAM WRITE BUFFER - TO DO: make sure that the stream buffer doesn't go over
   * 60 bytes. use a timer to sending an event character every 4 ms to
   * trigger the buffer to dump. */

#ifdef FirmataReporting_h
  if (reporting.elapsed()) {
#ifdef AnalogInputFirmata_h
    /* ANALOGREAD - do all analogReads() at the configured sampling interval */
    analogInput.report();
#endif
#ifdef I2CFirmata_h
    // report i2c data for all device with read continuous mode enabled
    i2c.report();
#endif
#ifdef EncoderFirmata_h
    // report encoders positions if reporting enabled.
    encoder.report();
#endif
  }
#endif
#ifdef StepperFirmata_h
  stepper.update();
#endif
#if defined NETWORK_FIRMATA && !defined local_ip &&!defined _YUN_CLIENT_H_
  if (Ethernet.maintain())
    {
      stream.maintain(Ethernet.localIP());
    }
#endif
}
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

Wzut

Ich tippe eher darauf das dir der Speicher knapp wird, das Programm läßt sich dann zwar noch übetragen aber das Netzwerk ist ohne Funktion.
Wird testweise einfach noch etwas mehr raus :)
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

JensS

#6
Arduino 1.0.6 sagt bei auskommentierten I2C:
ZitatBinäre Sketchgröße: 26.180 Bytes (von einem Maximum von 30.720 Bytes)
Dann lässt sich z.B. eine LED an PIN 5 ansprechen.
Trotzdem klappt die Initialisierung nicht richtig:
Zitat
error

Unhandled sysex command

2015-01-08 18:36:38
Log:
2015.01.08 21:02:07 4: Connection accepted from FRM:192.168.1.224:1025
2015.01.08 21:02:07 5: FRM:>ff
2015.01.08 21:02:07 5: SW: ff
2015.01.08 21:02:09 3: querying Firmata Firmware Version
2015.01.08 21:02:09 5: FRM:>f079f7
2015.01.08 21:02:09 5: SW: f079f7
2015.01.08 21:02:09 5: FRM:<f07902064600690072006d006100740061002d004e0041004e004f002e0069006e006f00f7
2015.01.08 21:02:09 3: Firmata Firmware Version: Firmata-NANO.ino V_2_06
2015.01.08 21:02:09 5: FRM:>f069f7
2015.01.08 21:02:09 5: SW: f069f7
2015.01.08 21:02:09 5: FRM:>f06bf7
2015.01.08 21:02:09 5: SW: f06bf7
2015.01.08 21:02:09 5: FRM:<f07155006e00680061006e0064006c0065006400200073007900730065007800200063006f006d006d0061006e006400f7f06c7f7f7f00010101091c7f000101017f000101017f000101017f000101017f000101017f000101017f7f7f7f7f000101017f000101017f000101017f000101017f000101017f000101017f7f7ff7
2015.01.08 21:02:09 3: received String_data: Unhandled sysex command
2015.01.08 21:02:09 5: Triggering FirmataHecke (1 changes)
2015.01.08 21:02:09 5: Notify loop for FirmataHecke error: Unhandled sysex command
2015.01.08 21:02:09 4: eventTypes: FRM FirmataHecke error: Unhandled sysex command -> error: Unhandled sysex command

So sieht es beim anderen FRM-Device aus - hier klappt die Kommunikation:
2015.01.08 21:41:51 4: Connection accepted from FRM:192.168.1.223:1025
2015.01.08 21:41:51 5: FRM:>ff
2015.01.08 21:41:51 5: SW: ff
2015.01.08 21:41:51 5: FRM:<e03100e10302
2015.01.08 21:41:51 5: FRM:<e25d01e36402e43d04e54804
2015.01.08 21:41:53 3: querying Firmata Firmware Version
2015.01.08 21:41:53 5: FRM:>f079f7
2015.01.08 21:41:53 5: SW: f079f7
2015.01.08 21:41:53 5: FRM:<f0
2015.01.08 21:41:53 5: FRM:<7902064600690072006d006100740061002d0055004e004f002e0069006e006f00f7
2015.01.08 21:41:53 3: Firmata Firmware Version: Firmata-UNO.ino V_2_06
2015.01.08 21:41:53 5: FRM:>f069f7
2015.01.08 21:41:53 5: SW: f069f7
2015.01.08 21:41:53 5: FRM:>f06bf7
2015.01.08 21:41:53 5: SW: f06bf7
2015.01.08 21:41:53 5: FRM:<f0
2015.01.08 21:41:53 5: FRM:<6a7f7f7f7f7f7f7f7f7f7f7f7f7f7f000102030405f7f0
2015.01.08 21:41:53 5: FRM:<6c7f7f00010101040e0701091c7f000101010308040e0701091c7f7f000101010308040e07017f000101010308040e07017f000101
2015.01.08 21:41:53 5: FRM:<01040e07017f00010101040e07017f000101010308040e07017f7f7f7f7f00010101020a07017f00010101020a07017f00010101020a07
2015.01.08 21:41:53 5: FRM:<017f00010101020a07017f00010101020a060107017f00010101020a060107017ff7
2015.01.08 21:41:53 5: FRM:>f07a007df7
2015.01.08 21:41:53 5: SW: f07a007df7
2015.01.08 21:41:53 5: FRM:>f40200
2015.01.08 21:41:53 5: SW: f40200
2015.01.08 21:41:53 5: FRM:>d001
2015.01.08 21:41:53 5: SW: d001
2015.01.08 21:41:53 5: FRM:>d001
2015.01.08 21:41:53 5: SW: d001
2015.01.08 21:41:53 5: Triggering Firmata_In (1 changes)
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

JensS

#7
Nächster Variante:
Sobald die analogen In- & Outputs im Sketch aktiviert sind, antwortet der Arduino auf keinen Ping und wird in fhem als disconnected gelistet.

Falls hier jemanden hier gibt, der die Kombination ENC28J60 + Arduino NANO + Firmata zum Laufen bekommen hat, möge er mir doch bitte auf die Sprünge helfen. Oder ist diese Kombination nicht kompatibel? Wäre schade, aber auch diese Info wäre eine Hilfe.

Gruß Jens
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

Wzut

Zitat von: dirigent am 08 Januar 2015, 22:13:20
möge er mir doch bitte auf die Sprünge helfen.
das habe ich bereits oben versucht , du wirst vermutlich an dem "nur" 32K großem Flash Speichern genau so scheitern wie ich damals mit dem Atmega32 , siehe http://forum.fhem.de/index.php/topic,16681.msg151029.html#msg151029
mit den Tipps von Norbert damals lief es gerade so, aber instabil so das ich später dann doch auf den ATmega644 gewechselt habe.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

JensS

#9
Danke, wenn 4,34 kb freier Speicher nicht reichen, muss ich wohl einen MEGA nehmen. Schade, der NANO passt besser in die Anschlusssäule und braucht evtl. auch etwas weniger Strom.
Zitat von: Wzut am 09 Januar 2015, 10:47:34
mit den Tipps von Norbert damals lief es gerade so, aber instabil.
Kannst du mir das damalige Sketch und die Anschlussbelegung posten?

Gruß Jens

p.s. Das ist mein Projekt:
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

JensS

HEUREKA!!!
Dank des Links von Wzut auf das ConfigurableFirmata v2.06 (mit ROTENC) von ntruchsess läuft der NANO nun auch mit aktiviertem I2C und 1-wire! Nicht mal den PIN-Sektor musste ich ändern.
Danke an Euch!
Nun habe ich natürlich wieder mal keine Ahnung, welche PINs ich an SDA und SCL vom 1x 1602 Blue I2C IIC an den NANO anschließen muss...
Durch das "Unhandled sysex command" habe ich auch keine Übersicht in fhem.

Gruß Jens
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

JensS

#11
Mittlerweile läuft der NANO mit dem ENC28J60 über ConfigurableFirmate stabil.
I2C-LCD, Digital-In- & Out (4er Relais) sowie Analog-In schlagen mit 24.892 Bytes zu Buche.
Den OneWire-AD-Wandler muss ich wohl über I2C ansprechen, da OneWire und I2C auf meinem NANO nicht zusammen funktionieren.
Gruß Jens

EDIT:
Jetzt konnte ich den DS2482 probieren und habe dazu im Sketch die Kommentare vor DS2482 entfernt. Leider klappt das nicht, wie erhofft. Der Nano lässt sich nicht anpingen. Ob ein Wechsel des Shields auf W5100 was bringt? Derzeit sind 27.908 Bytes belegt.
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

ntruchsess

Zitat von: dirigent am 10 Januar 2015, 22:55:50
Jetzt konnte ich den DS2482 probieren und habe dazu im Sketch die Kommentare vor DS2482 entfernt. Leider klappt das nicht, wie erhofft. Der Nano lässt sich nicht anpingen. Ob ein Wechsel des Shields auf W5100 was bringt? Derzeit sind 27.908 Bytes belegt.

Wenn die DS2482-unterstützung aktiviert ist, muss die andere OneWire-lib auskommentiert sein. Die I2C-lib der Firmata muss auch dringend mal überarbeitet werden, die braucht mit Ihren Fehlermeldungsstrings zu viel Speicher.... Aber der größte Teil des Speichers geht sicher für die ENC28J60 Unterstützung drauf. Der Speicherverbrauch der UIPEthernet-lib läßt sich über die uipethernet-conf.h beeinflussen - per Default ist dort UDP an (wird für DHCP und DNS gebraucht) und es wird Speicher für 4 parallele TCP-Verbindungen (mit einem Puffer von Packeten) alloziert (auch wenn vom Sketch nur max. eine Verbindung gleichzeitig benutzt wird). -> UIP_CONF_UDP auf 0, UIP_CONF_MAX_CONNECTIONS auf 1, ggf. noch UIP_SOCKET_NUMPACKETS verkleinern bringt einiges an RAM. Was noch stabil läuft muss man natürlich selber testen.

Ansonsten bringt ein Wechsel auf ein WIZ5100 natürlich am meisten Speicher - da arbeitet die TCP-logik in Hardware, die Ethernet-lib ist nur ein sehr schlanker Wrapper drum.

- Norbert
while (!asleep()) {sheep++};

JensS

#13
Danke Norbert,

die OneWire-lib war bereits auskommentiert und UDP aus. UIP_CONF_MAX_CONNECTIONS auf 1 und UIP_SOCKET_NUMPACKETS verkleinern hat leider auch nicht gereicht. Sobald das mini-WIZ5100 seine weite Reise zu mir geschafft hat, gebe ich eine Statusmeldung. In der aktuellen Konfiguration mit I2C, digital On & Out sowie analog In bzw. ohne DS2482, OneWire, Stepper, Scheduler, Encoder läuft der Nano stabil mit Firmata.begin(19200).

Gruß Jens

Nachtrag:
Aus purer Neugier habe ich den DS2482 als I2C-EEPROM definiert und es sieht so aus, als könne man ihn ansprechen.
Ist es evtl. möglich die Befehlsfolgen zum Konfigurieren bzw. Abfragen des DS2482 über diesen Umweg zu erledigen und somit den Speicher des Arduino zu schonen? Momentan hängt ein DS18S20 dran.
Debian auf APU2C4, HM-CFG-USB2, SIGNALduino, HM-ES-PMSw1-Pl, TFA 30.3121, TFA 30.3125, ITS-150, PIR-5000, configurable Firmata USB & LAN, 1-wire: DS-18B20, DS-18S20, DS-2408, DS-2413, diverse I2C-Komponenten, zigbee2mqtt, ESPEasy etc.

cs-online

Hi Jens,

hast Du inzwischen ENC28J60 + Arduino NANO + Firmata  ans laufen bekommen ? Ich suche nämlich auch eine Möglichkeit, über LAN analoge und digitale Eingänge ins FHEM zu bekommen. Welches Ethernet-Shield hast Du da bei Ebay bestellt ?

Grüße

Christian
FHEM auf RPI 4 4GB, HM-WLAN-Gateway, einige HM-Aktoren,2x EBUSD an Heizung+Solar, ESP8266 am Strom-,Gas-,Wasserzähler, in WLAN-Steckdosen und Relaisleisten, Sonoff S20, Shelly1,2 und 2.5,Lacrosse-Gateway und Sensoren,Sduino,Alexa-Fhem,Huawei PV mit Speicher, alles auf einem RPI und da geht noch mehr