Dear @TMuka.1
First, reading your code, my understanding is that if you receive more than 32 bytes different from 13, rx_index might become > 32 and then your callback will write data outside of the allocated RxData buffer. Maybe you should protect from this case to happen.
More over, just for information, ST now provides new HAL UART API in order to manage "continuous" reception or reception of unknown length (which is usually the reason for using HAL_UART_Receive_IT() with expected rx length value = 1). It is based on reception going till either expected length is received OR IDLE event occurs. It is available either in Interrupt or DMA modes.
For example, a use case could be based on HAL_UARTEx_ReceiveToIdle_DMA() API with DMA configured in Circular mode, that allows to have continuous reception and user callback executed as soon as either buffers are filled or Idle event occurs (pause in the transmission, i.e. enough time elapses after last received char) to retrieve data.
This callback will be executed when any of following events occurs :
- HT (Half Transfer) : Half of Rx buffer is filled)
- TC (Transfer Complete) : Rx buffer is full.
(In case of Circular DMA, reception could go on, and next reception data will be stored in index 0 of reception buffer by DMA).
- Idle Event on Rx line : Triggered when RX line has been in idle state (normally high state) for 1 frame time, after last received byte.
Usually, FW package contains a UART example highlighting such use case (example name UART_ReceptionToIdle_CircularDMA), with an example of callback implementation for retrieving all received data.
A usage example is provided in some recent STM32 Cube packages (I don't know if example is available on L1), illustrating use on this new API with a Circular DMA implementation (I think it could be found (for reference) in STM32 Cube package for G0/G4/L5, ... series under the name Examples\UART\UART_ReceptionToIdle_CircularDMA). Maybe it could help you.
Please have a look to this example to confirm it could address your needs.
Regards