Page 5 of 5

Re: UART not working with today's version of micropython

Posted: Tue Apr 27, 2021 11:37 am
by Tinus
I am seeing some delay in the handling of my interrupts when the code is running on one core.
Would it be possible to run my interrupt handler in core 2?

Would that be as simple as running the initialisation on core2 or would I have to have a loop running on core 2 for that to work?

Re: UART not working with today's version of micropython

Posted: Tue Apr 27, 2021 11:50 am
by Roberthh
I still have no grip on that topic. The only thing I noticed is, that it runs stable if the interrupt handling is on the first core (core 0). Then the second core may run other tasks.

Re: UART not working with today's version of micropython

Posted: Tue Apr 27, 2021 11:54 am
by Tinus
And since my sensor and the uarts both use interrupts they should both be on core 0?

Re: UART not working with today's version of micropython

Posted: Tue Apr 27, 2021 12:38 pm
by Roberthh
Yes. I would try that.

Re: UART not working with today's version of micropython

Posted: Tue Apr 27, 2021 7:53 pm
by Tinus
I tried starting my sensor interrupt handler from core_1 but found that the handler then runs on core_0 anyway.

So I guess that if I am running code on core_1 that sends data to the UART buffers the interrupts for those buffers run on core_0. Could that be what is messing up the memory?

Re: UART not working with today's version of micropython

Posted: Tue Apr 27, 2021 8:21 pm
by Roberthh
Thank you for raising that question. That brought me to change my test. The problem with duplicate characters being sent disappears if the instantiation of the UART is made in the thread that finally uses the UART. So if you move the UARt set-up to core1 as well, then the problem may be gone.

P.S.: The freezing of the device caused by memory corruption still exists. That's a problem in garbage collect.