I wrote a code below referring the MSDK sample UART code. The code below is not original but is conceptual one.
/* ADC reading continues until any key is pressed */
UART_INT_FLAG = 1; // Int handler clears this
MXC_UART_TransactionAsync(&read_req);
do {
adc_value = ADC_ConversionRegisterRead(); // SPI coomunication
MXC_UART_AsyncStop(); // Added this second
MXC_UART_Transaction(adc_value);
MXC_UART_TransactionAsync(&read_req); // Added this first
} while (UART_INT_FLAG == 1);
What I want to do is stop ADC reading when any key is pressed on terminal software.
MXC_UART_TransactionAsync(&read_req) itself is working at the other part in my code but in this code, it doesn't. UART_INT_FLAG doesn't go to 0.
The MXC_UART_TransactionAsync() is running until any key will be pressed and during its waiting loop, MXC_UART_Transaction() -- blocking function -- is executed.
It seems the MXC_UART_Transaction clears the TransactionAsync's interrupt setting or waiting condition (???, not yet confirmed).
I added two lines (bold). First is to execute TransactionAsync() again but it returns E_BUSY (-6). So I added MXC_UART_AsyncStop() before the MXC_UART_Transaction but still doesn't work.
Even these added two lines work, there is a period that INT is disabled. MXC_UART_Transaction() takes long executing time because it is blocking serial communication so possibility to lost a received character is very high.
Is there any way (or code/API) to enable this? Best case is TransactionAsync's operation is not affected by the other codes.
Please advise.
By the way, my SPI problem last I posted solved writing low level code.
Regards,
Satoru