TI C2000 ADC Output
36 views (last 30 days)
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 .
Pemendra Kumar Pardhi on 21 Apr 2020
Dear Bilal Ahmad,
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
Pemendra Kumar Pardhi
Venkatesh Chilapur on 21 Apr 2020
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.