Beginner - what is wrong



  • I have successfully installed MySensors 2.2.0 beta, Openhab 2.1 on Raspberry 3 and connected NRF24l01+. Using MQTT.

    Once I've started mysensors gateway there is some communication between node and gateway but the node doesn't get response

    /MySensors $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.2.0-beta
    
    mysgw: MCO:BGN:INIT GW,CP=RNNG----,VER=2.2.0-beta
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    mysgw: Attempting MQTT connection...
    mysgw: connected to 127.0.0.1
    mysgw: MQTT connected
    mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
    mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
    

    Could you help me what should I try next? Is that HW error, some wrong configuration or anything else?

    My mqtt.cfg has this configuration

    mqtt:mysensors.url=tcp://localhost:1883
    mqtt:mysensors.clientId=openHAB
    

  • Mod

    How did you connect the radio modules? Did you use any capacitor? Do you have a serial debug of the node?



  • Thank you for the reply, I've connected it to the raspberry directly (pins 19-24) as described here https://www.mysensors.org/build/raspberry. I've been playing with adding a capacitor 47 uF to both node and raspberry with no efect. I don't have debug of the node, it is mysensebender micro - standalone.
    One way could be to replace gateway direct connection or node with arduino and start tracking. At this moment I don't know if I shall focus my energy to track hardware or there is just some SW tweak/configuration I've missed.
    What I know for sure - if I disconect battery (two AA) from the node and reconnect it again the gateway writes some READ,255-255-0 rows above - according to log parser indicating that the node is requesting for ID but the gateway doesn't respond (just my guess).


  • Mod

    Could also be, if you post your code of the node we could take a look



  • It is just new mysensebender micro out of the box, I suppose this code https://www.openhardware.io/view/1/Sensebender-Micro but I may be wrong. It has the same behavior - when GND and A0 connected during boot, the led blinks.


  • Mod

    after #define MY_RADIO_NRF24 add
    #define MY_NODE_ID 1



  • Thank you for pointing my focus. I will try to experiment with that tonight.



  • Unfortunately I couldn't move futher because of not being able to upload sketch into the node. I've bought CP1202 USB-TTL/3V3 with DTR pin, downgraded Arduino IDE to 1.6.13, set up Mysensebender micro board, COM6, ATmega328 8 MHz and tried all the programmers available but everytime got

    Arduino: 1.6.13 (Windows 10), Vývojová deska: "Sensebender Micro, Atmega328 8Mhz"
    
    Projekt zabírá 20 862 bytů (67%)  úložného místa pro program. Maximum je 30 720 bytů.
    Globální proměnné zabírají 747 bytů (36%)  dynamické paměti, 1 301 bytů zůstává pro lokální proměnné. Maximum je 2 048 bytů.
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xc2
    avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x37
    avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xb4
    avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x57
    avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xc5
    avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x64
    avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xdb
    avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xd9
    avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe5
    avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x41
    Nastala chyba při nahrávaní projektu.
    
    Táto zpráva by měla mít víc informacií v
    "Zobrazení podrobného výstupu při kompilaci"
    podle zapnuté volby v Soubor -> Nastavení.
    

    I've tried to switch Tx/Rx but not helped. I can track serial output, so there is some transfer

    Sensebender Micro FW 1.1req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    sensor started, id 255
     - Online!
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    isMetric: 1
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    T: 21.09
    H: 53
    

    Any ideas how to setup IDE to push the code into node?


  • Hardware Contributor

    Hello, you should link TX of the adapter to RX on the board, and RX to TX.
    Make sure DTR pin is corretly connected to DTR pin of the board and check all the wires you could have a defective one.
    Selected programmer in Arduino should be AVR ISP mk2


  • Mod

    If you have the red ftdi like in the picture, you can plug it straight in



  • I have this one alt text.

    The programmer I am using is called AVRISP.mkII, hope that is correct.

    I have the RX-TX and TX-RX connected. I tried to switch them as well and suppose they are now correct because serial monitor works. DTR on the adapter is connected to the board. The board in self test mode works ok, so it is not damaged.

    The output is the error as above. This is very frustrating I already have some experience with arduino but here after 20+ hours of experimenting I am not able to get out of point zero.

    Anyway thank you for your patience and help.


  • Admin

    @xmonika

    The node requests an ID from the controller.. It is also shown in the MQTT on your raspberry pi, but the controller doesn't seem to reply to this ID request.

    Have you configured OpenHAB to use MQTT for the mysensor gateway? Does the log in OpenHAB tell you anything?

    Did you try to hardcode the node ID, as suggested by @gohan? If yes, could you post the node and gateway logs after this?


  • Mod

    @tbowmo he tried to add the node id, but he is stuck with the uploading of the sketch 😄

    @xmonika then you start to see "uploading" in arduino IDE, try pressing the reset button on the arduino and see if it starts transferring the program.



  • @gohan But I don't have arduino, I have direct connection between USB/TTL and sensebender micro like this (double checked)

    CP1202 USB-TTL <-> MySensebender micro
    GND <-> GND
    3v3 <-> VCC (tried as well with AA battery without VCC connected)
    RX <-> TX
    TX <-> RX
    DTR <-> DTR

    Is there some way to manipulate reset directly on Sensebender micro? Like try to generate edge with the wire?


  • Admin

    @xmonika

    What target do you use in Arduino, when you're trying to program the sensebender micro?



  • @tbowmo In IDE (Arduino: 1.6.13 - Windows 10), I have: "Sensebender Micro, Atmega328 8Mhz" (it is also shown in the code above) is that correct configuration?


  • Admin

    @xmonika

    And you can successfully see the debug log in your terminal program, from your sensebender micro?



  • @tbowmo Yes, i.e. now I can see in the terminal all this:

    Sensebender Micro FW 1.1req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    sensor started, id 255
     - Online!
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    isMetric: 1
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    T: 19.93
    H: 79
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    

  • Admin

    @xmonika and still you can not upload a new sketch to this Pcb?



  • @tbowmo Yes, exactly. By pressing Project Upload => not in sync and Upload error. By pressing Project Upload via programmer => just Upload error message. Here is my setup
    0_1503605995537_IMG_20170824_221526.jpg


  • Admin

    I'm out of ideas right now.

    Did you try a more recent version of the arduino ide?



  • @tbowmo I will try to install all the drivers & IDE on diferent comp tomorrow. I already did the downgrade from 1.8 because of the note "Arduino IDE 1.5.x & 1.6.x compatible." in SB tech specs.
    Anyway thanks for your help. I will have to invest more hours yet to reinvent the wheel but it is fine to have somebody to consult with.


  • Admin

    @xmonika

    Hmm.. it should be compatible with anything above arduino 1.6.. But it's a while since I compiled anything for that target (all my sensebenders have been in "production" since june 2015)



  • So I have tried it on the different computer and the results are the same.

    This is what I did:

    Result is: stk500_getsync() attempt 7 of 10: not in sync: resp=0xdb


  • Admin

    @xmonika

    Wait a moment, you choose AVRISP.mkII ? That shouldn't be necessary, as it is only needed if you ever want to upload a new bootloader (and then you need a different programming adapter as well)

    You are using the build in arduino programming tool to download? (Second icon from left, in the top menu)



  • @tbowmo Yes, second icon from the left (or Ctrl+U).
    By pressing Project Upload via programmer (in menu Project or Ctrl+Shift+U) the result is little bit different - no stk500_getsync() attempt 7 of 10: not in sync: resp=0xdb error just uncommented Upload error.


  • Admin

    @xmonika

    When you have chosen SenseBender Micro as target, which sub variant did you choose? (8Mhz, or 1Mhz?) Can't remember if there are any differences in baudrate.. And I'm not at my arduino dev. machine right now. You should choose the 8Mhz as target.

    Also could you check soldering of the board? (specially around the reset line, capacitor, resistors, atmega328)

    That is the last things that I could think about right now..



  • I have selected 8 MHz. This is what it looks like by me
    0_1503748835505_upload-ea2c7217-d6c6-430d-b59c-64c33302dbbc

    This is what I did today - got another sensebender micro (SBM) board, soldered jumpers, connected again. Then I measured the conductivity between DTR pin on CP2102 chip and capacitor on DTR wire on SBM. It shall be conected via my wires and it was correctly connected.

    Then I run the compillation again and the result is the same - not in sync. So I feel I have replaced everything but still getting the same error.


  • Hardware Contributor

    @xmonika do you have an arduino board ? You could try to use it to test your serial adapter.



  • So I tried Arduino nano (may be clone). The result is simillar - not in sync. But then I tried the nano via standard mini USB cable and also not in sync. Possibly WIN 10 related? I tried it with admin privileges.


  • Admin

    @xmonika or it's related to your usb 2 serial interface?



  • Could be but the same I get on my second computer (win 10 as well). Will experiment with that.


  • Admin

    But still using the same USB device on the second computer?



  • Hello!

    I was hoping I would find a solution here as I basically have the same problem. I ordered two Sensebender Micros like two months ago and flashing a sketch onto them is failing with the same avrdude: stk500_getsync() attempt X of Y: not in sync error. (Noteworthy: I only assembled one Sensebender so far, I haven't tried the second one).

    In my case: I am using ArchLinux with kernel 4.13, so drivers should not be the issue here. I am using this FTDI flash module and the same USB cable for other projects and was able to successfully flash an ESP 8266, a Arduino Pro Mini and a Nano.

    Executing the self-test on the Sensebender Micro does also work and with serial attached I even get the output that all tests have passed. Still, i am not able to flash something onto this device using the IDE. Instead of selecting the board option Sensebender Micro (using both 8 and 1 MHz options) I even tried some odd choices like Arduino Pro Mini or Arduino Nano. Nevertheless, none of those did work.

    Regarding FTDI to Sensebender connection: VCC <-> VCC, GND <-> GND, RX and TX are swapped. I even tried replacing the cables and tried to connect DTR without luck.

    Any further hints are appreciated, thank you.



  • Unfortunately I didn't solved it, I just gave it up and am waiting for new ISP programmer to arrive. That is the last piece I didn't changed (I have changed computer/SW, sensebender Micro and it didn't helped). Hope you will be more successfull.


  • Admin

    Only thing that is left, that I can think about, is if itead had somehow forgotten to write the bootloader..

    But then again, I have supplied them with a binary including both bootloader, and default sensebender micro sketch, so it should have the bootloader. Unless they have made some mistakes..

    I haven't bought any sensebenders for the last couple of years, so unfortunately I can't verify this.



  • Thank you for you input. I had luck and we have an AVRISP mk2 lying around in my company that I can borrow for the weekend. So my plan would be to try to re-flash DualOptiboot first or another bootloader (maybe the stock Arduino Pro Mini one) in further tries and see if this helps.

    The only two things I am trying to figure out in this very moment are:

    1. in which direction the ISP cable has to be mounted so that nothing is damaged
    2. and I do not know yet for sure if the AVRISP mk2 is actually suppyling power or not to the board (for cases where e.g. it may feed 5 volts).


  • Okay, I have soldered the second Sensebender too and tried to burn the bootloader via Arduino IDE onto both devices. The verbose log was the following:

    
    /home/x/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C/home/x/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -patmega328p -cstk500v2 -Pusb -Uflash:w:/home/x/.arduino15/packages/MySensors/hardware/avr/1.0.1/bootloaders/DualOptiboot/optiboot_atmega328_pro_8MHz.hex:i -Ulock:w:0x0F:m 
    
    avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch
    
             System wide configuration file is "/home/x/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"
             User configuration file is "/home/x/.avrduderc"
             User configuration file does not exist or is not a regular file, skipping
    
             Using Port                    : usb
             Using Programmer              : stk500v2
    avrdude: usbdev_open(): Found AVRISP mkII, serno: redacted
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             serial program mode           : yes
             parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             ByteDelay                     : 0
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :
    
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
    
             Programmer Type : STK500V2
             Description     : Atmel STK500 Version 2.x firmware
             Programmer Model: AVRISP mkII
             Hardware Version: 1
             Firmware Version Master : 1.23
             Vtarget         : 3.0 V
             SCK period      : 8.00 us
    
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.00s
    
    avrdude: Device signature = 0x1e950f (probably m328p)
    avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
    avrdude: erasing chip
    avrdude: reading input file "/home/x/.arduino15/packages/MySensors/hardware/avr/1.0.1/bootloaders/DualOptiboot/optiboot_atmega328_pro_8MHz.hex"
    avrdude: writing flash (32768 bytes):
    
    Writing | ################################################## | 100% 0.00s
    
    avrdude: 32768 bytes of flash written
    avrdude: verifying flash memory against /home/x/.arduino15/packages/MySensors/hardware/avr/1.0.1/bootloaders/DualOptiboot/optiboot_atmega328_pro_8MHz.hex:
    avrdude: load data flash data from input file /home/x/.arduino15/packages/MySensors/hardware/avr/1.0.1/bootloaders/DualOptiboot/optiboot_atmega328_pro_8MHz.hex:
    avrdude: input file /home/x/.arduino15/packages/MySensors/hardware/avr/1.0.1/bootloaders/DualOptiboot/optiboot_atmega328_pro_8MHz.hex contains 32768 bytes
    avrdude: reading on-chip flash data:
    
    Reading | ################################################## | 100% 0.00s
    
    avrdude: verifying ...
    avrdude: 32768 bytes of flash verified
    avrdude: reading input file "0x0F"
    avrdude: writing lock (1 bytes):
    
    Writing | ################################################## | 100% 0.01s
    
    avrdude: 1 bytes of lock written
    avrdude: verifying lock memory against 0x0F:
    avrdude: load data lock data from input file 0x0F:
    avrdude: input file 0x0F contains 1 bytes
    avrdude: reading on-chip lock data:
    
    Reading | ################################################## | 100% 0.00s
    
    avrdude: verifying ...
    avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
    This behaviour is deprecated and will result in an error in future version
    You probably want to use 0xcf instead of 0x0f (double check with your datasheet first).
    avrdude: 1 bytes of lock verified
    
    avrdude done.  Thank you.
    

    Interesting in this log is the warning about the invalid value for some fuse bits...

    Flashing a sketch after re-burning the bootloader sadly did not work, the same not in sync error occured again. Next, I tried to burn the bootloader using the board setting of the Arduino Pro Mini (3.3v, 8mhz). Strange enough, this does not work anymore now, yielding a pretty generic error:

    avrdude: stk500v2_command(): command failed
    avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
    avrdude: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.
    

    I do not know, I can only assume that maybe burning another bootloader does not work because of the invalid value warning while burning the default bootloader. I also tried to burn the original Optiboot without success.



  • I just have this problem with "programming" solved. I bought this USBISP programmer, downloaded libUSBk drivers from here and pushed it into SBmicro via programmer USBasp. I don't know why but from some reason two UART programmers were not working.

    It may save frustration and time to somebody in future.



  • @xmonika

    Thanks, I just ordered the same programmer. Let's see if this is working. How did you wire the programmer to the Sensebender? Just asking because the programmer has more pins available than the Arduino board.


  • Admin

    @zeroxdeadbeef

    the SB micro is using the standard 6pin AVR-ISP header.

    Would be interesting to get a memory dump from a fresh SB micro that exhibits the problems with programming.. One of my theories is that it lacks the bootloader, or are misconfigured somehow from the factory.



  • The programmer has 10 pins but the GND is presented 4x. Check the picture [here](http://www.avrfreaks.net/forum/adapter-program-10-pin-6-pin-socket-cable-computer-pc-led-reset-power for wiring, this is how I did it.



  • Thanks for your responses. Sadly, both of my devices are not in factory state anymore. Nevertheless, I will report back after I have received this USBISP programmer.



  • Hello!

    Finally, I have received this USB programmer... I wired everything up, but flashing the Sensebender Micros does not work, sadly. According to avrdude they do not seem to respond:

    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: error: program enable: target doesn't answer. 1 
    avrdude: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.
    
    Error while burning bootloader.
    

    I managed to program and burn the bootloader of a normal Arduino Pro Mini using this programmer and the same cable, so the programmer is working as expected.


  • MySensors Evangelist

    Mmm i think I received a DOA... No pling pling sound in windows...


Log in to reply
 

Suggested Topics

  • 22
  • 10
  • 4
  • 1
  • 19
  • 5

58
Online

11.4k
Users

11.1k
Topics

112.7k
Posts