Author Topic: Connection Problem  (Read 887 times)

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Connection Problem
« Reply #15 on: July 20, 2016, 03:35:24 pm »
Glad to hear it Nick_W. Keep the problems coming and we will do our best to keep up with fixing it.

We have added a sanity check for the script which consists of the device being able to successfully run for 10 minutes before something so awfully bad happens that it can only reboot to recover. If it cannot run for 10 minutes, it will invalidate the script before it reboots. This will give you at least 10 minutes to connect to the device which should be plenty of time.

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: Connection Problem
« Reply #16 on: July 20, 2016, 03:46:01 pm »
New (or maybe not) weird thing, don't know if this is related:

Now reporting via MQTT, it looks like the data is cached somewhere. I'm reporting uptime, battery voltage and temperature every minute, in 3 topics.

What happens is that the green LED flashes (indicating a report) every minute, but in MQTT, the values are published every 2 minutes, but for both reports - ie flash - no report, minute later flash - two reports (uptime shows correctly, which is why it looks like it's being cached).

see the output of my MQTT monitor below:

Code: [Select]
MCThings/70082/Uptime 600
MCThings/70082/BatteryVoltage 2907
MCThings/70082/Temperature 25.125000
MCThings/70082/Uptime 660
MCThings/70082/BatteryVoltage 2907
MCThings/70082/Temperature 25.062500
MCThings/70076/Uptime 480
MCThings/70076/BatteryVoltage 2875
MCThings/70076/Temperature 25.250000
MCThings/70076/Uptime 540
MCThings/70076/BatteryVoltage 2875
MCThings/70076/Temperature 25.187500
MCThings/70082/Uptime 720
MCThings/70082/BatteryVoltage 2907
MCThings/70082/Temperature 25.062500
MCThings/70082/Uptime 780
MCThings/70082/BatteryVoltage 2907
MCThings/70082/Temperature 25.000000
MCThings/70076/Uptime 600
MCThings/70076/BatteryVoltage 2875
MCThings/70076/Temperature 25.062500
MCThings/70076/Uptime 660
MCThings/70076/BatteryVoltage 2875
MCThings/70076/Temperature 25.000000
MCThings/70082/Uptime 840
MCThings/70082/BatteryVoltage 2907
MCThings/70082/Temperature 25.000000
MCThings/70082/Uptime 900
MCThings/70082/BatteryVoltage 2907
MCThings/70082/Temperature 25.000000
MCThings/70076/Uptime 720
MCThings/70076/BatteryVoltage 2875
MCThings/70076/Temperature 24.937500
MCThings/70076/Uptime 780
MCThings/70076/BatteryVoltage 2875
MCThings/70076/Temperature 24.937500

This is from two modules, one was the bricked one (now alive!). If you look at the report from module 70076 the last two reports (uptime 720 and 780) arrive at the same time  - but the uptime is 60 second apart, and the dual reports arrive at 2 minute intervals (event is set for 1 minute, and LED flash shows every minute).

Could the gateway be caching these? where would they be cached if they in fact are?

Any ideas?

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Connection Problem
« Reply #17 on: July 20, 2016, 04:47:32 pm »
The module attempts to connect to the gateway when you send a message but for a variety of reasons, the connection can be missed and then on the next connection interval it sends the messages that were queued up on the module. I saw the same behavior, it is suspect that it is somewhat repeatable to once every 2 minutes so we are investigating this.

helge

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Connection Problem
« Reply #18 on: July 21, 2016, 06:38:30 am »
the new firmware didn't solve my issue. the module boots normally, red led blinks once then only one beacon is received and then it locks up. I have access to a nRF51 DK if that would be helpful.

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Connection Problem
« Reply #19 on: July 21, 2016, 11:02:36 am »
Could you provide me the code that you ran? I can see why it would do this.

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Connection Problem
« Reply #20 on: July 26, 2016, 10:59:45 am »
@helge
I looked over you code. I can't 100% test it since I don't have your device. However, I was wondering where you got the 0x1D slave address from? I don't see 0x1D as an option in the table in TSL2561 datasheet which I have attached here. Unless I am looking at the wrong table.

If this is the case, you will have a run-time error as you try to read data that never came back from the device. Did you ever try this in debug mode? You should have gotten a pop up that told you that.


helge

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Connection Problem
« Reply #21 on: July 26, 2016, 11:27:10 am »
@mc-Abe

well the lockup occurs even if the i2c device is not connected any more. the module blinks red once and thats it. no beacon is sent. It's still possible to OTA flash it with the updater. can you please pm me the hex file to re-flash the mc-Module with nrfjprog?

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Connection Problem
« Reply #22 on: July 26, 2016, 05:02:38 pm »
The symptoms are consistent with what I described earlier. The run-time error exists even if you don't have a device connected. You try to read from the device and then index into an empty list object which causes a run-time error. When the device is not in debug mode and encounters a run-time error, it goes into debug mode. There is nothing it can do to recover so it sits there and waits for you to connect to it. This is why you do not see any more beacons. Beacons are not set in debug mode.

Just to note, I believe there was an issue with the mc-Gateway Host Processor and that is why you could not connect to your device. I just uploaded a new version that you should try. I have replicated your exact problem and I can connect to my device with mc-Studio and reprogram it.

Unfortunately I cannot give you the hex file for the module. In the near future we will have the ability to erase the script through the mc-OTA.

let me know if this fixes your problem.

helge

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Connection Problem
« Reply #23 on: August 04, 2016, 11:15:18 am »
@mc-Abe

1) no, the connection to the module is still not working. In the meantime another module is also dead. OTA updates are still possible.
2) why does my code work within the ButtonPressed Event and bricked the mc-module in the Boot Event? Doesn't make sense.
3) hex file: read my in mc-Product General section here, which is still waiting for an official response here

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Connection Problem
« Reply #24 on: August 04, 2016, 01:21:12 pm »
1) Are you running v0.7-406 of the Gateway Host Processor? This will show up under LplanVersion in the Device dialogue in mcStudio. I tested this again and I am able to connect to the device running your code. Modified to Boot instead of on button pressed.

2) As I described, you have a run-time exception. The run-time exception causes the device to stop executing code and enter debug mode, waiting for a connection. When the code is in Boot, it runs immediately when device boots. But in button press it waits until you press the button, after you press the button the exception happens and the device stops executing code.

3) As I said earlier, Unfortunately I cannot share the hex with you. There is an OTA Updater release imminent that will allow you to erase the script.