Ashu Joshi
Forum Replies Created
-
AuthorPosts
-
Ashu JoshiParticipant
Mike – I can send you the GPS code that I used – basically copied it from an example for SerialGPS with the Grove Kit. However the reason why there is NO code is because my serial console and also my transmit loop was either hanging or getting locked up. As mentioned before – I started removing code to find out what the issue was. The same code works and GPS module reports when I do NOT have libmdot (and mbed-rtos) in the project. In the source I sent you – to get it to hang – just UNCOMMENT the line that is declaring or rather assigning/initializing the GPS:
SerialGPS gps(PA_2, PA_3);
I am not sure what is going on – would PA_2/PA_3 conflict with something else?
Ashu JoshiParticipantMike – I have posted the code base on mBed: https://developer.mbed.org/users/AshuJoshi/code/SensorInterface/
Note that this does NOT have of the actual GPS processing code because as from my earlier inputs – the mere inclusion & declaration causes this problem – so I did NOT move the over the code for actual GPS processing from another project where there is no libmdot, and hence I did not need mbed-rtos.
I have the deep sleep example also in there but it has problems that I have asked in another thread.
Ashu JoshiParticipantAny thoughts on how to resolve the issue with mbed-rtos and SerialGPS?
Ashu JoshiParticipantI am trying to save the configuration, check it and if it is already set NOT do it all over again. However I am using the network name to check the config setting and cannot get it to work. Please note that the current code is able to join the network, send data and all that good stuff. Now I am trying to save the Configuration, and trying to prevent going through that when coming out of deep sleep.
Here are the details:
1. This is the string I am using to program the network name:
static std::string config_network_name = "MDOTLORANET";
2. Right at the beginning of the main – I call a function mDotConfig() – this first checks if the config is valid, if not then it will go to setup the config.
Here is the code in it (dot is a global):// get a mDot handle dot = mDot::getInstance(); //dot->setLogLevel(mts::MTSLog::INFO_LEVEL); dot->setLogLevel(mts::MTSLog::TRACE_LEVEL); // Test if we've already saved the config logInfo("Checking Config"); std::string configNetworkName = dot->getNetworkName(); printf("Network Name is %s: \n", (char*)(configNetworkName.c_str())); printf("Name being programmed is %s: \n", (char*)(config_network_name.c_str())); if (configNetworkName.compare(config_network_name) != 0) { logInfo("Setting Up Config"); setupNetwork(); } else { logInfo("Config is good, skipping setting up... "); }
My C/C++ skills are really rusty – so quite possible that I am making a mistake BUT here is what I am observing even before I do the string compare:
#1 – before I printf statement – the statement reading the Network Name takes good bit of time – I think a couple of seconds at least or may be more. Not sure what is going on.
#2. It always turns up blank. The string config_network_name prints fine.
Any idea on what may be going on?
Ashu JoshiParticipantThe short version of what happens is that at the beginning of the program before I go in a loop to read the BME280 sensor – I print out to the console the config values of mDot. This printing is erratic – sometimes it prints only 20% of the config, sometimes it gets stuck on the first line, sometimes it makes it almost to the first sensor output BUT it basically freezes – that is no more console output.
I suspect though that the system is up because I have the LED blink at the beginning and I can see the LED still blinking.
Including the header file of course does not do anything – its only when I declare the pins:
SerialGPS gps(PA_2, PA_3);
Ashu JoshiParticipantMike,
I am glad you asked that question because yes there is another difference – I have mbed-rtos as well along with mDot. I had to include it because mDot needs rtos.h.
So this is another difference between the two code bases…
Ashu
Ashu JoshiParticipantOriginally yes but it has been modified…. I have the following now:
void endLessTestLoop() {
while(true) {
// printf(“Hello world!\r\n”);
printf(“BME280 Sensor: \n”);
readandprintBME280();mDotGotoDeepSleep(60);
}
}The LED Blink was setup before I call this function – endLessTestLoop.
Ashu JoshiParticipantTo add to the above – in both cases – the LED keeps blinking (I had borrowed the routine from mDotHelloWorld to blink the LED (LED1) – and in both case deep sleep with false or implied true – the LED keeps blinking so trying to figure out what is going on. If the mDot CPU is going to sleep then it should stop the LED blinking?
Ashu JoshiParticipantI am observing a debug output problem with SerialGPS. However I think I have narrowed it down to a combination of presence of mDot.h and SerialGPS.h – still NOT able to figure out the place of conflict but I have two starter programs – both of them do NOT interface to the LoRa radio. Both of them have code included for the Grove GPS – and I am using hte SerialGPS library. On the program that does NOT include the mDot.h – the program works fine and I am able to print the values of the GPS. However on the other program where I am setting up the mDot as well with mDot.h included in the program – the Serial output goes for a toss or locks up.
Any idea on what may be going on?
Ashu JoshiParticipantBryan:
I have an endless while loop that I enter after setting up the mDot. To understand the platform better – I removed all Tx to the Conduit – that is I am using it just as a microcontroller platform – reading a sensor and printing it out.
I tried both:
dot->sleep(sleep_time, mDot::RTC_ALARM, false);
dot->sleep(sleep_time, mDot::RTC_ALARM);When I use the statement same as in the example – then the execution begins as if the system is restarting – where as False does not put it in deep sleep and my execution starts with the next statement in the While Loop BUT if I use the deep sleep mode – that is not have the false then it restarts.
My question is – what is the difference in power saving between the two modes? Is it significant?
Ashu JoshiParticipantRico – thanks for the response – I should have closed this topic. My problem wasn’t the type of printf – but more basic. The Serial Port by default is set @ 9600 baud and I had to set it at that to get it working!
Ashu JoshiParticipantThanks a ton … clear. Now I understand where the ports were configured – rather it makes sense now because the lora-network-server has to be listening on the same ports 🙂
Ashu JoshiParticipantI made another interesting observation with respect to my last issue which I am observing. I have been looking at the ports very carefully. It turns out that the basic_pkt_forwarder is not picking up the UDP ports from either global or local conf json files. I do know the files are working because it is correctly picking up the Gateway ID from the loca conf json file. Right now the UDP upstream port is 1780 and downstream to 1782.My bad – was looking/editing the wrong conf file directory…
- This reply was modified 8 years, 5 months ago by Ashu Joshi.
Ashu JoshiParticipantWhile I think I get the difference between the lora-network-server and the pkt-forwarder – I am trying to dig deeper and understand it well. I had built a program that works well – it reads temperature and light sensor and is successful in sending it to the Gateway – see here: https://developer.mbed.org/users/AshuJoshi/code/mDot_LoRa_Connect_Example_GroveSensorTem/. It is basically an extension of the LoRa Connect Example published by Multitech.
I had set up a remote MQTT Broker and the Conduit is able to publish to the remote broker (the remote broker is mosquitto running on my Mac – and the Mac is on the same network as the Conduit).
What I tried doing was to go to the lora-network-server script in /etc/init.d and commented out running the pkt-forwarded – when I do that the above mentioned setup stops working.
So my two-fold question – is there a good explanation somewhere of what each do especially a visual kind of diagram? This gateway was previously setup to use with TTN but I went through all conf files to see if there is some setting that may collide or conflict. So is there description or details for how lora-network-server works? And has MT made it open source?
Ashu JoshiParticipantJason love,love your answer. I actually tried it – because I saw the option in Advanced LoRa Configuration to set the MQTT Host and Port! You may like the story 🙂
I am beginning to understand this much better. The first baby step I had taken was to run the SUB client on Mac on the same local network as the GW. That works like charm – of course it has to.
Then I made the STUPID mistake of using the IP address of the MT GW as the Host Address yesterday – not because I did not know what I was doing BUT simply because I was using the IP Address of the MT GW constantly to do SSH and it was on my mind.
When I read your response, I corrected it – and VOILA it is indeed working 🙂
Ashu JoshiParticipantJason – can I use a remote broker – by changing the LoRa-network- conf file – by specifying the host and port?
Ashu JoshiParticipantJason – for the Binary Format you use for EVB – do you have a code sample that I could re-use? I am trying to read a Temp & Light sensor and send that to the Gateway.
Here is a binary format we use for the EVB:
I tried going through the EVB FW code on mBed but it wasn’t obvious where and how you are packing the sensor data?
Ashu JoshiParticipantThanks – that did the trick!!!!
Ashu JoshiParticipantHi Mike – thanks – that did the trick. However I do have a confusion. I am using the standard firmware – 1.0.8 – and I can issue commands over the DB-9. What I am puzzled is that I do not see any messages that are being sent by using “logInfo” from a program (like the mDot_helloworld sample on mBed). Also I notice that according to the Multiconnect mDot MTDOT Developer Guide (s000612_2_0_7.pdf) – page 44 – the micro USB should expose two USB ports. I only see one…
Ashu JoshiParticipantDave – take a look at this question: http://www.multitech.net/developer/forums/topic/encryption/
The data is encoded in Base 64.
Ashu JoshiParticipantJason – thanks – that did it – worked like a charm – upgrading the lora-network-server. Thanks!
Ashu JoshiParticipantSteve: I tried running from the command line as you suggested, I have copied the output. Important to note that this combination was previously working with the TTN so it had the Packetforwarder setup. I changed it back for normal network server
root@mtcdt:/opt/lora# ./lora-network-server -c /var/config/lora/lora-network-server.conf
Logger Level Changed to 30
11:12:48:131|INFO|LoRa Network Server started, version 0.0.9.2
11:12:48:135|WARNING|Setting for beacon interval not found. Beacon is disabled.
11:12:48:140|INFO|Network Server Config ———————
{
“addressRange” : {
“end” : “FF:FF:FF:FE”,
“start” : “00:00:00:01”
},
“log” : {
“console” : true,
“level” : 30,
“path” : “/var/log/lora-network-server.log”,
“syslog” : true
},
“lora” : {
“adr” : {
“868” : {
“DR0” : -190,
“DR1” : -170,
“DR2” : -145,
“DR3” : -105,
“DR4” : -80,
“DR5” : -50,
“DR6” : 100,
“DR7” : 0
},
“915” : {
“DR0” : -150,
“DR1” : -100,
“DR2” : -60,
“DR3” : -30,
“DR4” : 100
}
},
“beaconDelay” : 0,
“beaconInterval” : 0,
“beaconPower” : 27,
“frequencyBand” : “915”,
“frequencyEU” : 867500000,
“frequencySubBand” : 7,
“joinByteOrder” : “LSB”,
“maxTxPower” : 14,
“netID” : “010203”,
“rx1DatarateOffset” : 0,
“rx2Datarate” : 12
},
“mqtt” : {
“enabled” : true
},
“network” : {
“eui” : “9af29bdff1fe1607”,
“key” : “c9b5542db56ea0dd847ba4a6ecfa0e5c”,
“leasetime” : 1440,
“name” : “ashujatl”,
“passphrase” : “ashujatl”,
“public” : true
},
“test” : {
“disableRxWindow1” : false,
“disableRxWindow2” : false
},
“udp” : {
“appPortDown” : 1786,
“appPortUp” : 1784,
“downstreamPort” : 1782,
“upstreamPort” : 1780
}
}11:12:48:143|INFO|——————————————-
11:12:48:144|INFO|Failed to open database [/var/config/lora/lora-net-server.db].
11:12:48:150|INFO|DB loading…
11:12:48:159|ERROR|SQL error: [no such table: schema] on first call
11:12:48:161|INFO|Database version: 0
11:12:48:163|INFO|Latest version: 5
11:12:48:165|WARNING|Creating database
11:12:48:236|INFO|Network settings not found in database, setting to current settings
11:12:48:303|INFO|Beacon is disabled
11:13:18:301|ERROR|Packet forwarder not seen in 30 s
11:13:48:301|ERROR|Packet forwarder not seen in 60 sAshu JoshiParticipantJason:
I have tried both ways:
1. Private – by setting network[“public”] to false and AT+PN=0
2. Public – by setting network[“public”] to true and AT+PN=1The results below are with public
Results of AT&V:
AT&V
Device ID:..00:80:00:00:00:00:ae:db
Frequency Band:..FB_915
Frequency Sub Band:.7
Public Network:..on
Start Up Mode:..COMMAND
Network Address:.00000000
Network ID:..9a:f2:9b:df:f1:fe:16:07
Network ID Passphrase:.ashujatl
Network Key:..c9.b5.54.2d.b5.6e.a0.dd.84.7b.a4.a6.ec.fa.0e.5c
Network Key Passphrase:.ashujatl
Network Session Key:.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00
Data Session Key:.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00
Network Join Mode:.OTA
Network Join Retries:.2
Preserve Session:.off
Join Byte Order:.LSB
Join Delay:..5
App Port:..1
Link Check Threshold:.off
Link Check Count:.off
Error Correction:.1 bytes
ACK Retries:..off
Packet Repeat:..1
Encryption:..on
CRC:…on
Adaptive Data Rate:.off
Command Echo:..on
Verbose Response:.off
Tx Frequency:..0
Tx Data Rate:..DR0 – SF10BW125
Tx Power:..11
Tx Antenna Gain:.3
Tx Wait:..on
Tx Inverted Signal:.off
Rx Delay:..1 s
Rx Inverted Signal:.on
Rx Output Style:.HEXADECIMAL
Debug Baud Rate:.115200
Serial Baud Rate:.115200
Serial Flow Control:.off
Serial Clear On Error:.on
Wake Mode:..INTERVAL
Wake Interval:..10 s
Wake Delay:..100 ms
Wake Timeout:..20 ms
Wake Pin:..DI8
Log Level:..6CONTENTS of Lora.Conf:
{
“lora”: {
“netID”: “010203”, /* netID for beacon packets */
“frequencyBand”: “915”, /* US=”915″, EU=”868″ */
“frequencySubBand”: 7, /* Sub-band for US operation, 1-8 */
“rx1DatarateOffset”: 0, /* Datarate offset for mote rx window 1 sent in join response (0-3) */
“rx2Datarate”: 12, /* Datarate for mote rx window 2 sent in join response (7-12) */
“maxTxPower”: 14, /* Max Tx power (dBm), -6 to 26 */
“frequencyEU”: 867500000 /* center freq for extra EU channels (Hz) */
},
“udp”: {
“appPortUp”: 1784, /* port for user-developed application use */
“appPortDown”: 1786 /* port for user-developed application use */
},
“addressRange”: {
“start”: “00:00:00:01”, /* address range used for mDots */
“end”: “FF:FF:FF:FE”
},
“network”: {
“public”: true, /* set to false for private LoRa network with mDots + Conduit */
“leasetime”: 1440, /* time until mDot join expires (minutes) */
“name”: “ashujatl”, /* configure network security */
“passphrase”: “ashujatl”
},
“log” : {
“console” : true,
“syslog” : true,
“level” : 30, /* error=10, warn=20, info=30, debug=50, trace=60, max=100 */
“path”: “/var/log/lora-network-server.log”
},
“mqtt”: {
“enabled”: true
}
}Ashu JoshiParticipantSteve – here is the list of opkg:
root@mtcdt:/var/config/lora# opkg list | grep lora
lora-network-server – 0.0.9.2-r0.0
lora-packet-forwarder – 1.4.1-r8.16
lora-query – 0.0.1-r0.0
root@mtcdt:/var/config/lora#Ashu JoshiParticipantIs there a guide on how to send AT commands to the MDK? When I connect it to my Mac – two ports show up. For example – they showed up as usbmodem14121 and usbmodem14113. I can see the console output on the port 14113. I tried sending AT commands on 14121 but I don’t see any output.
-
AuthorPosts