This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/LAUNCHXL-F28027F: LAUNCHXL-F28027F

Part Number: LAUNCHXL-F28027F
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hello, TI employees or users!

I have a question about your microcontroller "TMS-320F28027F"

I basically want to receive external digital pulse data into micro controller and convert it into analog value for control reason. 

For conversion, switching frequency of digital pulse data is an important factor. Is there any function which can calculate switching frequency at this case? 

For example, using pwm signal inside of micro controller....

Ah I actually have one more question. Digital pulse will be around 20V pulse signal.... so do I have to step down the voltage prior to connect it into GPIO pin???

Thanks for reading my questions and I hope I can get response from you soon.

Sincerely from

Changbum, Son

  • Hello,

    One way to accomplish this is to use the "eCAP" peripheral to measure the time separation of pulses, then convert this into the output value you need and use a PWM with filtering to generate the analog output.  We don't have example code for exactly this as far as I know, but it's pretty straightforward.  The user's guide for the eCAP will give you a good idea how it works:

    http://www.ti.com/lit/ug/sprufz8a/sprufz8a.pdf

    There is an application note on using the PWM as a DAC. Although it was written for a different device, it explains what's required:

    http://www.ti.com/lit/an/spraa88a/spraa88a.pdf

    The I/O pins are restricted to about 3.3V maximum input (see datasheet) so yes, you will need to attenuate the pulses.

    I hope this helps.

    Regards,

    Richard

  • Hello, Richard!
    I sincerely appreciate for your kind answer.
    I will definitely use 'eCAP' function!
    With respect to pulse amplitude, I decided to use simple voltage divider to attenuate the pulse.
    For example, if external signal pulse has 20V amplitude(maximum amplitude), it will decrease to 3.3V through the divider.
    However, external signal will be varied, which means the divided voltage will be less than 3.3V.
    You mentioned above that maximum input is 3.3V so I think I can still receive this signal..
    Here is my question. Is there any disadvantage or danger to destroy the micro controller if signal is below 3.3V??
    Or, it doesn't affect any other functions..?

    Thanks again and I hope you are having a great day,Sir

    Sincerely from
    Changbum,Son
  • You are very welcome!

    There is no risk of damage to the device with a lower voltage level, however to get reliable logic level detection you should ensure the high level voltage is above +2V and the low level below +0.8V.  See the "Recommended Operating Conditions" section of the datasheet for this device.

    Regards,

    Richard

  • Just to add: there is a code example in C2000Ware which configures the eCAP on this device to measure the time between adjacent rising edges of an incoming PWM. This may help to get you started. The example is "ecap_capture_pwm". If you have C2000Ware installed in the default location, the CCS project will be at:
    C:\ti\c2000\C2000Ware_1_00_02_00\device_support\f2802x\examples\structs\ecap_capture_pwm

    Regards,

    Richard
  • Thanks for your comment again, Sir!

    But what I want to achieve is a little bit far away from your suggestion. 

    I mean.. I just want to use the time period as one variable for designing PI controller. It is basically frequency control.

    Incoming pulse train will be measured frequency and reference frequency value will be transmitted from outside. Hence, the output frequency will  always try to capture this reference value via PI controller. 

    So, I just need the analog value of the pulse period and simply convert it to frequency..

    Is there any method to implement it or suggestion??

    Thank you so much again and I will look forward to your response again :)))

    Kind regards,

    Changbum 

  • Changbum,

    The method in my post will deliver the time separation between consecutive pulses.  You could convert value this into an analog voltage using the PWM filtering method I described, or simply use the value in digital form.  I'm not seeing what else you need.

    Can you clarify what you mean by"analog value of pulse period" please?

    Regards,

    Richard

  • Thanks for quick response , Richard

    What I mean is literally the value of pulse period.

    For example, 10ns, 10us, 10ms etc...

    The thing that I am only interested in from pulse signal is this time period(actually frequency but I can directly convert it).

    Of course, I can calculate the period through the reference paper you provided me.

    However, I want to build PI controller via simulink using the time period value...

    But I have no idea how to transmit calculated period into simulink parameter...

    This is my question.. I will attach the schematic to make you understand well

    Kind regards,

    Changbum

  • Changbum,

    OK, thank you. I now understand what you are trying to do. There was no mention of a PI controller or Simulink in your first post, so my previous answers focussed on the use of 'eCAP', which from a hardware perspective is the best way to compute the period of an incoming pulse train.

    I assume you are using the Simulink Embedded Code product for C2000? If so, this will allow you to configure peripherals on the F28027 device, including the eCAP, and to extract pulse period data into your model. Simulink and Embedded Coder are not TI products, so questions relating to them are best addressed to The Mathworks support forum.

    Regards,

    Richard