Memory leak when querying or modifying E220 settings when M0 and M1 are in GND

Home Forums The libraries hosted on the site EByte LoRa e220 UART devices LLCC68 Memory leak when querying or modifying E220 settings when M0 and M1 are in GND

Viewing 3 reply threads
  • Author
    Posts
    • #24869
      george_santiago
      Participant

        Hi Renzo
        Many thanks for the E220 library. She is fantastic.

        I identified a possible memory leak caused by reading or changing the E220 settings when pins M0 and M1 are in GND.
        Everything works fine (reading and changing the settings) if the M0 and M1 pienos are at HIGHT(3.3V) or connected to the GPIO of the MCU (In my case, I use NodeMCU ESP8266).
        However, many strange behaviors occur when I try to read or modify the E220 settings when M0 and M1 are in GND.
        Below is a log:

        Ex1: When trying to change the frequency from 850 (default) to 920 (adding 70), the leak assigned the value ‘100’, and the final frequency is 950:

        20:36:08.814 > No response from device! (Check wiring)
        20:36:08.819 > 12
        20:36:09.437 > Save mode returned not recognized!
        20:36:09.440 > 11
        20:36:09.811 > No response from device! (Check wiring) 
        20:36:09.815 > 12
        20:36:09.816 > ----------------------------------------
        20:36:09.819 > Chan : 100 -> 950MHz
        20:36:09.821 > ----------------------------------------

        Ex2: When performing several readings of the channel configuration and radio frequency, the value 950 (initial) is changed to 905:

        20:36:13.169 > No response from device! (Check wiring)
        20:36:13.173 > 12
        20:36:13.174 > ----------------------------------------
        20:36:13.177 > Chan : 55 -> 905MHz
        20:36:13.179 > ----------------------------------------

        Ex3: When sending a ‘const char “0123456789”;’, the Receiver received this message a few times:

        20:36:12.477 > Msg_RECEBIDA: 0123456789
        
        20:36:15.100 > Msg_RECEBIDA: �

        Would it be possible to develop an approach to prevent the MCU from changing the E220 settings if M0 and M1 are in GND? I think this would prevent this memory leak.

        The complete log:

        20:36:08.814 > No response from device! (Check wiring)
        20:36:08.819 > 12
        20:36:09.437 > Save mode returned not recognized!
        20:36:09.440 > 11
        20:36:09.811 > No response from device! (Check wiring) 
        20:36:09.815 > 12
        20:36:09.816 > ----------------------------------------
        20:36:09.819 > Chan : 100 -> 950MHz
        20:36:09.821 > ----------------------------------------
        20:36:09.825 > Mensagem Enviada: 101
        20:36:10.117 > Msg_STATUS: Success
        20:36:10.491 > No response from device! (Check wiring)
        20:36:10.495 > 12
        20:36:10.496 > ----------------------------------------
        20:36:10.499 > Chan : 100 -> 950MHz
        20:36:10.501 > ----------------------------------------
        20:36:10.773 > Aberto para Receber mensagens...
        20:36:12.367 > Message received!
        20:36:12.475 > Msg_STATUS: Success
        20:36:12.477 > Msg_RECEBIDA: 0123456789
        20:36:12.480 > RSSI: 229
        20:36:12.493 > Mensagem Enviada: 102
        20:36:12.795 > Msg_STATUS: Success
        20:36:13.169 > No response from device! (Check wiring)
        20:36:13.173 > 12
        20:36:13.174 > ----------------------------------------
        20:36:13.177 > Chan : 55 -> 905MHz
        20:36:13.179 > ----------------------------------------
        20:36:13.775 > Aberto para Receber mensagens...
        20:36:14.751 > Message received!
        20:36:14.861 > Msg_STATUS: Success
        20:36:14.863 > Msg_RECEBIDA: 0123456789
        20:36:14.866 > RSSI: 230
        20:36:14.996 > Message received!
        20:36:15.098 > Msg_STATUS: Success
        20:36:15.100 > Msg_RECEBIDA: �
        20:36:15.102 > RSSI: 229
        20:36:15.171 > Mensagem Enviada: 103
        20:36:15.472 > Msg_STATUS: Success
        20:36:15.845 > No response from device! (Check wiring)
        20:36:15.849 > 12
        20:36:15.850 > ----------------------------------------
        20:36:15.853 > Chan : 55 -> 905MHz
        20:36:15.855 > ----------------------------------------
        20:36:16.776 > Aberto para Receber mensagens...
        20:36:17.136 > Message received!
        20:36:17.245 > Msg_STATUS: Success
        20:36:17.247 > Msg_RECEBIDA: 0123456789
        20:36:17.250 > RSSI: 222
        20:36:17.380 > Message received!
        20:36:17.482 > Msg_STATUS: Success
        20:36:17.484 > Msg_RECEBIDA: �
        20:36:17.486 > RSSI: 228
        20:36:17.847 > Mensagem Enviada: 104
        20:36:18.149 > Msg_STATUS: Success
        20:36:18.523 > No response from device! (Check wiring)
        20:36:18.527 > 12
        20:36:18.528 > ----------------------------------------
        20:36:18.531 > Chan : 55 -> 905MHz
        20:36:18.533 > ----------------------------------------
        20:36:19.521 > Message received!
        20:36:19.630 > Msg_STATUS: Success
        20:36:19.632 > Msg_RECEBIDA: 0123456789
        20:36:19.635 > RSSI: 230
        20:36:19.765 > Message received!
        20:36:19.867 > Msg_STATUS: Success
        20:36:19.869 > Msg_RECEBIDA: �
        20:36:19.871 > RSSI: 228
        20:36:19.872 > Aberto para Receber mensagens...
        20:36:20.525 > Mensagem Enviada: 105
        20:36:20.826 > Msg_STATUS: Success
        20:36:21.200 > No response from device! (Check wiring)
        20:36:21.203 > 12
        20:36:21.204 > ----------------------------------------
        20:36:21.207 > Chan : 55 -> 905MHz
        20:36:21.209 > ----------------------------------------
        20:36:21.906 > Message received!
        20:36:22.014 > Msg_STATUS: Success     
        20:36:22.016 > Msg_RECEBIDA: 0123456789
        20:36:22.019 > RSSI: 230
        20:36:22.150 > Message received!
        20:36:22.252 > Msg_STATUS: Success
        20:36:22.254 > Msg_RECEBIDA: �    
        20:36:22.256 > RSSI: 228
        20:36:22.869 > Aberto para Receber mensagens...
        20:36:23.201 > Mensagem Enviada: 106
        20:36:23.503 > Msg_STATUS: Success
        20:36:23.877 > No response from device! (Check wiring) 
        20:36:23.881 > 12
        20:36:23.882 > ----------------------------------------
        20:36:23.885 > Chan : 55 -> 905MHz
        20:36:23.887 > ----------------------------------------
        20:36:24.292 > Message received!
        20:36:24.401 > Msg_STATUS: Success     
        20:36:24.403 > Msg_RECEBIDA: 0123456789
        20:36:24.406 > RSSI: 229
        20:36:24.535 > Message received!
        20:36:24.637 > Msg_STATUS: Success
        20:36:24.639 > Msg_RECEBIDA: �
        20:36:24.641 > RSSI: 228
        20:36:25.870 > Aberto para Receber mensagens...
        20:36:25.880 > Mensagem Enviada: 107
        20:36:26.182 > Msg_STATUS: Success
        20:36:26.555 > No response from device! (Check wiring)
        20:36:26.559 > 12
        20:36:26.560 > ----------------------------------------
        20:36:26.563 > Chan : 55 -> 905MHz
        20:36:26.565 > ----------------------------------------
        20:36:26.921 > Message received!
        20:36:27.023 > Msg_STATUS: Success
        20:36:27.025 > Msg_RECEBIDA: �
        20:36:27.027 > RSSI: 228
        20:36:28.558 > Mensagem Enviada: 108
        20:36:28.859 > Msg_STATUS: Success
        20:36:29.232 > No response from device! (Check wiring)
        20:36:29.236 > 12
        20:36:29.237 > ----------------------------------------
        20:36:29.240 > Chan : 55 -> 905MHz
        20:36:29.242 > ----------------------------------------
        20:36:29.246 > Aberto para Receber mensagens...
        20:36:31.234 > Mensagem Enviada: 109
        20:36:31.535 > Msg_STATUS: Success
      • #24878
        Renzo Mischianti
        Keymaster

          Hi George,
          I can’t check the value of M0 and M1 if they are not connected.
          But I am trying to think of something to prevent that situation.
          Bye Renzo

        • #24885
          george_santiago
          Participant

            Would using the digitalRead() function help?

            Think of something like:
            1) Check the status of pins M0 and M1 with digitalRead(). If the pins return HIGHT then make the configuration changes on the E220. Otherwise, print warning and do not make changes.

            digitalRead() will not guarantee correct return as it will know the state of the MCU pin. But maybe this could help with the memory leak.

            If the M0 and M1 pins are disconnected (floating), do they have an internal resistor (pullup or pulldown)?

            2) Another issue would be to not allow messages to be sent when M0 and M1 pins are HIGHT. When M0 and M1 are in HIGHT, the E220 does not send messages, correct? If so, it would be interesting to issue a printout with a warning (“Cannot send messages. Pins M0 and M1 at HIGHT level”).

          • #24891
            Renzo Mischianti
            Keymaster

              Hi George,
              you probably received a memory leak because you do the wrong setting of M0 and M1, and the return of the device is wrong, and the repeating of that operation put MCU in an inconsistent state.
              Try to do a full connection and retry.
              Bye Renzo

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.
          Exit mobile version