[nRF] UART Reinitialization

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
User avatar
dbrazil
Posts: 14
Joined: Mon Apr 26, 2021 5:52 pm

[nRF] UART Reinitialization

Post by dbrazil » Wed May 12, 2021 5:45 pm

Hi,

I'm using MicroPython in a nRF52840 (PCA10056) µC that I constantly use the serial UART to talk to a peripheral.

After a serial command that restarts the peripheral, the UART works to write commands, but not to read anymore (ser.readchar()).
The peripheral's UART seems to be working because whichever serial command I send from the µC, the peripheral reacts on it.

To solve this UART reading problem, the only thing that works is to reset the µC (not the peripheral) by doing machine.reset(); then I can write and read normally using the UART interface. The MicroPython nRF ports unfortunately don't have the method UART.deinit(), which some other ports do.

What does the machine.reset() does to the UART that 'reinitializes' it and brings it back to this good state?

Thanks

Post Reply