当前位置:网站首页>CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)

CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)

2022-06-25 23:27:00 Guistar~~

       Serial port flow control , As the name suggests, it means flow control . The purpose is to coordinate the sending and receiving parties , So that data is not lost .

 

One . Hardware introduction :

       This picture is MCU And serial port module communication hardware , Where the arrow direction asks the output direction

 Insert picture description here

Two . Pin Introduction

RTS:(Request To Send Request to send )

Modular RTS It's for mcu Say you're ready , Low level , If the module is not ready ,MCU Send data to the module , You may lose your bag

CTS:(Clear To Send Clear send , Allow to send )

Modular cts Must be external mcu To low level , Module can send data ,

RXD: (Receive Data receive data )

receive data

TXD:( Transmit Data send data )

send data

 
 

3、 ... and . give an example

      With xinchida technology ND04(C)NRF52832/10 Module as an example

hardware component :
Only... Is used for transparent transmission GND、VCC、RTS、TX、CTS、RX These six Pin foot , Module and MCU Connect
 Insert picture description here

MCU Programming reference

      Programming ideas

  1. Module and MCU The serial port between is controlled by hardware flow CTS、RTS Two IO Port to send and receive notification and control .
  2. these two items. IO Normal high , Set low to trigger .
  3. When the module can receive data , The module will be set to lower the local RTS(MCU by CTS) Signal to MCU Can send data .
  4. When MCU When data can be received ,MCU To lower its RTS( The module is CTS) The signal notification module can send data

Reference code ( Provide ideas )

void main(void){
    
 	// wait for BLE Module started successfully , Xinchida module ND04X, Print from the serial port of the computer DEVICE_START
 	while(!memcmp(rx_ble_mode_data(),"DEVICE_START\r\n",strlen("DEVICE_START\r\n")));
 	// Can make RTS, namely MCU Acceptable BLE Data sent by the module 
    set_rts_enable();
while(1){
    
	// obtain CTS Whether the status changes to low level 
	if(get_cts_state()==0){
    
	// Send test data to BLE modular 
		mcu_send_to_ble_string("Testdata.\r\n");
	}
	// Handle MCU Acquired data 
	mcu_data_process(mcu_uart_read_data());
}
}

The knowledge card is over ~ Serial port flow control RTS CTS RX TX I don't understand ?

If you need Bluetooth (BLE) module

Xinchida technology 【Vivi】
contact number :13510534054 ( WeChat )/17806715121

Here is our company NORIDC Series Bluetooth modules include :NRF52832 52810 etc.

 Insert picture description here
More information plus v Or the official website :
https://www.szrfstar.com/

原网站

版权声明
本文为[Guistar~~]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180603101899.html