Other Parts Discussed in Thread: HALCOGEN
Purpose: get IRQ after the SCI/LIN RX line has been idle for example the length of say 3-4 characters (so doesn't matter is timer start point start-bit or last data bit). IRQ is used to gather data (practically 1 whole message) from ring buffer which DMA has been filled. Using this IRQ would give much faster reaction to arrived message (which length is unknown) than just periodically polling (other wise periodic polling rate should be really fast) the DMA status that how many bytes has been received.
Assumptions: SCI/LIN RX pin needs to routed/splitted also to some other CPU pin in order to read the pin state changes while SCI driver reads the actual data.
Requirements: when falling (or raising edge) is detected (for example start-bit) timer shall be started if not yet started & reseted if already running, when configured time has been elapsed (to support baudrate change) from last falling (or raising edge) the IRQ is generated ONCE. Supported baudrates from 9600 to ~2M meaning that timer shall be able to count from ~3*5us=15us to 3*1ms=3ms. If baudrate scale is too wide, then lower speeds can be left out but 0,5M-2M speeds should be at least supported resulting in microseconds scale.
This looks to be doable with N2HET but is there any simpler way to do it since the functionality itself is quite simple, eCAP etc.? Basically if line changes state, just start&reset timer and when given count is reached then signal IRQ & stop the timer. Tried to look through the technical manual but cannot be sure except from N2HET.
N2HET:
- use N2HET assembler to generate the code (makes also .c &.h files which can be given to HALCoGen to get init code or copy content manually to HET memory)
- some simulator exists where N2HET code can be run in windows PC (easy to simulate input toggling?)
If N2HET must be used, any "almost ready" examples?