Hi,
I have an application that runs a state machine in a loop.
I want to soft reset the chip based on UART command from a terminal asynchronously.
How can I do that?
Thanks
Karthik
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello Karthik,
I hope you are well. You could setup a separate task to asynchronously do your desired functions. Then call "SysCtrlSystemReset();" as needed to reset the device as discussed in this other thread:
https://e2e.ti.com/f/1/t/1302200/
Thanks,
Alex F
Hello Karthik,
Our SimpleLink Academy should have what you need to get started (POSIX Project Zero (ti.com)).
Thanks,
Alex F
Hi Alex,
I have gone through the document.
The mainthread has UART initialized in blocking mode. There is a super loop within which uart_read is called. That function is blocked until it receives an external input.
What I wanted is different from this.
There is a mainthread in which user input is taken via UART(the UART reads in blocking mode) entering into the state machine. Subsequently, the state machine runs in a loop and there are no more UART reads within it.
How do I modify the whole application to make sure that UART commands from terminal are received without the code getting blocked.
Thanks
Karthik
Hello Karthik,
You can try to modify the uart2 parameter, with "UART2_Mode_NONBLOCKING" (from UART2.h file).
In #UART2_Mode_NONBLOCKING, %UART2_read() will return the minimum
of size bytes and the number of bytes in the RX circular buffer.
n this mode, the application should check the number of bytes
returned in the bytesRead parameter
Thanks,
Alex F
Hi Alex,
This doesn't work. In this case too uart_read is called in a loop. So, doesn't really look asynchronous.
Isn't there a simple mechanism to configure UART interrupts and the logic can be handled in the interrupt service routine?
Thanks
Karthik
Hello Karthik,
UART2 callback mode is non-blocking, it will enable the UART RX input GPIO, and if bytes are received then the "readCallback" will be called in an interrupt context. In UART_Params, there should be something called "readMode" and "readCallback" for you to use.
Thanks,
Alex F