Irda communication stopps working after sending too many bytes
Hi There,
I use a Stm32l072 (to be exactly, the CMWX1ZZABZ Lora module) with a infrared receiver. The Protocol is Irda Sir with the following specs:
- 1152000 Baud
- 8 Bit Data
- No Parity
To test it, i wrote a simple CubeMx programm that receives correct data once:
// MAIN
// ...
// other init stuff here
hirda1.Instance = USART1;
hirda1.Init.BaudRate = 115200;
hirda1.Init.WordLength = IRDA_WORDLENGTH_8B;
hirda1.Init.Parity = IRDA_PARITY_NONE;
hirda1.Init.Mode = IRDA_MODE_TX_RX;
hirda1.Init.Prescaler = 1;
hirda1.Init.PowerMode = IRDA_POWERMODE_NORMAL;
if (HAL_IRDA_Init(&hirda1) != HAL_OK)
{
Error_Handler();
}
__HAL_IRDA_ENABLE(&hirda1);
while (1)
{
HAL_StatusTypeDef rc;
uint8_t irdaBuffer[200] = {0};
rc = HAL_IRDA_Receive(&hirda1,irdaBuffer,3,1000*5);
if(rc==HAL_OK)
{
HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_RESET);
}
}The problem:
When sending 3Bytes over Irda, it works fine. When sending >3Byte, the first three are correctly received but the following do never appear and the "HAL_IRDA_Receive" wont work anymore. I would assume i should receive the following Bytes as soon as i call "HAL_IRDA_Receive" again, until the Rx buffer is empty? Or did i miss a step? With the DMA it shows the same behavior.
Thanks for help