Is there a way of detecting / interrupting at the end of a contiguous set of UART frames?

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way of detecting / interrupting at the end of a contiguous set of UART frames?

Jump to solution
299 Views
minibix
Contributor II

I'm using the K64F, MCUXpresso SDK and FreeRTOS.

I'm receiving variable length messages from another device on a UART, these messages are made up of UART frames (8 bits, 1 stop bit). Each message may be made up of 3 - 50 UART frames.

In each message, the UART frames are basically contiguous and there is a significant idle delay (20ms) between all messages.

I'm wondering if there is a hardware level feature / interrupt or SDK API which allows me to easily detect a single message / the end of a message (or when there are no UART frames being received i.e. idle)?

I can then return an array of bytes which represents that message only.

There is no way to determine the end of the message by it's last byte as it is essentially random in nature.

0 Kudos
1 Solution
124 Views
mjbcswitzerland
Specialist V

Mike


All UARTs in the K64 have idle line interrupts. It is programmable to 10, 11 or 12 bits at '1', which is quite short, but if you are sure that the messages have no short inter-character pauses it would work.

For longer pause detection a method such as that used by Modbus RTU framing is suitable and can be programmed to any idle period. See page 27 of http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF for an explanation of the operation.

Note that the uTasker developer's version contains MODBUS ASCII/RTU on up to 6 UARTs using this technique and integrates all methods needed to work as a native uTasker or FreeRTOS project (also for general UART use as well as Modbus RTU).

Regards

Mark


Kinetis: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

View solution in original post

2 Replies
125 Views
mjbcswitzerland
Specialist V

Mike


All UARTs in the K64 have idle line interrupts. It is programmable to 10, 11 or 12 bits at '1', which is quite short, but if you are sure that the messages have no short inter-character pauses it would work.

For longer pause detection a method such as that used by Modbus RTU framing is suitable and can be programmed to any idle period. See page 27 of http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF for an explanation of the operation.

Note that the uTasker developer's version contains MODBUS ASCII/RTU on up to 6 UARTs using this technique and integrates all methods needed to work as a native uTasker or FreeRTOS project (also for general UART use as well as Modbus RTU).

Regards

Mark


Kinetis: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

View solution in original post

124 Views
minibix
Contributor II

Perfect, thanks!

0 Kudos