LORA
JChris
Posts: 58
in Propeller 1
Hi,
I use a propeller C3 with a mdot of multitech. I use Rx and Tx pin for the communication.
The mdot's settings is attached (mdot's settings)
My code is the following :
In the first time, I don't understand why I not receive the first character of my response and sometimes the first two characters (three image that is attached (first, second and third part)) .
If anyone has a hint, I would appreciate
I use a propeller C3 with a mdot of multitech. I use Rx and Tx pin for the communication.
The mdot's settings is attached (mdot's settings)
My code is the following :
CON '////////////////////////////////////////////////////////////////////////////// ' PROP CHIP / SYSTEM DEFINES ////////////////////////////////////////////////// '////////////////////////////////////////////////////////////////////////////// ' These settings are for 5 MHZ XTALS _clkmode = xtal1 + pll16x ' enable external clock and pll times 16 _xinfreq = 5_000_000 ' set frequency to 5 MHZ rxPin = 0 txPin = 2 mode = %0000 baudrate = 9600 relaiRouge = 3 relaiJaune = 1 Temps_attente = 3000 VAR byte char, char1, ptr, ptr1, ptr2, AT_Reponse[200], AT_Reponse1[200], RSSI[200], SNR[200], nombre_recu long data1, data2, data3 OBJ pst : "Parallax Serial Terminal" LORA : "FullDuplexserial" PUB main pst.Start(115200) LORA.Start(rxPin, txPin, mode, baudrate) data1 := 200 data2 := 1200 data3 := 2200 dira[relaiRouge] := 1 dira[relaiJaune] := 1 outa[relaiRouge] := 0 outa[relaiJaune] := 0 waitcnt(clkfreq*2+cnt) pst.str(String("launching: ",9)) LORA.str(String("at",13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at command: ",9)) pst.str(@AT_Reponse) pst.Str(String(13)) waitcnt(clkfreq+cnt) LORA.str(String("at&v",13)) repeat 49 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at&v command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) waitcnt(clkfreq+cnt) LORA.str(String("at+fsb=0",13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+fsb command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) waitcnt(clkfreq+cnt) LORA.str(String("at+ni=1,conduit123",13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+ni command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) waitcnt(clkfreq+cnt) LORA.str(String("at+nk=1,conduit123",13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+nk command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) waitcnt(clkfreq+cnt) LORA.str(String("at+join",13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+join command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) waitcnt(clkfreq+cnt) repeat repeat 5 LORA.Str(String("at+send=")) LORA.Dec(data1) LORA.Str(String("&RSSI=")) LORA.Dec(data2) LORA.Str(String("&SNR=")) LORA.Dec(data3) LORA.Str(String(13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+send command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) outa[relaiJaune] := 0 outa[relaiRouge] := 0 if (data1 > 1000) outa[relaiJaune] := 1 if (data1 > 2000) outa[relaiRouge] :=1 repeat 5 LORA.Str(String("at+send=")) LORA.Dec(data2) LORA.Str(String(13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+send command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) outa[relaiJaune] := 0 outa[relaiRouge] := 0 if (data2 > 1000) outa[relaiJaune] := 1 if (data2 > 2000) outa[relaiRouge] :=1 repeat 5 LORA.Str(String("at+send=")) LORA.Dec(data3) LORA.Str(String(13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+send command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) outa[relaiJaune] := 0 outa[relaiRouge] := 0 if (data3 > 1000) outa[relaiJaune] := 1 if (data3 > 2000) outa[relaiRouge] :=1 repeat 5 LORA.Str(String("at+send=")) LORA.Dec(data2) LORA.Str(String(13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+send command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) outa[relaiJaune] := 0 outa[relaiRouge] := 0 if (data2 > 1000) outa[relaiJaune] := 1 if (data2 > 2000) outa[relaiRouge] :=1 repeat 5 LORA.Str(String("at+send=")) LORA.Dec(data1) LORA.Str(String(13)) repeat 3 Rx(Temps_attente) pst.Str(String(13)) pst.str(String("at+send command: ",9)) pst.Str(@AT_Reponse) pst.Str(String(13)) outa[relaiJaune] := 0 outa[relaiRouge] := 0 if (data1 > 1000) outa[relaiJaune] := 1 if (data1 > 2000) outa[relaiRouge] :=1 ' waitcnt(clkfreq+cnt) PUB Rx(timeout) Rx_LORA(timeout) Pub Rx_LORA(timeout) ptr := 0 if (nombre_recu == 0 OR nombre_recu == 2) LORA.RxFlush repeat char := LORA.Rx AT_Reponse[ptr++] := Char while (char <> 13) AT_Reponse[--ptr] := 0 elseif (nombre_recu ==1) LORA.RxFlush repeat char := LORA.Rx AT_Reponse1[ptr++] := Char while (char <> 13) AT_Reponse1[--ptr] := 0 else abort
In the first time, I don't understand why I not receive the first character of my response and sometimes the first two characters (three image that is attached (first, second and third part)) .
If anyone has a hint, I would appreciate
Comments
I was think about trying out these appcon LORA modules http://www.appcon.com.cn/en/product.php