2021-09-24 08:04 AM
Hi,
Am working on a STM32F745VG micro controller and i want to use multiple uart using dma.
Majorly facing issue at the reception side.When i try to receive data from uart 1 sometimes my uart 2 also receive the same data.Even though their handler are different.
Even at the time of generating code from cubemx dma is in normal mode for both the uart. and steam and channel are different but still are they both are conflicting.
The callback of reception am using is
"HAL_UARTEx_ReceiveToIdle_DMA"
To generate interrupt only at one time at reception and then it goes to event callback.
"HAL_UARTEx_RxEventCallback"
STM32F745VG Support 2 DMA line with different steam and channel fro uart but still giving a problem
Any suggestion how to fix it..?
2021-09-24 11:11 AM
Sounds like a bug in your software. Unlikely the independent UART peripherals are somehow sharing information. Why specifically do you think one is receiving the wrong data? Where in your code do you make this determination?
2021-09-24 02:28 PM
HAL_UARTEx_ReceiveToIdle_DMA uses a buffer in memory.
Check that different U(S)ART instances don't run on same buffer.
2021-09-24 10:46 PM
If you flow data between the usarts, you may need to implement a sw tx/rx fifo as maynot be in sync.
2021-09-25 12:35 PM
Hi
I have attached the instance of usart in the callback. and interup call in int main.
Also i have attached usart.c for your reference.
Int main()
{
HAL_UARTEx_ReceiveToIdle_DMA(&huart1, (uint8_t *) master_receiveBuffer1, 15);
HAL_UARTEx_ReceiveToIdle_DMA(&huart6, (uint8_t *) master_receiveBuffer3temp, 15);
HAL_UARTEx_ReceiveToIdle_DMA(&huart4, (uint8_t *) master_receiveBuffer4temp, 15);
HAL_UARTEx_ReceiveToIdle_DMA(&huart7, (uint8_t *) master_receiveBuffer6, 15);
}
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
UNUSED(huart);
if(huart==&huart6){
HAL_UARTEx_ReceiveToIdle_IT(&huart6, (uint8_t *) master_receiveBuffer3temp, 15);
}
if(huart==&huart1){
HAL_UARTEx_ReceiveToIdle_DMA(&huart1, (uint8_t *) master_receiveBuffer1, 15);
}
if(huart==&huart4){
HAL_UARTEx_ReceiveToIdle_IT(&huart4, (uint8_t *) master_receiveBuffer4temp, 15);
}
if(huart==&huart7){
HAL_UARTEx_ReceiveToIdle_DMA(&huart6, (uint8_t *) master_receiveBuffer6, 15);
}
}
Thanks in advance
2021-09-25 12:37 PM
Hi
I dont think fifo is required for this task.
For your reference i have attached code and usart.c file. If you find anything please let me know.
2021-09-25 12:39 PM
HI
STM32F745VGT6 has 2 DMA. Possible if they have same channel then it might be an issue for same memory buffer. But here channel is different and steam is also different.It should not conflict as per my understanding.
I have attached some code and usart source file.If any input please let me know.
Thanks