Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script hanging / freezing #12

Open
MassimoVisona opened this issue Mar 23, 2023 · 3 comments
Open

Script hanging / freezing #12

MassimoVisona opened this issue Mar 23, 2023 · 3 comments

Comments

@MassimoVisona
Copy link

Hello,
I was excperiencing some freezing / hanging behaviour with some tm1637 7-segment displays and this library on a Raspberry Pi Pico board.
I was able to fix it modifiyng your original library as follows:

  • replace all the "sleep_us" occurrencies with "time.sleep"

  • change the "TM1637_DELAY = const(10)" line with "TM1637_DELAY = const(0.00001)"

  • replace the "from time import sleep_us, sleep_ms" line to "import time"

  • I also changed the "sleep_ms(delay)" inside the scroll function with "time.sleep(delay)" and changed the original "delay=250" with "delay=0.250"

My script is now running since two days with no more freezings! I hope this helps.

@mcauser
Copy link
Owner

mcauser commented Jul 3, 2023

That's interesting. Which version of MicroPython are you running?
Have you experienced issues with time.sleep_ms() / time.sleep_us() on any other pico projects?

@MassimoVisona
Copy link
Author

MassimoVisona commented Jul 3, 2023

I am using MicroPython 1.20.
Honestly, it was the first time I used MicroPython, so I have no more experience.
I pointed out this solution on the raspberry forum, here you find an excellent reply from hippy.

@mikescott666
Copy link

I've had the same problem using pi-pico. I raised the issue on the rpi forum, and had useful advice. AIUI:

  1. There's an issue somewhere (I'm not clear whether h'ware or firmware) with timers and interrupts interfering.
  2. the time.sleep_us() function changes its behaviour at 6us,: delays less than this will simply spin, over this do something "more complex".

The current tm1637 module uses delays of 10us when clocking the chip, and falls into the "more complex" arena. After changing to two separate delays of 5us to force a simple, if inefficient, spin, all has been well, and I've not experienced further issues.

See:
https://forums.raspberrypi.com/viewtopic.php?t=355111

(And thanks for the code BTW. So good to have all the messy stuff neatly packaged!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants