Skip to content

m.iMX RT: After a few seconds print() hangs #10335

@rkompass

Description

@rkompass

Attempting to run simple_benchmarks.py crashed (hung) MP on my Teensy 4.1 .
I reduced the program maximally to:

import time

def timeit(func, arg):
    t1 = time.ticks_us()
    func(arg)
    t2 = time.ticks_us()
    return time.ticks_diff(t2, t1) / 1e6

def bm_001AdditionA(n):
    for idx in range(n):
        if idx % 50 == 0:
            a = 1.0
            b = 1.1
            c = 3.456789e-4
            d = 5.678901e4
            f = 1.5
        a += 1.01
        b = a + b
        c = c + a + a + a
        d = a + b + 0.9999
        e = a + b + c + d
    return (a, b, c, d, e)

print('Start..', end='')
for _ in range(5):
    timeit(bm_001AdditionA, 50000)
    time.sleep(0.1)                                            # including this leads to a hang
    # print('.', end="")                                       # but including this runs through
print('Finish')

and still it hangs.
Strangely including the print('.', end="") leads to ordinary run through.
Commenting that statement out still runs through, but as soon as time.sleep(0.1) is uncommented it hangs again.
A combination of timing and printing leading to a crash..

For reproducing I installed the latest MP:
MicroPython v1.19.1-782-g699477d12 on 2022-12-20; Teensy 4.1 with MIMXRT1062DVJ6A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy