• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Micropython – disable_irq() enable_irq cause a reboot randowly

Q&A Forum › Category: ESP8266 › Micropython – disable_irq() enable_irq cause a reboot randowly
0 Vote Up Vote Down
Vicenç Luna asked 3 years ago

Hi
I want to disable all interrupts, when during request.post command.
I coded this, using disable_irq() and enable_irq() commands, but caused reboot.

irq_state=machine.disable_irq()
print(“IRQ STATE: “,irq_state)
for iS in setSample:
       print(iS,”for:”,headers,” – “,url)
       r=requests.post(url, json=iS, headers=headers)
       r=””
machine.enable_irq(irq_state)

How should I do for disabling all interrupts during a certain period?
 
Regards

Question Tags: MicroPython
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.

I’m sorry for the delay in my response.

You seem to be using those functions correctly.

I’ve searched for a while and some people had the same issue, but I didn’t find an answer: https://loboris.eu/forum/showthread.php?tid=102

Do you really need to disable interrupts? What exactly you need to do?You can only perform very short tasks with interrupts disabled (I think) – like changing the state of a flag variable. Then, immediately enable interrupts again. After that, you should have a condition that checks the state of that flag variable and if an interrupt has been detected, perform the request.

I hope this helps.

Regards,
Sara

0 Vote Up Vote Down
Vicenç Luna answered 3 years ago

Hi Sara
 
sorry I didn’t see your answer.
My problem was solved.
I don’t know why but if I disconnect ESP8266 to PC (Using USB),
ESP8266 is more stable and doesn’t generate any error.
I can not understand why but now it works and I don’t lose any data.
 
Regards
 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
That’s weird. But, I’m glad you get it working now.
I’ll mark this question as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.