[SOLVED] Serial problem



  • Hmmmm....Happens with 2 digit node number as well....

    2018-08-09 10:55:47,327 ERROR [Thread-7] [org.mycontroller.standalone.gateway.serial.SerialDataListenerjSerialComm:178] Exception, RawMessage:[2
    

    Now that is interesting! - I highlighted the whole error section and copied to paste (in win 10 latest version) and this is all that pasted in!

    Here is the full message copied a bit at a time....

    2018-08-09 10:55:47,327 ERROR [Thread-7] [org.mycontroller.standalone.gateway.serial.SerialDataListenerjSerialComm:178] Exception, RawMessage:[24;1;1;0;0;22.23]
    java.lang.NumberFormatException: For input string: "24"
    	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    	at java.lang.Integer.parseInt(Integer.java:580)
    	at java.lang.Integer.valueOf(Integer.java:766)
    	at org.mycontroller.standalone.provider.mysensors.MessageParserAbstract.update(MessageParserAbstract.java:112)
    	at org.mycontroller.standalone.provider.mysensors.MessageParserSerial.getMessage(MessageParserSerial.java:32)
    	at org.mycontroller.standalone.provider.mysensors.MessageParserSerial.getMessage(MessageParserSerial.java:28)
    	at org.mycontroller.standalone.gateway.serial.SerialDataListenerjSerialComm.serialEvent(SerialDriverJSerialComm.java:147)
    	at com.fazecast.jSerialComm.SerialPort$SerialPortEventListener.waitForSerialEvent(SerialPort.java:937)
    	at com.fazecast.jSerialComm.SerialPort$SerialPortEventListener$1.run(SerialPort.java:885)
    	at java.lang.Thread.run(Thread.java:748)
    

    The only thing is that both nodes had the number "4" in them and when I tried to paste the log contents it would always stop pasting where the "4" was supposed to be. This happened on both line 1 and line 2 in the above code. I had to copy the bits around the "4" and manually add the "4" back in to post.....Hmmmmm

    Maybe a pointer? I dunno, it is strange!



  • @skywatch Can you send me the complete log to my email address. It will be helpful to see any junk character with the number?



  • @jkandasa

    I've taken the HW apart for now as I had issues again - I will re-build asap and will get the log files for you then. Shouldn't be too long I hope! 😉



  • @jkandasa

    You are correct in your thinking - I have looked at the whole log and there are numerous occasions where I see a space between (or after on single digit) numbers.

    I'll email the log to you..... And below is the result of better cooling on the mycontroller pi3.......

    Before....
    0_1533911512655_Before.JPG

    After... One biggie to cool the CPU and controller....
    0_1533911536024_After.JPG

    I did the same to a pi3 running seti @ home on all four cores 24/7 and it hasn't creashed since(!), so here's hoping for this one.....Best of all it still fits in the case! 🙂



  • @skywatch I see the following junk char in the log, I do not know how this is happening,

    • Problem with serial gateway/recent MySensors library?
    • Problem with JSerialComm driver?

    Let me try to build recent JSerialComm driver for you.

    0_1533917506215_f2f975eb-da06-4fcd-ae03-2bc80a6c957c-image.png



  • @jkandasa - Well, not so much of a puzzle now then 🙂

    Don't worry about the 'nan' values - I can filter them at the node (have modified the code but not had time to upload it as node is builit in to equimpent and soon I will change the sensors to a different type anyway). - Will do that this weekend as it is going to rain here now..... 😞

    It is really only the corrupted strings that it would be good to stop, if possible.



  • It has been 10 hours now without any problems. I did think of lowering the serial baud rate to 19200 and see if that helps. I could also replace the pro mini with another one and see if that helps. But I will give it more time and see how it goes.



  • @skywatch So I got another corrupted string today and now I have lowered the serial baud rate to 19200 between GW and MyC...... I'll let you know the result!



  • Reducing serail baud rate had no effect. Still getting corrupted data on the first value of the raw data - I'll have to have another think about this one!



  • @skywatch ok, The corrupted data only reports in node id right?



  • @skywatch I have added a workaround for number issue, Can you check it in the SNAPSHOT version?



  • @jkandasa Yes - oddly it is only the node ID that seems to be corrupted with junk characters...



  • I have the snapshot version now, thank you - I want to see how it goes for a day first as I have modified the pi slightly and want to see what effect, if any, that has first.

    As always I will let you know how it goes in a few days!



  • Just a quick update - 25 hours and no corrupted node id's, so I am optimistic on the mod.......But, at 6.30AM all data stopped flowing from all nodes - a disconnect and re-connect of the GW pro mini and all came back....hmmm.



  • @skywatch

    Just a quick update - 25 hours and no corrupted node id's, so I am optimistic on the mod.......

    Can you share what change needs in hardware to resolve this issue?

    But, at 6.30AM all data stopped flowing from all nodes - a disconnect and re-connect of the GW pro mini and all came back....hmmm.

    Did gateway reconnect automatically? Can you email me the mycontroller.log file?



  • @jkandasa - Gateway reconnected automatically.

    It all went bad today - I tried a new 5v pro mini GW (with level shifter for data lines) and that failed miserably. So I made a new 3.3V pro mini GW and a new 3.3v regulator board, and have spent the last 7 hours trying to get things working again.

    Sadly I think this will require a full reinstall, losing all data from the hot summer and taking more time than I have available to put into it. Just as it was looking hopeful too......

    I'm gutted.

    P.S. Hardware (Rpi3). Add a 100n capacitor across the 5VDC input on the back of the pi (points to attach to are PP2 and PP5). It will filter out spikes on the power input to the pi. An 0805 SMD ceramic multilayer cap is what I used and I suggest the same for anyone else - but I take no resoposibility if you break a pi - do it at your own risk and only if competent to do so.



  • At 21.30 I got it back to working again with a different 3.3v pro mini as GW, at 22.50 I got the first corrupted node data and at 23.45 all data from remote nodes stopped again and it remained in this state until half an hour ago when I powered down/ powered up the pi.



  • @skywatch Can you share your hardware(serial gateway) and power supply details?



  • @jkandasa Sure!

    Gateway using mysensors 2.3.0.......

    /**
    * The MySensors Arduino library handles the wireless radio link and protocol
    * between your home built sensors/actuators and HA controller of choice.
    * The sensors forms a self healing radio network with optional repeaters. Each
    * repeater and gateway builds a routing tables in EEPROM which keeps track of the
    * network topology allowing messages to be routed to nodes.
    *
    * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
    * Copyright (C) 2013-2015 Sensnology AB
    * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    *
    * Documentation: http://www.mysensors.org
    * Support Forum: http://forum.mysensors.org
    *
    * This program is free software; you can redistribute it and/or
    * modify it under the terms of the GNU General Public License
    * version 2 as published by the Free Software Foundation.
    *
    *******************************
    *
    * DESCRIPTION
    * The ArduinoGateway prints data received from sensors on the serial link.
    * The gateway accepts input on seral which will be sent out on radio network.
    *
    * The GW code is designed for Arduino Nano 328p / 16MHz
    *
    * Wire connections (OPTIONAL):
    * - Inclusion button should be connected between digital pin 3 and GND
    * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
    *
    * LEDs (OPTIONAL):
    * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
    * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
    * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
    * - ERR (red) - fast blink on error during transmission error or recieve crc error
    *
    */
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    //#ifndef MY_RF24_CHANNEL
    #define MY_RF24_CHANNEL (97)
    //#endif
    #define MY_RX_MESSAGE_BUFFER_FEATURE
    #define MY_RF24_IRQ_PIN 2
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    #define MY_RF24_PA_LEVEL RF24_PA_HIGH
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    // Enable inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    
    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    
    // Set inclusion mode duration (in seconds)
    //#define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    //#define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    //#define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <MySensors.h>
    
    void setup()
    {
    	// Setup locally attached sensors
    }
    
    void presentation()
    {
    	// Present locally attached sensors
    }
    
    void loop()
    {
    	// Send locally attached sensor data here
    }
    

    Power is from official raspberry pi power supply - I'll check the rating when I power it down later on tonight.


  • MOD

    @skywatch

    you are using a 3.3v promini as a GW.... 2 questions...

    1. how do you get the data from the promini into the RPI, how is that wired since the promini does not have an USB port...

    2. the GW sketch you posted is designed for an arduino nano 16Mhz, if you use a 3.3v promini it needs run at 8Mhz... Try to make this change in the GW sketch to hardcode the 8Mhz feature. It might be that the cpu freq in the if statement is not picked up bt the compiler, so try with the if statements removed.

    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    

    to

    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    //#if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    //#endif
    

    Can you try an arduino nano + NRF24L01 as gateway, and connect it to USB (if you have one lying around)

    Just as background info, my 1st mycontroller setup was an RPI 2b with an arduino nano on usb that acted as a GW... had this setup for years and it worked flawless, other versions of the SW, but still....


Log in to reply
 

Suggested Topics

2
Online

528
Users

431
Topics

2.7k
Posts