You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hardware Flow control for serial communication #394
Hello,
I am using the STM32f103c series controller with GSM module. Sometimes Serial buffer of GSM is getting full and the communication is not happening as expected. During my search, I came across Hardware Flow control using RTS/CTS. As stm has dedicated H/W flow control pins [For UART 2 PA0:- CTS2 & PA1:-RTS2] is there any option available in board files to enable hardware flow control?
if yes please let me know how to enable it
if not then it would be really helpful if you can integrate this in next version.
If I well remember it is based on how MBed implement UART. And if I well remember, flow control is also implemented on MBed side. So this could be a good starting point.
. Does making the HwFlowCtl to UART_HWCONTROL_CTS or UART_HWCONTROL_RTS is all thats required ? I am not sure yet, testing it. But if it works, I'll add this configuration using macros and make it user configurable...
You can redefined them by adding a new file (Tab on Arduino IDE) named build_opt.h
Then in this file put: -DSERIAL_RX_BUFFER_SIZE=256 -DSERIAL_TX_BUFFER_SIZE=256
Increasing only one of both works also but I advise to keep them aligned.
@fpistm I am already using the BUFFER_SIZE =256.
the need for me to use hardware flow control is that the slave device SIM800c is lagging behind over time
When I searched for this issue I figured out this
Flow control is very important for correct communication between the GSM engine and DTE.
For in the case such as a data or fax call, the sending device is transferring data faster than the
receiving side is ready to accept. When the receiving buffer reaches its capacity, the receiving
device should be capable to cause the sending device to pause until it catches up
Activity
fpistm commentedon Dec 24, 2018
HW flow control is not implemented.
mayurharge commentedon Dec 24, 2018
Okay, thanks.
mayurharge commentedon Dec 24, 2018
Hey are you going to implement this feature in future, also please give me some suggestions to implement by myself
fpistm commentedon Dec 25, 2018
If I well remember it is based on how MBed implement UART. And if I well remember, flow control is also implemented on MBed side. So this could be a good starting point.
mayurharge commentedon Dec 25, 2018
Thanks i will look into it
fpistm commentedon Dec 26, 2018
@mayurharge
You could let this issue opened as a requested feature.
Do not hesitate to provide a PR if you get it up and running.
arihantdaga commentedon Dec 26, 2018
@fpistm I saw this line in cores/arduino/stm32/uart.c
Arduino_Core_STM32/cores/arduino/stm32/uart.c
Line 272 in 7b48eff
fpistm commentedon Dec 26, 2018
I guess you have also to init the RTS/CTS pin also.
fpistm commentedon Dec 26, 2018
Just a quick thought if the buffer is full.
By default , the Rx and Tx buffer of the core is 64.
Arduino_Core_STM32/cores/arduino/HardwareSerial.h
Line 42 in bad5b56
You can redefined them by adding a new file (Tab on Arduino IDE) named build_opt.h
Then in this file put:
-DSERIAL_RX_BUFFER_SIZE=256 -DSERIAL_TX_BUFFER_SIZE=256Increasing only one of both works also but I advise to keep them aligned.
mayurharge commentedon Dec 26, 2018
@fpistm I am already using the BUFFER_SIZE =256.
the need for me to use hardware flow control is that the slave device SIM800c is lagging behind over time
When I searched for this issue I figured out this
This was mentioned in the datasheet of SIM800.
benwaffle commentedon Mar 15, 2019
@mayurharge you can of course use the HAL manually for now by calling HAL_GPIO_* and HAL_UART_* functions
fpistm commentedon Jun 11, 2021
Added to [U(S)ART] request list #1418
fpistm commentedon Feb 5, 2022
Done thanks #1634