Hello there,
I'm new (all green) to the NHET world and would like to requst help from the community to implement my first basic high-speed serial data stream edges detector. Any help would be greatly appreciate!
I have the following .het code with design intents described in the comments at the beginning:
; Implementation of an 1-Mbps Manchester serial data stream edges detector
; The GCLK and HCLK are set to 100 MHz and the VCLK2 driving the NHET is ; set to 50 Mhz, with HR=1 (20 ns) and LR=4 (80 ns)
; Using REG_A, CNT is programmed as a 25-bit free-running counter that will; roll over to zero at predefined max value (Z_FLAG will be set for one LR)
; WCAP is used to capture the timestamp of REG_A on both falling; and rising edges; it then triggers an HTU transfer at request number 0 ; to instruct the HTU to store both the CF (edge direction) and DF (timestamp) because rising and ; falling edge status are needed to be known by the application performing ; the edges timing analysis (every 50 us)
; This program takes up 2 HR in timer mode
L00 CNT { next=L01, reg=A, comp=EQ, irq=OFF, max=0x1FFFFFF }L01 WCAP { next=L00, reg=A, pin=CC0, irq=OFF, event=BOTH, reqnum=0, data=0 }
Does this code fit my design goal?
I have to include "data=0" with the WCAP instruction since it is a required field. What am I doing here by writing 0 to the data field? How about the captured REG_A value when an edge is detected?
I planned for an asynchronous post-processing every 50 us of the captured edges+timestamps (from HTU transfers to FIFO) triggered by IRQ in the main application. Any suggestion to improve the performance or any other design idea (DMA instead of HTU) would be welcomed.
Chuck.
Chuck,
I think the concept is correct. Your questions:
1.) "data" may be required for the syntax of the instruction but the data is updated from Register A on the event.
2.) you may want to configure your wcap instruction as using high resolution which will tell you the time in terms of high resolution clocks rather than loop resolution clocks
3.) one high level concern is over-writing your data. You expect new data at a rate slow compared to the loop timing but there may be latency in retrieving the data. I am forwarding your question on to our HET expert for his comments.
Regards,
Forum Support
Thanks Kevin for the suggestions.
EDITED: For point 1, your answer eases my concern, but what exactly "data=" is needed for in the WCAP instruction since capture is always been made from A, B, T or NONE?
EDITED: For point 2, "hr_lr=HIGH" will be added.
For your point 3, I understand your concern. But in the case where input data frequency increases to the point when data loss becomes possible, there is nothing faster than the HTU anyway (I mean neither DMA neither direct CPU memory transfer). Am I correct to assume that?
Hello Kevin,
The DF and likewisethe CF and PF fields are stored in RAM. Setting data=0 will initialize the RAM content for the DF to 0. For your application, what value to initialize for the DF is not important.
regards,
Charles