gieemek / RFM69_softSPI

Arduino driver for RFM69 module using software SPI
2 stars 0 forks source link

Sending Data with SoftSPI #1

Open andy-meyer opened 7 years ago

andy-meyer commented 7 years ago

Hello,

I have implemented your lib to use RFM69 with Arduino MEGA. I will use your lib on this device because I will use this with Ethernet shield. All incoming Data will be OK, but when is send an Text, that will don’t be receive on the partner. When I change the lib to the standard lib of Felix and change the wiring to the hardware pins 50 – 53, all is fine.

My wiring is:

RFM69 <-> Arduino MEGA GND <-> GND 3,3 <-> 3,3V DIO0 <-> Pin2 SCK <-> Pin 14 MOSI <-> Pin 15 MISO <-> Pin 16 NSS <-> Pin 17

The Pin 2, 14, 15, 16, 17 are all connected with an level-shifter module.

Lib from Felix with this code: send works fine, receive works fine Lib from you with this code: send won`t work, receive works fine

So what`s wrong?

Here is the code:___

define NODEID 47

define NETWORKID 100 //the same on all nodes that talk to each other (range up to 255)

define GATEWAYID 1

define FREQUENCY RF69_868MHZ

define ENCRYPTKEY "unyu2x5b2rwx2nj4"

define IS_RFM69HW

include

include

include

unsigned long current_uptime, last_loop; int loop_time = 1000; //100 Millisekunden RFM69 radio; //---------------------------------------------------------------------------------------------------------- // SETUP //---------------------------------------------------------------------------------------------------------- void setup() { Serial.begin(9600); radio.initialize(FREQUENCY, NODEID, NETWORKID); radio.setHighPower(); //uncomment only for RFM69HW! radio.encrypt(ENCRYPTKEY); Serial.println(F("Setup finished T47->0.2")); } //---------------------------------------------------------------------------------------------------------- // LOOP //---------------------------------------------------------------------------------------------------------- void loop() { current_uptime = millis(); // RFM69 check permanently if (radio.receiveDone()) { Serial.println(F("receiveDone---------------------------------------------------")); Serial.print('['); Serial.print(radio.SENDERID, DEC); Serial.print("] "); for (byte i = 0; i < radio.DATALEN; i++) Serial.print((char)radio.DATA[i]); Serial.print(" [RX_RSSI:"); Serial.print(radio.RSSI); Serial.println("]"); } // Every sec.----------------------------------------------------------- if ((current_uptime > last_loop) || (last_loop > current_uptime && last_loop > 9999999999999)) { radio.send(255, "Hello", 6); last_loop = current_uptime + loop_time; } }

gieemek commented 7 years ago

Hi, sorry for my long delay, I had problem with my mail account.

I use arduino mega RFM69 and the Ethernet Shield as a MQTT gateway (MySensor version 1.5). I have not tested the transmission of text data from mega to other nodes, but I can control other nodes using the library and message types from the MySensor libraries. Communication works in both ways. I'm not sure if the MySensor library use the text types of command – I expect not. Can you send other types of messages (e.g. V_LIGHT) ?

One more thing: I understand that level-shifter module means double resistors (1 kOhm + 2.2 kOhm) to reduce power from 5 to 3 volts ? If yes you have to remember that this module should not be used with MISO line (from pin 16 at mega) and with DIO0 line (from pin 2 at mega) – I send you my diagram how to connect mega with RFM69 and ethernet shield.

I hope it could help. Grzegorz Miąsko

From: andy-meyer Sent: Tuesday, January 17, 2017 4:49 PM To: gieemek/RFM69_softSPI Cc: Subscribed Subject: [gieemek/RFM69_softSPI] Sending Data with SoftSPI (#1)

Hello,

I have implemented your lib to use RFM69 with Arduino MEGA. I will use your lib on this device because I will use this with Ethernet shield. All incoming Data will be OK, but when is send an Text, that will don’t be receive on the partner. When I change the lib to the standard lib of Felix and change the wiring to the hardware pins 50 – 53, all is fine.

My wiring is:

RFM69 <-> Arduino MEGA GND GND 3,3 3,3V DIO0 Pin2 SCK Pin 14 MOSI Pin 15 MISO Pin 16 NSS Pin 17

The Pin 2, 14, 15, 16, 17 are all connected with an level-shifter module.

Lib from Felix with this code: send works fine, receive works fine Lib from you with this code: send won`t work, receive works fine

So what`s wrong?

Here is the code:___

define NODEID 47

define NETWORKID 100 //the same on all nodes that talk to each other (range up to 255)

define GATEWAYID 1

define FREQUENCY RF69_868MHZ

define ENCRYPTKEY "unyu2x5b2rwx2nj4"

define IS_RFM69HW

include

include

include

unsigned long current_uptime, last_loop; int loop_time = 1000; //100 Millisekunden RFM69 radio; //---------------------------------------------------------------------------------------------------------- // SETUP //---------------------------------------------------------------------------------------------------------- void setup() { Serial.begin(9600); radio.initialize(FREQUENCY, NODEID, NETWORKID); radio.setHighPower(); //uncomment only for RFM69HW! radio.encrypt(ENCRYPTKEY); Serial.println(F("Setup finished T47->0.2")); } //---------------------------------------------------------------------------------------------------------- // LOOP //---------------------------------------------------------------------------------------------------------- void loop() { current_uptime = millis(); // RFM69 check permanently if (radio.receiveDone()) { Serial.println(F("receiveDone---------------------------------------------------")); Serial.print('['); Serial.print(radio.SENDERID, DEC); Serial.print("] "); for (byte i = 0; i < radio.DATALEN; i++) Serial.print((char)radio.DATA[i]); Serial.print(" [RX_RSSI:"); Serial.print(radio.RSSI); Serial.println("]"); } // Every sec.----------------------------------------------------------- if ((current_uptime > last_loop) || (last_loop > current_uptime && last_loop > 9999999999999)) { radio.send(255, "Hello", 6); last_loop = current_uptime + loop_time; } }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

andy-meyer commented 7 years ago

Hi, I have do the wiring on picture „RFM69_with_mega_connection-softSPI.jpg“ with MOSI to Pin 16. This looks like with Arduino and Ethernet shield with Soft SPI.

So what do you mean with “If yes you have to remember that this module should not be used with MISO line (from pin 16 at mega) and with DIO0 line (from pin 2 at mega)” ?

Sending “V_LIGHT” takes no different, it don`t work too. On level-shifter i mean this product: https://www.sparkfun.com/products/12009

Thanks, Andy

andy-meyer commented 7 years ago

Hi, I had actually only the mega2560 and the RFM69 module connected. The Ethernet shield is for finding the problem disconnected. I receive messages with D0 on RFM69 and mega2560 PIN2. When I disconnect the PIN2, no messages will be received. So I think the PIN2 is OK and not the Problem.

So I had change the wiring to Pins 40 – 43 and change the RFM69.h as follow:

RFM69 <-> Arduino MEGA GND <-> GND 3,3 <-> 3,3V DIO <-> Pin2 MISO <-> Pin 40 MOSI <-> Pin 41 SCK <-> Pin 42 NSS <-> Pin 43

Same problem, Messages will be received, but sending will not work. Regards, Andy

gieemek commented 7 years ago

Hello, I wanted to point out that the lines MOSI and D01 (16 and 2 pins) should not be joined to mega by resistors. But if do all the connections exactly as my diagram, the problem lies elsewhere. Unfortunately, I do not know where. Grzegorz Miąsko

From: andy-meyer Sent: Thursday, January 19, 2017 7:55 AM To: gieemek/RFM69_softSPI Cc: gieemek ; Comment Subject: Re: [gieemek/RFM69_softSPI] Sending Data with SoftSPI (#1)

Hi, I have do the wiring on picture „RFM69_with_mega_connection-softSPI.jpg“ with MOSI to Pin 16. This looks like with Arduino and Ethernet shield with Soft SPI.

So what do you mean with “If yes you have to remember that this module should not be used with MISO line (from pin 16 at mega) and with DIO0 line (from pin 2 at mega)” ?

Sending “V_LIGHT” takes no different, it don`t work too. On level-shifter i mean this product: https://www.sparkfun.com/products/12009

Thanks, Andy

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.