Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    logging for investigating

    Scheduled Pinned Locked Moved MicroPython
    9 Posts 4 Posters 604 Views 4 Watching
    Loading More Posts
    • 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.
    • T Offline
      tttadam
      last edited by

      I have an issue. my device froze every few days. every time(like 2 times so far) it froze in same place. Every 5 minutes it's sends data over mqtt, and it is stuck there. It has small oled which displays the current state, thats how I know.

      I thinking about creating an sdlogger class, what writes out the current state of the machine.
      Can you recommend me some "built in system variables".
      I know gc.mem_free(), and gc.mem_alloc()

      1 Reply Last reply Reply Quote 0
      • S Offline
        svonbentzel
        last edited by

        oh good topic, I need the same, because I have a similar problem. ;-)

        1 Reply Last reply Reply Quote 0
        • T Offline
          tttadam
          last edited by

          Is there any more? :D

          C 1 Reply Last reply Reply Quote 0
          • C Offline
            crumble @tttadam
            last edited by

            @tttadam said in logging for investigating:

            Is there any more? :D

            A try block will be useful as well. so you can catch i2c erros or similar stuff. Note that sys.print_exception() has a file parameter, so you can log them as well.

            A huge problem is that there is no working flush. So you have to secure each (deep)sleep, so all of the messages are written.

            Depending on the version the micropythonimplementation accepts the parameter print(flush=True) , but it seems to do nothing :(. Really strange in my eyes, when the system is designed to shutdown quite often.

            1 Reply Last reply Reply Quote 0
            • J Offline
              jmarcelino
              last edited by jmarcelino

              I used a few of the Openlog Serial Data Logger UART loggers in the past (basically an external Arduino with SD card programmed to log everything they receive on RX pin)
              As independent devices they log even when the entire system crashes which is very convenient for tricky problems.

              Just search on Ebay or Aliexpress for Openlog Serial Data Logger, you'll find loads for around $3.

              1 Reply Last reply Reply Quote 0
              • T Offline
                tttadam
                last edited by

                eventualy I hooked it on a pc, and every few second a I wrote out these values.
                This is what I got. Do you have any idea what could go wrong? (probably it is related to ujson, cause it was working fine before I used that object. )

                Free Mem: 1520256
                Alloc Mem: 1041168
                Free Mem: 1515728
                Alloc Mem: 1045696
                Guru Meditation Error: Core 0 panic'ed (Unknown reason)
                Register dump:
                Guru Meditation Error: Core 0 panic'ed (Guru Meditation Error: Core 0 panic'ed (Guru Meditation Error: Core 0 panic'ed (ets Jun 8 2016 00:22:57

                rst:0x7 (TG0WDT_SYS_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
                configsip: 0, SPIWP:0xee
                clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
                mode:DIO, clock div:1

                T 1 Reply Last reply Reply Quote 0
                • T Offline
                  tttadam @tttadam
                  last edited by

                  @tttadam what should solved the issue that i fired gc.collect in some places which runs every 5 minutes.

                  T C 2 Replies Last reply Reply Quote 0
                  • T Offline
                    tttadam @tttadam
                    last edited by

                    @tttadam some update: turned out that the issue is not solved. just restarting automaticly.
                    I still got the same error. with a coredump. Do you ave any tips where should I search the issue? thanks.
                    Guru Meditation Error: Core 0 panic'ed (IllegalInstruction)
                    . Exception was unhandled.
                    Register dump:
                    PC : 0x40121d00 PS : 0x00060d30 A0 : 0x80126f79 A1 : 0x3ffbd780
                    A2 : 0x00000003 A3 : 0x00000001 A4 : 0x3ffcb7c4 A5 : 0xffffffff
                    A6 : 0x00000001 A7 : 0x00000001 A8 : 0x8008ad8a A9 : 0x3ffbd780
                    A10 : 0x00000003 A11 : 0x00060d23 A12 : 0x00060d20 A13 : 0x00000001
                    A14 : 0x000000fe A15 : 0x3ffc8714 SAR : 0x0000001e EXCCAUSE: 0x00000000
                    EXCVADDR: 0x00000000 LBEG : 0x40099934 LEND : 0x40099962 LCOUNT : 0xffffffff

                    Backtrace: 0x40121d00:0x3ffbd780 0x40126f76:0x3ffbd7b0

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      crumble @tttadam
                      last edited by

                      @tttadam

                      If you have trouble with fragmentation, you have to redesign your program. Running the garbage collector will not help in all situations and small changes can get you into trouble again.

                      You can reduce fragmentation by using precompiled scripts and allocating huge buffers at early stages. Reinitialize your buffers instead of allocating them each time.

                      1 Reply Last reply Reply Quote 0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • 1 / 1
                      • First post
                        Last post

                      Pycom on Twitter

                      Pycom