RN42 Bluetooth + PIC 18F - hardware flow control RTS/CTS

Discussion in 'Embedded Systems and Microcontrollers' started by atferrari, Nov 14, 2015.

  1. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    2,647
    759
    I intend to control an RN42 Bluetooth module with a 18F PIC micro expecting to receive big chunks of data from the RN42 / send big chunks of data to the RN42

    Regarding the RTS / CTS signals, please tell if I got this right whether the module is in "command" or "data" mode.

    Micro's RTS pin to be a permanent output going into the RN's CTS input.
    Micro's CTS pin to be a permanent input receiving the RN's RTS output.

    If the micro needs to process the data received up to now, has to output a high on its RTS pin so the RN stops.
    If the micro can receive data, has to output a low on its RTS pin so the RN can resume transmision.

    When the micro wants to transmit has to check if it gets a low on its own CTS pin.
    If the micro reads a high in it own CTS pin, it cannot transmit and has to keep checking until it gets a low to start again.

    Am I right?
     
    Last edited: Nov 14, 2015
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    989
    atferrari likes this.
  3. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    2,647
    759
    Sí SP. They are in the datasheet and explicitly mentioned in the description. After all it offers the option to work at a rate of 115 KB. I am sure the micro will throw the towel quite quickly.

    The suggested article seems to contradict what I posted, which in turn, was based just on this: the datasheet shows the RTS pin as OUT and CTS as IN.
     
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    989
    atferrari likes this.
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,510
    2,369
    RTS/CTS is the common way of controlling RS232 data flow, DCE/DTE is usually jumpered out now.
    Max.
     
    atferrari likes this.
  6. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    2,647
    759
    Thanks for your interest SP.

    I am afraid that I should have RTFM again for a fourth time. The excerpt seems to be enough to answer my question. :( :( :( My bad.


    Excerpt from datasheet.png


    Sorry.
     
  7. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    989
    Yeah if I recall CTS is the input that detects RTS from the other device,


    I don't think the EUSART peripheral allows for hardware flow control so you will have to roll your own.

    What are you going to do with all of this data? What is the speed of your mcu? What is the intended baud rate? If you can process it fast enough then you may not need to worry about flow control.
     
  8. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,510
    2,369
    If using the MAX232 there are enough IN/OUT to use as RTS/CTS.
    Max.
     
Loading...