This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTS/CTS flow control via GPIO example code?

Other Parts Discussed in Thread: CC2540

Hello,

can someone please share an example on how to properly implement RTS/CTS flow control via GPIO? I need to connect to a CC2540 using RTS/CTS flow control and my CC430 USART doesn't have this functionality.

Thanks,

-r

  • RTS/CTS handshaking a commonly used non-standard symmetric abuse of the original RS-232 RTS/CTS asymmetric flow control. Originally, the terminal was requesting to send (RTS) to the data communicaiton device, which in turn responded that it is clear to send when data could be accepted. This assumed a terminal/modem combo, not a device/device connection.

    Handshaking with RTS/CTS, however, uses a symmetric signalling where both sides signal their readyness to accept data.
    Physically, RTS and CTS are simply crossed, like RxD and TxD are crossed signals. RS232-D has relabeled RTS to RTR (ready to receive)

    How to implement it per GPIO is not as simple as one might think. The send function must check the RTR signal before sending a byte. If the send function is an ISR, it must stop sending and disable the interrupt. However, to re-enable it later transparently, RTR should be able to trigger a port pin interrupt, so if it is asserted again, the por tpin ISR can re-enable the TX interrupt.
    The receive function, on the ohter hand, must set the CTS output to show that it is ready to receive data or not. But since at least one, but up to two bytes may still be received after CTS has been de-asserted, a sufficient buffer needs to be implemented. De-asserting CTS when the input buffer is full is too late.

    CTS is a simple GPIO pin without any specific requirements.

    of course both, RTR and CTS, need to be passed through a proper level shifter if connected to a PCs COM port. Like RxD and TxD do.

  • Hello Pix,

    We are also working on similar configuration. Interfacing CC2540 with MSP430 via UART with flow control(RTS and CTS). 

    did you succeeded in   "RTS/CTS flow control via GPIO" . please share me example code for RTS/CTS flow control via GPIO on MSP430 side.


    Thanks and Best Regards,

    Naveen Kumar

  • i never got this to work reliably and am using SPI now instead. works like a charm.

  • Hi Pix,

    Thank you for quick reply.

    By the way which example you are using CC2540 side for SPI. is it Simple BLE Peripheral with serial interface??

    Best Regards,

    Naveen

**Attention** This is a public forum