Hello,
Newbie here on Node-Red.
I would like to know if these processes can be done in Node-Red.
I have data of 10x16bit to be sent over serial port at 20Mbps by an MCU and received by Node-Red.
This is sent over 100kHz frequency, that means every 10uS, data of 10x16bit are sent.
Basically, I split the 16bit data to 2-8bit data with msb sent first (I have no control over this, the MCU is sending it via DMA).
So total of 20-8bits will received by node red.
I setup the serial node as shown below with fixed input of 20 chars.
I was able to receive the data, but my problem is when I reset the MCU at different time, there is a chance that the whole 20bytes of data are not completely sent and the next packet of 20bytes will be messed up and not alligned anymore.
I can set "split input" into 1 char and parse the data. That parsing portion I still dont know yet how to do in Node-Red.
By the way, my 10-16bit data are:
- 0x0000 = start
- 0xNNNN = counter, 0 to (2^16 - 1) to trace my data
- 0xNNNN = 12bit ADC
- 0xNNNN = 12bit ADC
- 0xNNNN = 12bit ADC
- 0xNNNN = 12bit ADC
- 0xNNNN = 12bit ADC (LSB) , 4bit ADC channel (MSB)
- 0xNNNN = duty cycle / phase
- 0xNNNN = HW fault (combined fault data)
- 0xFFFF = stop
What I plan to do by parsing are:
- have a counter (not that counter in #2 above) to count up to 20 while receiving the 20 bytes of serial data.
- when it is already 20, check first 2 bytes if both are 0x00 AND check last 2bytes if both are also 0xff.
- If not, set "sync" to false and wait until next char equal to 0x00, if so, increment counter.
- if next char is also 0x00, set "sync" var to true and continue increment counter until 20.
- repeat 1-3.
manipuate data:
- reconstruct the 8bit data into correct 16bit orientation.
- ADC data #3-6 (above), multiply by some scale factor i.e. adc_data x Voltage, show this data via graphs/gauge/text, etc
3a. ADC data #7 (above), extract 12bit ADC data and 4bit ADC channel.
3b. depending on which ADC channel it is, display on corresponding graph/gauge - PWM duty cycle/phase data#8 (above), display this data via graphs/gauge
- HW fault data#9 (above), extract which HW caused the fault, display this data via switch/button(w color)
Also, if the frequency of 100kHz is very fast for Node Red, just disregard the other data and sample every 10kHz or even 1kHz.