MYSController supports Sensebender Micro OTA FW updates


  • Admin

    Hi all, short update from MYSController:

    • Sensebender Micro OTA FW update is now supported

    Download here or via update button in MYSController.

    *** IMPORTANT: these instructions are only for sensebender boards or boards with the same hardware setup. For regular boards, use MYSBootloader.

    For OTA FW updates, use the dev branch (currently 1.5 b1) and uncomment
    #define MY_OTA_FIRMWARE_FEATURE
    in MyConfig.h

    MYSController will guess the board/bootloader combination based on available information during startup. If the recognition fails you can manually adjust the settings (see screenshot).

    Note: FW updates are handled in gw.process() or gw.wait().
    Battery-powered / sleeping nodes do not handle incoming commands by default - in order to handle FW updates, add gw.wait(100) after sending packages to the controller and select battery-powered / sleeping in the settings (see screenshot and supplemented SensebenderMicro.ino).

    MYSController_0_1_2_282.png

    Have fun πŸ™‚


  • Admin

    Great, thanks @tekka.


  • Hardware Contributor

    @Tekka: Hi thank you for great software.

    I am trying dev branch and would like to test new features like the new ota. But I don't understand what I am doing wrong. The sketch does not update. Here my config:

    • latest MYSController
    • gw with latest dev branch (no eeprom on it, I think it doesn't need it. Am I right?)
    • mini pro node with latest dev branch running humidity sketch.
    • on the node, I uploaded Dualoptiboot, but not on GW
    • on the node I have eeprom connected on SPI, D8 CSN but no pullups on it (maybe this is my problem, but I saw on some schemes that it is not always present, maybe I should try adding it).

    In the humidity sketch, I followed your recommandations, uncomment OTA-FEATURE and sleep. I added gw.process in main loop of course.

    Here some screenshots,
    On start-up:
    temp1.png
    Then Assign FW SenseblenderBlink, just to see what happens
    temp2.png
    I waited, in case, it require some time to transfer the sketches, but nothing more, it doesn't reset.
    So here screenshot, after reset:
    temp3.png
    In case the logs:

    30/07/2015 16:08:16	STARTUP	Initialize message logging
    30/07/2015 16:08:16	STARTUP	MYSController 0.1.2.282
    30/07/2015 16:08:16	STARTUP	FPC 2.6.4 / Lazarus 1.4.2
    30/07/2015 16:08:16	STARTUP	still under development :) tekka 2015
    30/07/2015 16:08:16	STARTUP	Load INI file...
    30/07/2015 16:08:16	STARTUP	INI version 0.1.2.282
    30/07/2015 16:08:16	INFO	*** Logging START ***
    30/07/2015 16:08:16	VERSION	MYSController 0.1.2.282
    30/07/2015 16:08:16	STARTUP	INI file loaded
    30/07/2015 16:08:16	STARTUP	Loading FW repository...
    30/07/2015 16:08:16	REPO	FW "Blink" loaded. t=10, v=1, blocks=72, crc=0xD098
    30/07/2015 16:08:16	REPO	FW "TimeReporter" loaded. t=20, v=1, blocks=840, crc=0x4AC5
    30/07/2015 16:08:16	REPO	FW "Sensebender Micro" loaded. t=100, v=1, blocks=1344, crc=0x3482
    30/07/2015 16:08:16	REPO	FW "Sensebender Blink" loaded. t=110, v=1, blocks=768, crc=0x1314
    30/07/2015 16:08:16	REPO	FW repository loaded. Items=4
    30/07/2015 16:08:16	STARTUP	Initialize message types
    30/07/2015 16:08:16	NODE	New node discovered, node id=0
    30/07/2015 16:08:16	NODE	New node discovered, node id=255
    30/07/2015 16:08:23	INFO	Flushing FIFO
    30/07/2015 16:08:23	INFO	Connected to COM7
    30/07/2015 16:08:24	CHILD	New child discovered, node id=0, child id=0
    30/07/2015 16:08:24	RX	0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    30/07/2015 16:08:24	RX	0;0;3;0;14;Gateway startup complete.
    30/07/2015 16:08:26	UPDATE	4295098650
    30/07/2015 16:08:29	RX	0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=0:1.5 b1
    30/07/2015 16:08:29	NODE	New node discovered, node id=10
    30/07/2015 16:08:29	CHILD	New child discovered, node id=10, child id=internal
    30/07/2015 16:08:29	DEBUG	Update child id=255, type=ARDUINO_NODE
    30/07/2015 16:08:29	RX	10;255;0;0;17;1.5 b1
    30/07/2015 16:08:29	RX	0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    30/07/2015 16:08:29	TX	10;255;3;0;6;M
    30/07/2015 16:08:29	RX	10;255;3;0;6;0
    30/07/2015 16:08:29	RX	0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=6,pt=0,l=1,sg=0,st=ok:M
    30/07/2015 16:08:31	RX	0;0;3;0;9;read: 10-10-0 s=255,c=4,t=0,pt=6,l=10,sg=0:FFFFFFFFFFFFFFFF
    30/07/2015 16:08:31	DEBUG	Undefined firmware/type for node=10
    30/07/2015 16:08:31	INFO	BL version=768
    30/07/2015 16:08:31	INFO	No FW assigned
    30/07/2015 16:08:31	RX	10;255;4;0;0;FFFFFFFFFFFFFFFF0300
    30/07/2015 16:08:31	RX	0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=8,sg=0:Humidity
    30/07/2015 16:08:31	RX	10;255;3;0;11;Humidity
    30/07/2015 16:08:31	RX	0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
    30/07/2015 16:08:31	RX	10;255;3;0;12;1.0
    30/07/2015 16:08:31	RX	0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
    30/07/2015 16:08:31	CHILD	New child discovered, node id=10, child id=0
    30/07/2015 16:08:31	DEBUG	Update child id=0, type=HUM
    30/07/2015 16:08:31	RX	10;0;0;0;7;
    30/07/2015 16:08:31	RX	0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
    30/07/2015 16:08:31	CHILD	New child discovered, node id=10, child id=1
    30/07/2015 16:08:31	DEBUG	Update child id=1, type=TEMP
    30/07/2015 16:08:31	RX	10;1;0;0;6;
    30/07/2015 16:08:32	RX	0;0;3;0;9;read: 10-10-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.0
    30/07/2015 16:08:32	RX	10;1;1;0;0;23.0
    30/07/2015 16:08:32	RX	0;0;3;0;9;read: 10-10-0 s=0,c=1,t=1,pt=7,l=5,sg=0:35.0
    30/07/2015 16:08:32	RX	10;0;1;0;1;35.0
    30/07/2015 16:09:19	INFO	FW "Sensebender Blink" assigned to node 10
    30/07/2015 16:09:19	INFO	Send FW info to node 10: type=6E, version=1, blocks=0x0300, CRC=0x1314
    30/07/2015 16:09:19	TX	10;0;4;0;1;6E00010000031413
    30/07/2015 16:09:19	RX	0;0;3;0;9;send: 0-0-10-10 s=0,c=4,t=1,pt=6,l=8,sg=0,st=ok:6E000100000
    30/07/2015 16:11:49	TX	10;0;3;0;13;0
    30/07/2015 16:11:49	RX	0;0;3;0;9;send: 0-0-10-10 s=0,c=3,t=13,pt=0,l=1,sg=0,st=ok:0
    30/07/2015 16:11:50	RX	0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=0:1.5 b1
    30/07/2015 16:11:50	CHILD	New child discovered, node id=10, child id=internal
    30/07/2015 16:11:50	DEBUG	Update child id=255, type=ARDUINO_NODE
    30/07/2015 16:11:50	RX	10;255;0;0;17;1.5 b1
    30/07/2015 16:11:50	RX	0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    30/07/2015 16:11:50	TX	10;255;3;0;6;M
    30/07/2015 16:11:50	RX	10;255;3;0;6;0
    30/07/2015 16:11:50	RX	0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=6,pt=0,l=1,sg=0,st=ok:M
    30/07/2015 16:11:52	RX	0;0;3;0;9;read: 10-10-0 s=255,c=4,t=0,pt=6,l=10,sg=0:FFFFFFFFFFFFFFFF
    30/07/2015 16:11:52	DEBUG	Undefined firmware/type for node=10
    30/07/2015 16:11:52	INFO	BL version=768
    30/07/2015 16:11:52	INFO	Send FW info to node 10: type=6E, version=1, blocks=0x0300, CRC=0x1314
    30/07/2015 16:11:52	TX	10;0;4;0;1;6E00010000031413
    30/07/2015 16:11:52	RX	10;255;4;0;0;FFFFFFFFFFFFFFFF0300
    30/07/2015 16:11:52	RX	0;0;3;0;9;send: 0-0-10-10 s=0,c=4,t=1,pt=6,l=8,sg=0,st=fail:6E0001000
    30/07/2015 16:11:52	RX	0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
    30/07/2015 16:11:52	RX	10;255;3;0;12;1.0
    30/07/2015 16:11:52	RX	0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
    30/07/2015 16:11:52	CHILD	New child discovered, node id=10, child id=0
    30/07/2015 16:11:52	DEBUG	Update child id=0, type=HUM
    30/07/2015 16:11:52	RX	10;0;0;0;7;
    30/07/2015 16:11:52	RX	0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
    30/07/2015 16:11:52	CHILD	New child discovered, node id=10, child id=1
    30/07/2015 16:11:52	DEBUG	Update child id=1, type=TEMP
    30/07/2015 16:11:52	RX	10;1;0;0;6;
    30/07/2015 16:11:53	RX	0;0;3;0;9;read: 10-10-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.0
    30/07/2015 16:11:53	RX	10;1;1;0;0;23.0
    30/07/2015 16:11:53	RX	0;0;3;0;9;read: 10-10-0 s=0,c=1,t=1,pt=7,l=5,sg=0:35.0
    30/07/2015 16:11:53	RX	10;0;1;0;1;35.0
    

    And after one more click on reset button of arduino, it enters in FW update for minutes. but it doesn't exit, it stays in FW updating.. and FIRMW_REQ, FIRMW_RESPONSE loop...
    I am sure I am missing something, maybe you will see faster than me..


  • Admin

    @scalz Please also submit the debug log from the node. I suspect that the eeprom is not compatible - please provide type/manufacturer.

    Alternatively, you can flash MYSBootloader and use direct OTA (without eeprom) - for this you have to disable the OTA_FEATURE, MYSController will directly interact with the bootloader.

    Cheers,
    tekka


  • Hardware Contributor

    @tekka: thank you for helping, cool!
    Oki, maybe I will use MYSBootloader next, if I can't get it working. I am testing this because I designed some boards that I am debugging and I have eeprom on it (and I would like to have both ota and usb bootloading, I don't remember if there is ubs bootloading on MYSbootloader..).
    But for moment I am debuggin this on breadboard, I have a small breadboard with atsha& eeprom only for testings (but in these tests, atsha is not connected).

    My eeprom ref is : AT25DF512C-SSHN-B. I think it is same on Sensebender. But not the same on moteino (W25X40CLSNIG).

    I have done two tests : one with 56k pullup on CSN, and next without pullups. I got same things. Strange.. In the two tests, it did not started FW upload each time. Sometimes I needed to reset arduino : there was init flash error.
    And when FW ulpoad started, it took maybe 15minutes to upload...and then I got fw crc check error.. (the GW and nodes are maybe 2feets each others, and I use nrf24 for the moment)
    If you want MYSController logs, I can give them.
    Here my serial monitor log for the node : you will see I have tried few times, then it started, and at the end crc check error. Do you think it is my eeprom, which ref do you use?
    serial monitor log_node.txt


  • Admin

    @scalz indeed, the log says that there is a problem initializing the ext. flash:

    read: 0-0-10 s=0,c=4,t=1,pt=6,l=8,sg=0:6E00010000031413
    fw update
    > flash init fail

    Maybe @tbowmo can give you some hints how the flash chip is wired?


  • Admin

    @scalz

    What pin did you use as CS for the flash? (DualOptiboot for the sensebender defaults to D8)

    Have you tried to make a sketch that writes / reads data from the external flash, to verify that you can communicate with it?

    f.ex. the following code:

    #include <SPIFlash.h>
    #include <SPI.h>
    
    SPIFlash sp(8, 0xEF30);
    #define testpin A2
    
    void setup() {
      // put your setup code here, to run once:
      Serial.begin(115200);
      //  pinMode(1,OUTPUT);
      pinMode(testpin, OUTPUT);
    //  gw.begin();
      Serial.print("Flash test program");
      sp.initialize();
      Serial.print(sp.readDeviceId);
      Serial.print(sp.readUniqueId);
    }
    
    void loop() {
      delay(500);
      digitalWrite(testpin, HIGH);
      delay(500);
      digitalWrite(testpin, LOW);
    }
    
    

    The pullup is there, to make sure that the flash is disabled, when doing FW upload via ISP. As ISP is using the same pins as the SPI interface for nrf / flash chip. @blacey had found that the pullup is needed in some cases, otherwise programming via ISP could fail.


  • Hardware Contributor

    @tekka: yes, strange, but then it started.
    @tbowmo: thx. I will try your code. CS on D8. My test breadboard:
    2015-07-30_23-49-23.png
    I tried spiflash sample code in the lib. Init fail too, I needed to do this to have init ok. But when I hit 'i' for device it I get 0 or ff. And if I erase 'e' then read dump it seems that is not erased (I should see ff or 00 only I think).

    //SPIFlash flash(FLASH_SS, 0xEF30);
    //SPIFlash flash(FLASH_SS, 0x1F44);
    //SPIFlash flash(FLASH_SS, 0x1F65);
    SPIFlash flash(FLASH_SS);
    

    Tomorrow I will recheck my breadboard and wiring. strange. I was just looking into Mysensors dev libs to learn how all is done when I saw your msg. thx

    oh and I tried with 56k pullups too. nothing better...


  • Admin

    @scalz said:

    @tekka: yes, strange, but then it started.

    I see, the OTA code should abort if the flash init fails. Will post a PR.


  • Hardware Contributor

    ok. so it seems to be an electronical problem. I have to get init ok. I will check this tomorrow.
    So if I understand right, init was nok, but it transmitted all fw. and about the crc check error at the end. is it calculated from eeprom fw or during transfer in memory? I have not checked yet in the lib.


  • Admin

    @scalz CRC is calculated from flash after all FW blocks are transmitted. In your case the FW blocks were not written resulting in CRC mismatch.


  • Admin

    @scalz btw. is this s typo or are you connecting MISO to SI and MOSI to SO on the ext. flash? This may be the issue...


  • Hardware Contributor

    @tekka: sorry I think i don't understand? what is s typo, do you mean ref of eeprom (AT25DF512C-SSHN-B)? and yes MISO to SI on ext flash, MOSI-SO...is it wrong? how should it be?


  • Admin


  • Hardware Contributor

    @tekka: waaw. too strong! I didn't see it! too bad 😳 😳. you saved me..tomorrow I will check all of this. thank you guys πŸ‘
    I think it will be ok now. Hopefully it was just my first batch and I have some changes, so. but it is good to know. next time I'll be much more careful. it's first time I use ext eeprom, so you are right about typo...


  • Admin

    @scalz no problem. Good luck!


  • Hardware Contributor

    @tekka @tbowmo: I inverted MOSI and MISO wire on my breadboard. Now with SPIFlash example, it looks ok with Jedec id 1F65. So I retried ota (and I keep only gw.process in main loop now so transfer is faster of course). Unfortunately "fw checksum fail" at the end..
    my log here if you want :logs1.txt
    Maybe tomorrow I will be luckier and will find what happens now..


  • Hardware Contributor

    and now the good news for me is ... it is working, yeah! A small break with my mookjong, it gave me an ideaπŸ˜ƒ. And if my previous mistakes have done wrong config in eeprom???maybe I am wrong, but I have changed eeprom and ota is working very well now! So cool!
    thank you for your patience...


  • Admin

    Good to hear @scalz, congratulations on getting it to work πŸ™‚


  • Hardware Contributor

    yes, I am very happy. I can finish the design of my ultra low power node now! it is a camel like (sub-uA) πŸ˜ƒ

    I have just a last question for @hek about ota:
    I looked into the lib. And of course, ota is not interfered by sleeping. But it can be interfered by some process in main loop like sensors, delays... And it can take very long time for ota in these case if we don't optimize our loop. It is logic I understand. So I am looking for a way of preventing this because for a battery-powered node it could be problematic to have an ota transferring for minutes (15min for DHT sketch for example).

    I saw you use fwUpdateOngoing for this in class, and it is protected, and I understand why. But it could be useful if we could have read access to it like a Get/IsOtaPending() Method. Just a get, not a set of course. Do you think you could add this feature? Or do I need to make my own class and derive it from Mysensors class?
    Just a thought...What do you think about this?


Log in to reply
 

Suggested Topics

  • 2
  • 4
  • 2
  • 2
  • 75
  • 17

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts