1

I use both cores of RP2040 chip. Main one runs main loop and second handles LCD display. I start second one on the thread like

_thread.start_new_thread(taskLCD, (100,0.5))

where taskLCD updates LCD every half os second.

Sometimes when I restart program second core is still working and there is a message:

OSError: core1 in use

Is there way to kill this second core process in advance and elimiate this message? The only way to stop it is to entirely shutdown/depower chip. But, in this case, all info is lost and I do not know what had happen, what had caused the error.

Alex
  • 4,457
  • 2
  • 20
  • 59
  • I really don't know, but it looks like a `thread_exit()` is supposed to shut down the thread. Or maybe `thread_get_ident()` will give you a way to determine if there is / is-not an existing thread? These are the things I would try, anyway. Or have taskLCD set a variable to indicate that it doesn't need to be restarted? – aMike Mar 27 '21 at 17:45
  • I would go with idea of variable that indicates that tread should die. But it will take time. Issue is - I start new main thread from scratch but it should assume that old core1 is still running. – Alex Mar 29 '21 at 00:18

1 Answers1

1

Connect RUN pin to GND, which will reset the board and also stops another core