2014-09-03 09:42 AM
Hello everyone, I was wondering how to turn of the UART Interrupt, I am using HAL_UART_Receive_IT to receive incoming characters on the serial port. periodically I want to take over the port and control it manually, is there a way to stop IT function once it is waiting?
I have tried: __HAL_LOCK(&huart1); __HAL_UART_DISABLE_IT(&huart1, UART_IT_PE); __HAL_UART_DISABLE_IT(&huart1, UART_IT_ERR); __HAL_UNLOCK(&huart1); __HAL_UART_DISABLE_IT(&huart1, UART_IT_RXNE);Thanks in advance,George2014-09-04 05:12 AM
I have tried:
And what was the result?2014-09-04 05:42 AM
Hi Neil,
The result ends up being that I don't receive characters from the uart after that point either through the interrupt or manually and trying to put the device back into interrupt mode errors. I could probably try to reset the device and put it in manual mode that would probably work, I was just figuring there was some way to do it seamlessly. I would guess that there are some NVIC calls that may need to be made in addition to the uart calls to cancel the pending interrupt on the uart? The issue is that I am reading a cellular chipset so I have the uart setup in interrupt mode processing one character at a time, because the chipset will send messages when a call comes in or a sms message etc. When I want to send an sms message or http request I would like to stop the interrupt and control the port manually.2014-09-04 10:21 AM
''trying to put the device back into interrupt mode errors''
And what does that mean, exactly?''When I want to send an sms message or http request I would like to stop the interrupt and control the port manually''Why??2014-09-05 07:19 AM
Hi Neil,
During normal operation the uart is in interrupt mode pulling a character at a time building a string waiting for the carriage return then ships the string to the processor. During http requests i would like to break out of that mode so that I can read the bytes form the web manually, such as using the hal_receive 100 bytes of data at a time until all the data is downloaded.Thanks,George2014-09-09 01:34 AM
Hi George,
You can use the macro __HAL_UART_DISABLE_IT(), in order to stop the HAL_UART_Receive_IT() process.Regards.2015-02-02 08:43 PM