Engee documentation

BA-IS-XX UART-RX

Page in progress.

Data reception via UART with usage of the RITMeX BA-IS-XX I/O module.

uart rx ru

Description

The block is used to receive data via UART with usage of the RITMeX BA-IS-XX I/O module.

Ports

Output

RX -. array (data type UInt8) received via UART
vector

Details

The size of the array is fixed and is 16 (for more details see section Notes on usage).

Length - information on the number of bytes received on the UART per calculation step
scalar

Overrun - a non-zero value on this output means that external data is coming in faster than the block is reading it.
scalar

Details

For more details, see Notes on usage.

Parameters

Module number - unique module identification
1 (by default) | 2 | 3 | 4 | 5 | 6 | 7 | 8

Details

Used to uniquely identify a module when more than one I/O module of the same type is installed in a real-time machine.

Module numbers are signed on the housing of the RITM.

Channel number - UART channel for receiving
1 (By default) | 2` | 3` | 4` | 5` | 6` | 7` | 8` | 9` | 10` | 11` | 12` | 13` | 14` | 15`` | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32

Max. number of words - number of words read from the UART buffer per calculation step
`1 (By default).

Calculation Step - calculation step in seconds, by which data is received via UART in the real-time application
`-1 (By default).

Notes on usage

Detailed notes on usage

The UART module on the FPGA contains two hardware buffers: for receiving and sending. The size of each buffer is 16 bytes. It is therefore necessary to have a good understanding of the characteristics of the particular UART communication protocol to avoid overflowing these buffers, and to ensure that the previous message is sent before attempting to send the next.

The first thing to consider is the data rate. Obviously, data over the UART is not transmitted instantaneously. Suppose, for example, you want to send an array of 16 characters (each character consists of 10 bits - that’s 8 data bits, start and stop bits) at a rate of 115200 baud. This will take seconds to complete. If the UART Send block runs in 0.001 s increments, the data will not have time to be sent before the next block calculation step because 0.001 < 0.0014. Therefore, the next array of symbols cannot be sent and in such a situation, the execution of the model will stop with an error. It is required to find such a combination of block calculation step, baud rate and array size that it is physically possible to send this data in one block calculation step.

*The second thing to consider is the size of the hardware buffer on receive. If data from outside comes in faster than the BA-IS-XX UART-TX block reads it from the hardware buffer, new data that does not fit in the receive buffer is discarded. Thus, it is necessary to take into account and calculate the expected time to fill the read buffer with an external data stream.

For this purpose, you can be guided by the values at the outputs Length and Overrun block BA-IS-XX UART-TX. In calculations within the model should take into account exactly as many elements at the output RX block, how many were actually received (output Length). The values of all other elements of the RX array are not defined.

If a non-zero value is output at the Overrun block output, it means that the hardware buffer has overflowed and the data in the hardware receive buffer has been lost. In this case, the calculation step of the BA-IS-XX UART-TX block can be reduced in order to read data more frequently and thus avoid overflowing the receive buffer. Too small calculation step for the block BA-IS-XX UART-TX, also should not be set, but should be guided by the specific exchange protocol. For example, if it is known that the external device sends commands of 8 bytes, it is possible to select such a step of calculation of the block that the value of the output Length is approximately equal to 8 from step to step calculation.