- The goal is to send data to the host at a fast rate and insert delimiters around a large sequence so the host reads a large chunk of data at a slow rate instead of small pieces of data at a fast rate.
- On the host side, it's impossible for Simulink to read 2 Uint16 data points at 200kHz, but Simulink can easily read 12,000 x 2 Uint16 data points every 60ms (~17Hz). The turnaround time makes it easy for Simulink in the second case, though it's the same amount of data.
- On the target model (DCDC_Buck.slx), the purpose of the Serial_Send subsystem is to send data at a fast rate (2 Uint16 data points at 200kHz) and insert delimiters every 12,000 hits.
- To do so, I use a counter that counts from 0 to 11,999. When the counter equals 0, I insert the end of the previous sequence ('EE') and the beginning of the next sequence ('SS'). 'EE' (0x4545 in ASCII) and 'SS' (0x5353 in ASCII) are arbitrary delimiters. Just make sure they match what you use on the host, you can use whatever you want, I picked S for Start and E for End, and I used 2 characters for each to match the Uint16 format of the delimiters.
- When the counter equals 0 I need to send 4 Uint16 data points. The 2 delimiters + the 2 signal data points.
- When the counter is different than 0, I need to send only the 2 signal data points.
- The counter feeds an "if" condition for the 2 above cases. The merge blocks are used to combine the outputs of the 2 conditions into one. The merge block will pick the output of the subsystem that is active at that time step.
- I can only use one Serial send block, and in the start case I need to send 4 Uint16 data points while I need to send 2 in the other cases. To do that I use a "While Iterator Subsystem". It's the equivalent of a "while" loop in C. I will loop 4 times in the Start case to send 4 Uint16 data points and twice in other cases to send signal data.
- The Serial_Send subsystem is scalable to different widths. Pay attention to the baudrate if changing the width of the signal. Serial communication usually sends 10 bits per data byte (1 start bit and 1 stop bit + 8 bits of data). At 200kHz, 2 uint16 data points mean 2x2x10x200000 = 8Mbps needed, neglecting the delimiters. The baudrate on the target is set to 12.5Mbps which should accommodate for 8Mbps. Increasing to 3 uint16 signals should still work as it will push the baudrate to a little more than 12Mbps, but that is very close to the limit. 4 signals will be too many and will not work at it would require 16+Mbps.
What is the idea behind data processing for SCI communication in DC/DC Buck Converter Example?
19 views (last 30 days)
Dear Antonin, firstly thank you a lot for your model Digital DC/DC Buck Converter Voltage Mode Control (VMC) https://goo.gl/VkdvuD I learnt myself a lot from that model. But there is still one more thing I don't understand. In your model, for target f28377S_DCDC_Buck.slx in subsystem "PI_controller_ISR there is a subsystem Serial Send. Inside that subsystem, I was able to understand everything except: merge blocks and following While Iterator Subsystem. Could you please provide me with the idea, what is happening inside of these blocks? What is the idea in general? You did some data processing, but I don't really understand why. From your video regarding this model, I understand that Simulink is good at handling of big data blocks at low sampling time, whereas target processor is good at handling of small data blocks at high sampling time. But I don't know how to do that. Thanks in advance for your answer. Karol
Antonin on 17 Sep 2018
Here is what is happening in the Serial Send subsystem:
I hope it helps,
More Answers (3)
Burak Caykenari on 15 Jul 2020
Hi Antonin and Karol ,
I understood almost all the information you provided except 'When the counter is different than 0, I need to send only the 2 signal data points.' . I watched the related video but I did not understood this sentence. Counter counts up to 12.000 . Then it reaches this point data will be sent. Therefore 4 times loop are implemented. (2 datas , 2 delimiters(SS,EE))
Other conditions there are no any header (SS) and terminator (EE) informations ,instead this you sent 00's . For this reason the iteration loop number is 2(2 data values). For this reason host will not understand the information(because there are no any terminator ,header characters ) and data will not be received by the host. Isn't it ?
If it's true , why you sent 2 datas in this case ? Because data will not be received by the host since there is no header and terminator informations ? Can you explain why do 2 data informations sent in this situation ? Does it make sense ?
Thank you so much .
Hassan Abouobaida on 24 Aug 2020
Thank you very much Mr Antonin for your relevant explanations about the sampling and the sending of data via the COM PORT, it is very interesting what you have just explained. But I have a few questions that I can't understand
- The Launchpad F28379D is connected to analog input ADCIN_A4 which contains the real signal (traingular) which represents the current signal passing through the inductor so you preferred to transmit the average or filtered current available at the analog input ADCIN_C5 !!
- the signal received by the exposed method (sending of data packet 12000 x 2) allowed to transmit the signal but the received shape is distorted, the signal has lost its triangular shape,
- the time displayed does not correspond to the real time on the Scope !!
- Why the real time is not used for the "real time" operation and the data LOGGING on the scope directly without going through the COM port !!
Thank you very much for your contribution in this discussion.