UART
最終更新
最終更新
Two UART hardware channels are available for the TWELITE wireless microcontroller. Each of these UART ports has a hardware FIFO buffer of 16 bytes.
SERIAL library (serial.c and uart.c) is the standard method for processing in TWELITE NET, which handles UART interrupts and provides an API for I/O procedures using FIFO memory allocated in the microcontroller.
We store the initialization parameters in the structure and call the function. Here we need to statically allocate a memory area for the FIFO buffer to be used for serial data input and output.
We also provide a structure for output.
The output process may be unstable immediately after initialisation when the system starts or when it returns to sleep. If there is a problem with the operation, please wait some time before outputting.
The following is an example of outputting packet information when receiving a wireless packet.
Waiting for output to complete may cause instability. In this case, remove this waiting process and check the operation.
If the waiting process is omitted and the output is interrupted, an extra FIFO memory is allocated for the output.
When there is an input, data is put into the FIFO memory registered at the time of initialization in the library. This data is read by SERIAL_bRxQueueEmpty()
and SEREAL_i16RxChar()
.
Use or for output. The parameter is a pointer to the tsFILE structure.
If you want to wait for the output to complete, such as when all the output is done and then goes to sleep, you can call the function. This function will block until the output queue is empty.
This process is described in the process.。