CTI on LPC55S06 for Modbus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CTI on LPC55S06 for Modbus

432 Views
smitz96
Junior Contributor III

Hi NXP Community,

I am implementing a Modbus RTU Slave on the LPC55S06. According to the Modbus specification, I need to detect a 3.5 character silent interval to signal the End of Frame (EOF).

I want to avoid generating an interrupt for every received byte to reset a software timer, as this is too CPU-intensive at high baud rates. I noticed the Flexcomm USART on this device does not have a dedicated "Character Timeout Interrupt" (CTI) that can be set to a specific character-width threshold (like 3.5).

  1. Is there a hidden hardware feature in the Flexcomm USART or FIFO to trigger an interrupt after a programmable period of RX inactivity?

  2. If not, what is the recommended "low-overhead" way to use DMA + CTIMER to detect the 3.5 char gap?

Any example code or application notes for the LPC55xx family regarding this would be greatly appreciated.

Labels (1)
0 Kudos
Reply
1 Reply

333 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @smitz96 

No — the Flexcomm USART on LPC55S06 does not contain any hardware "character timeout" or programmable RX‑idle interrupt.

I think you can use USART + DMA + CTIMER  for RX‑idle detection.

USART RX DMA continuously moves data from FIFO into a circular buffer.

CTIMER  generates interrupt when no data arrives.

You configure a timer for 3.5 character times.
On every RX DMA event, you restart the CTIMER
If timer expires, it means:
No bytes for 3.5 chars   Modbus frame end detected (EOF).
 
BR
Harry
 
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2321916%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ECTI%20on%20LPC55S06%20for%20Modbus%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2321916%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20NXP%20Community%2C%3C%2FP%3E%3CP%3EI%20am%20implementing%20a%20Modbus%20RTU%20Slave%20on%20the%20LPC55S06.%20According%20to%20the%20Modbus%20specification%2C%20I%20need%20to%20detect%20a%203.5%20character%20silent%20interval%20to%20signal%20the%20End%20of%20Frame%20(EOF).%3C%2FP%3E%3CP%3EI%20want%20to%20avoid%20generating%20an%20interrupt%20for%20every%20received%20byte%20to%20reset%20a%20software%20timer%2C%20as%20this%20is%20too%20CPU-intensive%20at%20high%20baud%20rates.%20I%20noticed%20the%20Flexcomm%20USART%20on%20this%20device%20does%20not%20have%20a%20dedicated%20%22Character%20Timeout%20Interrupt%22%20(CTI)%20that%20can%20be%20set%20to%20a%20specific%20character-width%20threshold%20(like%203.5).%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3EIs%20there%20a%20hidden%20hardware%20feature%20in%20the%20Flexcomm%20USART%20or%20FIFO%20to%20trigger%20an%20interrupt%20after%20a%20programmable%20period%20of%20RX%20inactivity%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EIf%20not%2C%20what%20is%20the%20recommended%20%22low-overhead%22%20way%20to%20use%20DMA%20%2B%20CTIMER%20to%20detect%20the%203.5%20char%20gap%3F%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EAny%20example%20code%20or%20application%20notes%20for%20the%20LPC55xx%20family%20regarding%20this%20would%20be%20greatly%20appreciated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2321916%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3ELPC55xx%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2326081%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CTI%20on%20LPC55S06%20for%20Modbus%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2326081%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F260168%22%20target%3D%22_blank%22%3E%40smitz96%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENo%20%E2%80%94%20the%20Flexcomm%20USART%20on%20LPC55S06%20does%20not%20contain%20any%20hardware%20%22character%20timeout%22%20or%20programmable%20RX%E2%80%91idle%20interrupt.%3C%2FP%3E%0A%3CP%3EI%20think%20you%20can%20use%26nbsp%3BUSART%20%2B%20DMA%20%2B%20CTIMER%26nbsp%3B%20for%20RX%E2%80%91idle%20detection.%3C%2FP%3E%0A%3CP%3EUSART%20RX%20DMA%20continuously%20moves%20data%20from%20FIFO%20into%20a%20circular%20buffer.%3C%2FP%3E%0A%3CP%3ECTIMER%26nbsp%3B%20generates%20interrupt%20when%20no%20data%20arrives.%3C%2FP%3E%0A%3CDIV%3EYou%20configure%20a%20timer%20for%203.5%20character%20times.%3C%2FDIV%3E%0A%3CDIV%3EOn%20every%20RX%20DMA%20event%2C%20you%20restart%20the%20CTIMER%3CBR%20%2F%3EIf%20timer%20expires%2C%20it%20means%3A%3CBR%20%2F%3ENo%20bytes%20for%203.5%20chars%26nbsp%3B%20%26nbsp%3BModbus%20frame%20end%20detected%20(EOF).%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EBR%3C%2FDIV%3E%0A%3CDIV%3EHarry%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E