Skip to main content
xleij
Associate II
Aug 22, 2018 6:59 AM UTC
Solved

any method to modify uart idle detection time

Hi guys,

I use uart idle interrupt to handle BLE passthrough, but because ble module don't buffer data received from ble,if the baudrate is 115200bps, there will be some gaps within one packet(it should be uart transfer rate is higher than ble rate), for example there will be 8 gaps within one 14 bytes packets. Our host will have more high priority task to do, so I can't accept so many interrupts to handle one packet. So any method to increase uart idle detection time.

If I don't use uart idle interrupt, I will have to  align the packet size to a multiple of a fixed size.

this is not what I want, though this works.

    This topic has been closed for replies.
    Bob S
    Bob SBest answer
    Super User
    Aug 23, 2018 2:14 PM UTC

    Do you have a spare timer (that has trigger inputs)? If so, you can run the serial RX signal to one of the timer inputs. Configure the timer in up-counting mode and have the trigger input reset the counter (on falling or rising edge, doesn't matter). Set the compare register for a time period longer than the intra-character pauses from your BLE module so the counter only hits the compare value when there really is not more data from the BLE. Then interrupt on the timer compare for "end of message".

    5 replies

    xleij
    xleijAuthor
    Associate II
    Aug 23, 2018 1:39 AM UTC

    any suggestions?

    T J
    Senior III
    Aug 23, 2018 3:08 AM UTC

    If you run a resistor Parallel with a diode from the Rx pin to a cap, and then take the cap voltage into a comparitor pin. interrupt on the rising edge.

    if you consider worst case "0xff" then the startbit saves us.

    I can draw a diagram if you want..

    Bob S
    Bob SBest answer
    Super User
    Aug 23, 2018 2:14 PM UTC

    Do you have a spare timer (that has trigger inputs)? If so, you can run the serial RX signal to one of the timer inputs. Configure the timer in up-counting mode and have the trigger input reset the counter (on falling or rising edge, doesn't matter). Set the compare register for a time period longer than the intra-character pauses from your BLE module so the counter only hits the compare value when there really is not more data from the BLE. Then interrupt on the timer compare for "end of message".

    xleij
    xleijAuthor
    Associate II
    Aug 24, 2018 5:18 AM UTC

    seems ​feasible. Thanks you two. I will have a try.

    xleij
    xleijAuthor
    Associate II
    Aug 24, 2018 5:20 AM UTC

    how to comment on someone's reply? @Bob S​ @Community member​