2022-07-27 03:13 AM
2022-07-28 12:29 AM
What exactly display_function do? I faced the same problem when I was doing some operation before enabling the IDLE interrupt again. I resolved by just coping the received data to Main buffer and then enable the interrupt and then call your display function. In your case,
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if(huart->Instance == USART1)
{ // Check if it is an "Idle Interrupt"
__HAL_UART_CLEAR_IDLEFLAG(&huart1);
memcpy(MainBuf,RxBuf,Size);
}
__HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE);
HAL_UARTEx_ReceiveToIdle_DMA(&huart1,RxBuf,RxBuf_SIZE);
__HAL_DMA_DISABLE_IT(&hdma_usart1_rx,DMA_IT_HT);
display_function(MainBuf); // Pass the Size too here. if it is zero then just return.
}
2022-07-27 04:24 AM
You need to give full details of what, exactly, you're doing and how & when you are observing this.
What debugging/investigation have you done to find the cause?
which particular STM32 are you using? Is it on a devboard, or something custom?
2022-07-27 09:18 PM
I am using custom board with controller with part number given below
2022-07-27 10:29 PM
as i am using stm32f030cct6 in my custom board, in this two controllers are used with same part number.
controller1 send the data in chunks with different sizes through UART, controller2 receive data through UART from controller1. because of different chunk sizes i used UART in DMA mode with IDLE line detection for proper data reception.
the code is given below for data reception is working
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if(huart->Instance == USART1)
{ // Check if it is an "Idle Interrupt"
__HAL_UART_CLEAR_IDLEFLAG(&huart1);
memcpy(MainBuf,RxBuf,Size);
display_function(MainBuf);
}
__HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE);
HAL_UARTEx_ReceiveToIdle_DMA(&huart1,RxBuf,RxBuf_SIZE);
__HAL_DMA_DISABLE_IT(&hdma_usart1_rx,DMA_IT_HT);
}
above code i used for data reception from controller1 to controller2.
controller1 continuously transmit data to controller2.
some time even controller1 transmit data controller2 not responding
while debugging i checked there is no updata in RxBuf
if i reset the controller2 again it continue receiveing
baudrate used is 19200 for UART communication
i didnt understand the problem
please help me to tackle this issue
2022-07-28 12:23 AM
You've forgotten already how to post source code?
@SSRIN.2 "if i reset the controller2 again it continue receiveing"
So something is getting disabled?
Check register settings when the problem occurs ...
2022-07-28 12:29 AM
What exactly display_function do? I faced the same problem when I was doing some operation before enabling the IDLE interrupt again. I resolved by just coping the received data to Main buffer and then enable the interrupt and then call your display function. In your case,
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if(huart->Instance == USART1)
{ // Check if it is an "Idle Interrupt"
__HAL_UART_CLEAR_IDLEFLAG(&huart1);
memcpy(MainBuf,RxBuf,Size);
}
__HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE);
HAL_UARTEx_ReceiveToIdle_DMA(&huart1,RxBuf,RxBuf_SIZE);
__HAL_DMA_DISABLE_IT(&hdma_usart1_rx,DMA_IT_HT);
display_function(MainBuf); // Pass the Size too here. if it is zero then just return.
}
2022-07-28 01:30 AM
can the DMA be set to toggle between two buffers - then you wouldn't even need the copy...?
2022-08-02 03:35 AM
can any one help me
how to do button long press interrupt in stm32.
2022-08-02 05:26 AM
Yes it can be done. I tried to do that but somehow it didn't work. May be I am doing something wrong. If you made it work, can you please share the configuration or code snippet? It would save a unnecessary copy.
2022-08-03 09:32 PM
hi sir,
could you please help me to do button long press and short press interrupt in stm32