@Yveaux said:
@xefil does this Ethernet shield also have an SD card slot? If so, it shares the spi bus with the rfm.
You should make sure the SD card chip-select line is high, before the mysensors library is initialized (implement the pin initialization in the before()-method). Otherwise the SD card communication will interfere with the rfm communication.
Yes, it has a SD card module as well.
How to disable it?
I've tried it so:
void before() {
// disable SD card
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
}
Actually I get simply this:
0;255;3;0;9;Starting gateway (RRNGA-, 2.0.0)
0;255;3;0;9;TSM:INIT
0;255;3;0;9;!TSM:RADIO:FAIL
0;255;3;0;9;!TSM:FAILURE
0;255;3;0;9;TSM:PDT
And what is that for? Does it help?
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
//#define MY_W5100_SPI_EN 4
Thanks!
Simon
This is the whole code again I'm using now:
#include <SPI.h>
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enables and select radio type (if attached)
//#define MY_RADIO_NRF24
#define MY_RADIO_RFM69
#define MY_GATEWAY_MQTT_CLIENT
// Set this nodes subscripe and publish topic prefix
#define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway2-out"
#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway2-in"
// Set MQTT client id
#define MY_MQTT_CLIENT_ID "mysensors-2"
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
//#define MY_W5100_SPI_EN 4
// Enable Soft SPI for NRF radio (note different radio wiring is required)
// The W5100 ethernet module seems to have a hard time co-operate with
// radio on the same spi bus.
#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
#define MY_SOFTSPI
#define MY_SOFT_SPI_SCK_PIN 14
#define MY_SOFT_SPI_MISO_PIN 16
#define MY_SOFT_SPI_MOSI_PIN 15
#endif
// When W5100 is connected we have to move CE/CSN pins for NRF radio
#define MY_RF24_CE_PIN 5
#define MY_RF24_CS_PIN 6
// Enable these if your MQTT broker requires usenrame/password
//#define MY_MQTT_USER "username"
//#define MY_MQTT_PASSWORD "password"
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
#define MY_IP_ADDRESS 192,168,1,52
// If using static ip you need to define Gateway and Subnet address as well
#define MY_IP_GATEWAY_ADDRESS 192,168,1,1
#define MY_IP_SUBNET_ADDRESS 255,255,255,0
// MQTT broker ip address.
#define MY_CONTROLLER_IP_ADDRESS 192,168,1,50
// The MQTT broker port to to open
#define MY_PORT 1883
/*
// Flash leds on rx/tx/err
#define MY_LEDS_BLINKING_FEATURE
// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300
// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
#define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
#define MY_INCLUSION_MODE_BUTTON_PIN 3
// Uncomment to override default HW configurations
//#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED
*/
#include <Ethernet.h>
#include <MySensors.h>
void before() {
// disable SD card
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
}
void setup() {
}
void presentation() {
// Present locally attached sensors here
}
void loop() {
// Send locally attech sensors data here
}