Hi,
I am using Embeded coder to code a PLL on C2000 F28388D micro-controller. I am using ADC to read my grid voltages and sychronize my PWM with them. For de-bugging purposes, I am also sending the data from ADC over serial port to view it in Simulink. However, when I visulize the ADC data on a scope in Simulink, I recieve a 3.2kHz grid voltage, however, my ADC input signal is only 400 Hz,
First I thought may be I need to configure my simulink scope somehow, but later when I check the value of constants in my loop they also correspond to 3.2kHz. This frequency also changes when I change the sample time of ADC block. And to make things even more weird, I real world, when I connect my DSP to a scope, I could see that my PWMs are synchronized with 400Hz signal.
Can any one please let me know what I am doing wrong? I have attached both simulink files, PLL Coder and HOST data Recieve file.
Thank you .

Antworten (2)

Dr. Pemendra Kumar Pardhi
Dr. Pemendra Kumar Pardhi am 21 Apr. 2020

0 Stimmen

The observed, scope signal is differ from actual signal that means your actual signal is 400Hz frequancy but from scope you observed signal of 3.2kHz, however change in sample time of ADC then frequancy is also veried.
I have also suffer from same problem, but whenever signal is again taken from DAC of TI kit its frequancy is same as input signal frequancy. it proof that inside the simulink model frequancy remain same as input signal. only problem is occure due to selected bourd rate in simulink model setting, I will sugested you select proper bourd rate in matlab simulink model according to your C2000 F28388D micro-controller.
You may also follow the given advices in following link
Thanks
Pemendra Kumar Pardhi

1 Kommentar

Bilal Ahmad
Bilal Ahmad am 22 Apr. 2020
Hi,
Thank you so much for taking out time to reply. Really appreciate your effort.
Yeah that could be the reason. And I really dont mind my serial interface values as long as in real world I am getting 400 Hz synchronization. But the problem is output of my PID controller. For 400 Hz synchronization, output of my PID controller should be around 0, and for 3.2kHz output should be around (3-4 e4). So if I limit my PID output to lets say (1e3), my model will not synch to 400Hz. So in short my PID is working as it should be working for a 3.2kHz signal. This is the point which is confusing me and also frustrating as I have wasted too many working hours on this probelm.
Do you have any comment regarding this?
Regards
Bilal

Melden Sie sich an, um zu kommentieren.

Venkatesh Chilapur
Venkatesh Chilapur am 21 Apr. 2020

0 Stimmen

Hi,
If the ADC input is 400HZ singal, any reason why the ADC sampling is done at high sample rate of 2usec?
I think this is cause of the problem. The model has other blocks like discrete controller which is unlikely the model is running at the given step time. Now the serial block is sending the ADC value everytime the model is able to schedule its execution probably overrunning. The serial block may be sending duplicate values at different instances in time and hence the resutling waveform. The ADC sampling has an direct impact on this overall performance. And when you change it, it will give different results.
The best way to get around this issue is to trigger the ADC via an ePWM module.
That will run under interrupt context and the rest of the model step time can be relaxed to run the algorithm.
Please refer this video on ADC PWM synchronization.
https://www.youtube.com/watch?v=wxYTLbYfBP0
HTH,
Regards,
Venkatesh C

8 Kommentare

Bilal Ahmad
Bilal Ahmad am 22 Apr. 2020
Hi,
Thank you so much for taking out time to reply. I do really appreciate it.
Yes, I used this video as my reference for this design. As this is my first project with C2000 simulink coder, so i had no previous experience. Do you think 500kHz is too high sampling rate with 200MHz clock frequency ? I was using ePWM for SOC in my ADC blocks and the result was similar. However, as they did it in video, to take a sample every time when you have an EOC interrupt, I tried it on my DSP but it does not work for some reason. It does not take any samples and my program just not run. Could you please guide if theres something else needs to be done, other than just use an external interrupt block and select the appripriate CPU and PIE number. And use a trigger in my block? Is there any need to modify the model settings ?
Regards
Bilal
Venkatesh Chilapur
Venkatesh Chilapur am 22 Apr. 2020
Hi,
The sampling rate is dependent on your application. For example the DC-DC converter example at this link runs at 200kkHz. This control alogrithm runs under interrupt context and should get over by the time next interrupt hits. Hence you should find the balance.
Regarding the ADC-PWM synchronization you can start with our shipping example.
HTH,
Regards,
Venkatesh C
Bilal Ahmad
Bilal Ahmad am 22 Apr. 2020
Hi,
Again thanks for your reply.
Yeah actually I set up my serial monitor simulaton using this example of DC-DC converter. There is no SEQ1INT interrupt in CPU/PIE chart of F28388d Controller. This is the interrupt that they used in the synchronization example. And also in many other examples. There is ADCA1 interrupt in F28388d, that is replacement of SEQ1INT, but it does not work as it should be.
Also when you go in hardware setttings of other borads there is a section for external interrupts, but for my board. There is not any. Do you have or some one you could recommend have any experience working with this board?
Regards
Aditya Padmanabha
Aditya Padmanabha am 22 Apr. 2020
Hi Bilal,
Which version of MATLAB are you using?
Thanks, Aditya
Bilal Ahmad
Bilal Ahmad am 22 Apr. 2020
Hi,
R2019b
Regards
Bilal
Bilal Ahmad
Bilal Ahmad am 22 Apr. 2020
I can update to R2020 ( the one that released recently) as well...
Aditya Padmanabha
Aditya Padmanabha am 24 Apr. 2020
Bearbeitet: Aditya Padmanabha am 24 Apr. 2020
Hi Bilal,
F2838x support in R2019b release was partial with limited number of peripherals. In R2020a release all peripherals including external interrupts were added for F2838x board with ARM core support as well. Check out the release notes for more details https://www.mathworks.com/help/supportpkg/texasinstrumentsc2000/release-notes.html.
I agree with you on the part that the ADCINT provided in latest processors works differently compared to the SEQINT in F2833x processors. However you can try to use other ways to collect the data from ADC. You can try to use DMA configured to trigger with ADCINT to read and move the data into a buffer.
Thanks,
Aditya
Bilal Ahmad
Bilal Ahmad am 10 Mai 2020
Hei,
I tried with Matlab 2020 and now I can use external interrupts as intended and also as used in many other examples. However, it still does not solve the problem. I am still seeing a signal with frequency in "kHz" from ADC via serial send while my input frequency is only 400Hz.Is there any way you can have a look at my serial send block and see if everythings correct?
Thank you so much for all the help so far.

Melden Sie sich an, um zu kommentieren.

Tags

Gefragt:

am 20 Apr. 2020

Kommentiert:

am 10 Mai 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by