Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Serial is dropping characters

Serial is dropping characters

Scheduled Pinned Locked Moved Development
19 Posts 8 Posters 6.4k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tbowmoT tbowmo

    You use serial GW, and also handle serial input yourself? this will collide when both read from the serial port.

    The missing characters are probably "eaten" by mysensors before your serial event routine reads them?

    You should look at using soft serial, do you have a separate serial for your own communication protocol, and for the mysensors protocol. (I assume that you are using atmega 328 based hw, as you don't mention which hw you are using.

    Another option is to use a higher end MCU, either atmega 1280, or atsamd21, both have more serial ports available (the later also have usb)

    AndErnA Offline
    AndErnA Offline
    AndErn
    wrote on last edited by
    #4

    @tbowmo said:

    You use serial GW, and also handle serial input yourself?

    Using several Arduino Nano by the way and nRF24LO1.

    In the absence of any instructions for using Serial at all in v2, I am left to guessing how to proceed. I researched here a few days back and questions on Serial gateway for v2 is pretty much ignored.

    I ONLY handled serial myself as I could not find any reference to using the Serial Gateway in Examples. It is an appalling "Example" when it has three empty functions. How an Earth can anyone say that code below is an example of anything?

    How does it send data via serial to the attached PC?
    How does it receive data via serial from the attached PC?

    #include <SPI.h>
    #include <MySensors.h>  
    
    void setup() { 
      // Setup locally attached sensors
    }
    
    void presentation() {
     // Present locally attached sensors 
    }
    
    void loop() { 
      // Send locally attached sensor data here 
    }
    
    
    tbowmoT AnticimexA AWIA scalzS 4 Replies Last reply
    0
    • KoreshK Offline
      KoreshK Offline
      Koresh
      Contest Winner
      wrote on last edited by
      #5

      Hi. I can assume it is caused by one of the points:

      • If you use 8Mhz atmega chip you can't use a serial with a speed higher than 57k. Otherwise you face character dropping.
      • I do not know the architecture of mysensors library very well, so I hope gurus can develop my thought. If the library uses some of interrupts handlers (for example timer interrupts) and ISR contains handlers that take a lot of time, it can cause dropping of hardware serial ISR and result in characters dropping at maximum serial speed.
      1 Reply Last reply
      0
      • AndErnA AndErn

        @tbowmo said:

        You use serial GW, and also handle serial input yourself?

        Using several Arduino Nano by the way and nRF24LO1.

        In the absence of any instructions for using Serial at all in v2, I am left to guessing how to proceed. I researched here a few days back and questions on Serial gateway for v2 is pretty much ignored.

        I ONLY handled serial myself as I could not find any reference to using the Serial Gateway in Examples. It is an appalling "Example" when it has three empty functions. How an Earth can anyone say that code below is an example of anything?

        How does it send data via serial to the attached PC?
        How does it receive data via serial from the attached PC?

        #include <SPI.h>
        #include <MySensors.h>  
        
        void setup() { 
          // Setup locally attached sensors
        }
        
        void presentation() {
         // Present locally attached sensors 
        }
        
        void loop() { 
          // Send locally attached sensor data here 
        }
        
        
        tbowmoT Offline
        tbowmoT Offline
        tbowmo
        Admin
        wrote on last edited by
        #6

        @AndErn

        the chosen GW transport is handled internally by the mysensors library, so if you choose W5100 (wired ethernet) the library itself handles W5100 communication.

        And the same is actually true, when defining it with MY_GATEWAY_SERIAL, then the mysensors library itself handles the serial port, transmitting data, and receiving the data from the serial port, according to the the MySensors serial protocol

        An example is usually meant to be able to run without modifications at all as a starter, and then people can start tinkering with it, and adjust different parameters in order to figure out how the example is working. And so, it should have started chatting along the serialport, if you just started the bare example up without modifications.

        I admit that there may be some lacks in documentation.. But you are welcome to pitch in, and give a helping hand if you feel something is missing.

        Btw. please remember that we are all here on a voluntary basis, using our free / spare time to develop this library. So we can't keep a track on all posts on the forum 24/7, because there comes so many new posts all the time. So we do miss a post here and there, we are only humans..

        1 Reply Last reply
        4
        • AndErnA AndErn

          @tbowmo said:

          You use serial GW, and also handle serial input yourself?

          Using several Arduino Nano by the way and nRF24LO1.

          In the absence of any instructions for using Serial at all in v2, I am left to guessing how to proceed. I researched here a few days back and questions on Serial gateway for v2 is pretty much ignored.

          I ONLY handled serial myself as I could not find any reference to using the Serial Gateway in Examples. It is an appalling "Example" when it has three empty functions. How an Earth can anyone say that code below is an example of anything?

          How does it send data via serial to the attached PC?
          How does it receive data via serial from the attached PC?

          #include <SPI.h>
          #include <MySensors.h>  
          
          void setup() { 
            // Setup locally attached sensors
          }
          
          void presentation() {
           // Present locally attached sensors 
          }
          
          void loop() { 
            // Send locally attached sensor data here 
          }
          
          
          AnticimexA Offline
          AnticimexA Offline
          Anticimex
          Contest Winner
          wrote on last edited by Anticimex
          #7

          @AndErn MySensors is developed by people that also have day time jobs. You can't expect to get enterprise level support for something that is

          1. Free to use
          2. Developed on a spare-time basis
          3. Without a paid support organization

          Especially, if you don't use the polite tone suggested in the forum guidelines.
          People here try their best to help out as much as possible.

          Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

          1 Reply Last reply
          4
          • AndErnA AndErn

            @tbowmo said:

            You use serial GW, and also handle serial input yourself?

            Using several Arduino Nano by the way and nRF24LO1.

            In the absence of any instructions for using Serial at all in v2, I am left to guessing how to proceed. I researched here a few days back and questions on Serial gateway for v2 is pretty much ignored.

            I ONLY handled serial myself as I could not find any reference to using the Serial Gateway in Examples. It is an appalling "Example" when it has three empty functions. How an Earth can anyone say that code below is an example of anything?

            How does it send data via serial to the attached PC?
            How does it receive data via serial from the attached PC?

            #include <SPI.h>
            #include <MySensors.h>  
            
            void setup() { 
              // Setup locally attached sensors
            }
            
            void presentation() {
             // Present locally attached sensors 
            }
            
            void loop() { 
              // Send locally attached sensor data here 
            }
            
            
            AWIA Offline
            AWIA Offline
            AWI
            Hero Member
            wrote on last edited by
            #8

            @AndErn said:

            How an Earth can anyone say that code below is an example of anything?

            The example code demonstrates the plain simplicity of coding a fully functional MySensors gateway. The purpose and use of the gateway is well documented on the website if you take time to read.

            AndErnA 1 Reply Last reply
            0
            • AWIA AWI

              @AndErn said:

              How an Earth can anyone say that code below is an example of anything?

              The example code demonstrates the plain simplicity of coding a fully functional MySensors gateway. The purpose and use of the gateway is well documented on the website if you take time to read.

              AndErnA Offline
              AndErnA Offline
              AndErn
              wrote on last edited by
              #9

              Thank you all so much for all that wonderful help.

              @tbowmo I have no idea why you mention the W5100 when I am asking about passing data between the PC and Arduino via Serial.
              @Anticimex I do not expect that kind of support, I do expect an "example" to actually example something.

              The example does NOT handle the Serial to and from the serial port of the PC as it stands. I obviously need to have more in that Serial Gateway than three empty functions. AND YES, I read up on the subject including a few posts here as I mentioned in the OP but nothing seems to get data passing in both directions.

              Instead of rhetoric back at me, what about offering up some example code that you can see working on your PC?. I just need a very basic example using puTTY that works in both directions.

              Thank you.

              tbowmoT mfalkviddM 2 Replies Last reply
              0
              • hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by
                #10

                You could perhaps try to explain what you're trying to archive here...

                Sending stuff to the serial console at the same time using the node as a serial gateway? I don't understand why? It will interfere with the communication with the controller.

                1 Reply Last reply
                0
                • AndErnA AndErn

                  Thank you all so much for all that wonderful help.

                  @tbowmo I have no idea why you mention the W5100 when I am asking about passing data between the PC and Arduino via Serial.
                  @Anticimex I do not expect that kind of support, I do expect an "example" to actually example something.

                  The example does NOT handle the Serial to and from the serial port of the PC as it stands. I obviously need to have more in that Serial Gateway than three empty functions. AND YES, I read up on the subject including a few posts here as I mentioned in the OP but nothing seems to get data passing in both directions.

                  Instead of rhetoric back at me, what about offering up some example code that you can see working on your PC?. I just need a very basic example using puTTY that works in both directions.

                  Thank you.

                  tbowmoT Offline
                  tbowmoT Offline
                  tbowmo
                  Admin
                  wrote on last edited by
                  #11

                  @AndErn

                  I was merely using w5100 as an example, as I also did with serial.

                  I am using exactly that example sketch in my own serial gateway, with 3 empty functions. And it works!

                  Have you even given it a chance, that is putting an unmodified GatewaySerial example into your arduino, connected a terminal emulator and checked the responses you get there? Before starting to tell us that we are doing everything wrong?

                  AndErnA 1 Reply Last reply
                  1
                  • AndErnA AndErn

                    Thank you all so much for all that wonderful help.

                    @tbowmo I have no idea why you mention the W5100 when I am asking about passing data between the PC and Arduino via Serial.
                    @Anticimex I do not expect that kind of support, I do expect an "example" to actually example something.

                    The example does NOT handle the Serial to and from the serial port of the PC as it stands. I obviously need to have more in that Serial Gateway than three empty functions. AND YES, I read up on the subject including a few posts here as I mentioned in the OP but nothing seems to get data passing in both directions.

                    Instead of rhetoric back at me, what about offering up some example code that you can see working on your PC?. I just need a very basic example using puTTY that works in both directions.

                    Thank you.

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #12

                    @AndErn as others have already mentioned, you need to start behaving like a good community member. MySensors is a friendly community and letting your frustration on people who try to help is simply not ok. The forum guidelines are plain and simple:

                    1. Be nice
                    2. Don't place ads

                    I will be watching the next 10 or so posts you make. I'm sure you can be friendly just like everyone else here.

                    AndErnA 1 Reply Last reply
                    1
                    • AndErnA AndErn

                      @tbowmo said:

                      You use serial GW, and also handle serial input yourself?

                      Using several Arduino Nano by the way and nRF24LO1.

                      In the absence of any instructions for using Serial at all in v2, I am left to guessing how to proceed. I researched here a few days back and questions on Serial gateway for v2 is pretty much ignored.

                      I ONLY handled serial myself as I could not find any reference to using the Serial Gateway in Examples. It is an appalling "Example" when it has three empty functions. How an Earth can anyone say that code below is an example of anything?

                      How does it send data via serial to the attached PC?
                      How does it receive data via serial from the attached PC?

                      #include <SPI.h>
                      #include <MySensors.h>  
                      
                      void setup() { 
                        // Setup locally attached sensors
                      }
                      
                      void presentation() {
                       // Present locally attached sensors 
                      }
                      
                      void loop() { 
                        // Send locally attached sensor data here 
                      }
                      
                      
                      scalzS Offline
                      scalzS Offline
                      scalz
                      Hardware Contributor
                      wrote on last edited by scalz
                      #13

                      Hello.

                      I won't blame you if you're noob in coding, every one is a noob once ;) but i think you were a bit too much confident..
                      @AndErn said:
                      How an Earth can anyone say that code below is an example of anything?

                      Because, as you said, there is not so much lines in the sketch so a bit difficult to not see #include <MySensors.h> :confused:
                      As guys said, it includes everything behind the scene to help noobs to discover mysensors and being confused at the beginning with all the lib stuff. Instead of having to call every functions..I already said it on the forum though..Connect it to a controller and you have something in minutes :)

                      That said, please explain why you're trying this. sure if you're using a controller that can interfere. but perhaps you're using your own?? and try to add things? why? do you need something? because there is already mysensors api. so you see not easy without all infos. people are kind here, no pain ;)

                      1 Reply Last reply
                      1
                      • hekH Offline
                        hekH Offline
                        hek
                        Admin
                        wrote on last edited by
                        #14

                        @AndErn

                        Behind the scene, here's where the magic happens:
                        https://github.com/mysensors/MySensors/blob/development/core/MyMainDefault.cpp

                        1 Reply Last reply
                        0
                        • AndErnA Offline
                          AndErnA Offline
                          AndErn
                          wrote on last edited by
                          #15

                          We appear to be on a merry go round to beat the messenger at each pass. You people need to READ my posts and respond to what I write, not just chest-thump.

                          I have PC controller software that I have written (professional programmer for 40-years, so I have a few ideas on how things work) and it accesses the Nano via the USB-Serial connection. It sends commands to the network of Smart-Nodes and receives information from the network of Nodes.

                          It is very much like MySensors but a lot less complicated than MySensors as it is designed to do just one job for one network with a half dozen specific and very-smart Nodes. By Smart-Nodes I mean every Node will keep actively controlling the A/C, heating etc if the power goes out as it frequently does out here in the boonies.

                          It is working almost perfectly with the RF24network libraries, but after six or so days the network becomes unreliable with occasional data packets not being sent. I have tracked it down to within the RF24network but I do not want to spend days or weeks hunting down the problems and thought I would use MySensors for the networking as I had previously used 1.5 very successfully

                          I feel it is a waste of any more time as NO ONE has yet shown me how to make the example work WITH 2.) Bear in mind I WROTE ABOVE it worked OK with 1.5 AND the basic Arduino Serial.

                          AnticimexA 1 Reply Last reply
                          0
                          • mfalkviddM mfalkvidd

                            @AndErn as others have already mentioned, you need to start behaving like a good community member. MySensors is a friendly community and letting your frustration on people who try to help is simply not ok. The forum guidelines are plain and simple:

                            1. Be nice
                            2. Don't place ads

                            I will be watching the next 10 or so posts you make. I'm sure you can be friendly just like everyone else here.

                            AndErnA Offline
                            AndErnA Offline
                            AndErn
                            wrote on last edited by
                            #16

                            @mfalkvidd said:

                            1. Don't place ads

                            Seriously? What is that supposed to mean? Are you suggesting I am posting ads about puTTY?

                            Watching my posts? Seriously, that's great as maybe you can offer some actual help rather than lazy rhetoric.

                            That's about as "nice" as I can be when I am getting no actual help, just vilification.

                            IF I am dogin it wrong then PLEASE show me how it should be done.

                            1 Reply Last reply
                            0
                            • tbowmoT tbowmo

                              @AndErn

                              I was merely using w5100 as an example, as I also did with serial.

                              I am using exactly that example sketch in my own serial gateway, with 3 empty functions. And it works!

                              Have you even given it a chance, that is putting an unmodified GatewaySerial example into your arduino, connected a terminal emulator and checked the responses you get there? Before starting to tell us that we are doing everything wrong?

                              AndErnA Offline
                              AndErnA Offline
                              AndErn
                              wrote on last edited by
                              #17

                              @tbowmo said:

                              I am using exactly that example sketch in my own serial gateway, with 3 empty functions. And it works!

                              Really? In both directions? You can send from puTTY and the Serial Gateway displays it --AND-- the Serial Gateway sends stuff and puTTY displays it?

                              That's why I wrote above "code that you can see working on your PC?"

                              1 Reply Last reply
                              0
                              • tbowmoT Offline
                                tbowmoT Offline
                                tbowmo
                                Admin
                                wrote on last edited by tbowmo
                                #18

                                @AndErn

                                the gateway doesn't echo characters back to you, so if you send something to the GW, then you won't see it in your terminal (unless you have local echo on).

                                I am using the sketch, and it prints startup messages from the GW, and also messages received from nodes on the MySensors network. I can also send messages to nodes (using Mysensors serial API to the GW)

                                You still haven't told us if you see any messages on the serial, when you program the basic sketch in your GW. That is, program GatewaySerial example sketch into your arduino, and then open the terminal program in arduino, perhaps enable #define MY_DEBUG, then it sends even more text over the serial port..

                                1 Reply Last reply
                                0
                                • AndErnA AndErn

                                  We appear to be on a merry go round to beat the messenger at each pass. You people need to READ my posts and respond to what I write, not just chest-thump.

                                  I have PC controller software that I have written (professional programmer for 40-years, so I have a few ideas on how things work) and it accesses the Nano via the USB-Serial connection. It sends commands to the network of Smart-Nodes and receives information from the network of Nodes.

                                  It is very much like MySensors but a lot less complicated than MySensors as it is designed to do just one job for one network with a half dozen specific and very-smart Nodes. By Smart-Nodes I mean every Node will keep actively controlling the A/C, heating etc if the power goes out as it frequently does out here in the boonies.

                                  It is working almost perfectly with the RF24network libraries, but after six or so days the network becomes unreliable with occasional data packets not being sent. I have tracked it down to within the RF24network but I do not want to spend days or weeks hunting down the problems and thought I would use MySensors for the networking as I had previously used 1.5 very successfully

                                  I feel it is a waste of any more time as NO ONE has yet shown me how to make the example work WITH 2.) Bear in mind I WROTE ABOVE it worked OK with 1.5 AND the basic Arduino Serial.

                                  AnticimexA Offline
                                  AnticimexA Offline
                                  Anticimex
                                  Contest Winner
                                  wrote on last edited by Anticimex
                                  #19

                                  @AndErn said:

                                  I feel it is a waste of any more time as NO ONE has yet shown me how to make the example work WITH 2.) Bear in mind I WROTE ABOVE it worked OK with 1.5 AND the basic Arduino Serial.

                                  Then stick to 1.5 and stop wasting the rest of us incompetent programmers (who have more or less than 40 years of experience) time with your ranting.

                                  Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                  1 Reply Last reply
                                  1
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  19

                                  Online

                                  11.7k

                                  Users

                                  11.2k

                                  Topics

                                  113.1k

                                  Posts


                                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • MySensors
                                  • OpenHardware.io
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular