KrisKasprzak / EBYTE

Libraries to program and use UART-based EBYTE wireless data transceivers
239 stars 75 forks source link

E32 900T30D won't switch out of channel 0 #49

Closed dopplet closed 2 years ago

dopplet commented 2 years ago

I'll start with, it used to work and the channel would change properly, but as I've been fiddling with things for reasons I can't understand I've now got stuck on Channel 0 (862Mhz) where I want to use channel 41 (903MHz).

ESP32 all wiring is correct, module responds, other parameters are sent and I have equipment that can measure output so I know I've been able to change the output power from 21dbm to 30dbm, so I know there is communication with the module. Code on the PrintParameters shows the settings I have set. I have tried adjusting PIN_RECOVER to 250mS with no effect. I also note my modules return 0 for model but valid data for the other pieces.

Message is being sent, using sdr module I can see the transmission on 862 MHz (looked at first on 903MHz not found).

Lastly, I have 3 of these modules, they are all currently behaving identically when I swap them out on the perfboard.

Any pointers very welcome, thank you.

Current send code: '''

ifndef LED_BUILTIN

define LED_BUILTIN 13

endif

include "EBYTE.h"

define PIN_RX 16

define PIN_TX 17

define PIN_M0 4

define PIN_M1 21

define PIN_AX 23

struct DATA { unsigned long Count; int Bits; float Volts; float Amps; };

DATA MyData;

EBYTE Transceiver(&Serial2, PIN_M0, PIN_M1, PIN_AX);

void setup() { Serial.begin(9600); Serial2.begin(9600); Serial.println("Starting Reader"); Transceiver.init(); Transceiver.SetAddressH(1); Transceiver.SetAddressL(1); Transceiver.SetOptions(0b11000100); Transceiver.SetSpeed(0b00011010); Transceiver.SetChannel(41); Transceiver.SaveParameters(TEMPORARY); Transceiver.PrintParameters(); pinMode(LED_BUILTIN, OUTPUT); }

void loop() { digitalWrite(LED_BUILTIN, HIGH); MyData.Count++; MyData.Bits = analogRead(A0); MyData.Volts = MyData.Bits * ( 5.0 / 1024.0 ); Transceiver.SendStruct(&MyData, sizeof(MyData)); Serial.print("Sending: "); Serial.println(MyData.Count); digitalWrite(LED_BUILTIN, LOW); delay(1000); } '''

dopplet commented 2 years ago

Resolved, maybe i got transparent mode backwards or something, but when I sent addrh/addl/chan as the first 3 bytes of the payload it went to the channel I expected. Swapping transparent mode then also has it working on the fixed channel I expected. So user error.