Two Serial ports with HAL_UARTEx_RxEventCallback don't work for me
Hi everybody:
First post here.
I'm working with a GPS parser that re-sends data to another board, and receives some feedback from this other obard.
BTW, both perform GPS parsing, with the same algos.
One is Feather STM32F407 (the one with the problem) and the other is Nucleo STM32F439 that is also a UDP server/broadcaster.
The issue is that the first one uses USART 3 to interface to a GPS (in this case, TESEO3), and USART 6 to re send the NMEA sentence.
In both cases, I'm using the DMA receive to IDLE, since in both cases data stream is continuous.
The issue, is that the HAL_UARTEx_RxEventCallback only seems to work with ONE of the serial ports. If I use only one, then it works fine with whatever port is being used, but I find no way to use both.
The code of the callback is:
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if (huart->Instance == USART3)
{
//Data received from GPS. Send it by remote link to Tracker
if (DataToParse == 0) DataToParse = 1;
else return;
HAL_UARTEx_ReceiveToIdle_DMA(&huart3,(unsigned char*)NMEABuff,4096);
//HAL_UART_Transmit_DMA(&huart6,(unsigned char*)NMEABuff, Size);
//ParseGPS(NMEABuff,Size,&GPSData);
//Send data received by USB to debug link
SizeToParse = Size;
//CDC_Transmit_FS((unsigned char*)NMEABuff, Size);
}
if (huart->Instance == USART6)
{
//DataToParse = 1;
HAL_UARTEx_ReceiveToIdle_DMA(&huart6,(unsigned char*)Buff,255);
//Data received by remote link, thus info about contro --> Send to Pilot
}
}
Attached you can find both .ioc.
Any hint about the reason?
Thanks in advance,
Beamspot.
