-1
\$\begingroup\$

I want to generate square pulses at around 1 MHz to drive an H-bridge inverter. Now, I want to choose a suitable microcontroller, microprocessor, or a DSP board. I need to generate a few pulses (minimum 4) with the possibility of controlling the duty and the phase. The resolution I am aiming for is around 5 ns. I also want to execute some control logic. What would be the minimum speed of the processor for this purpose?

For example, I have TI MCU F28379D LaunchPad in mind which include 200 MHz TMS320F28379D. If I can use the full 200 MHz speed, I should be able to get \$5~\rm{ns}\$ resolution. But what will be the practical resolution in a real implementation?

\$\endgroup\$
  • 5
    \$\begingroup\$ This sounds like something you could offload to a timer? I would have thought most of the reasonably quick micro controllers would suffice \$\endgroup\$ – Colin Feb 11 at 13:45
  • \$\begingroup\$ Are you interested in a recommendation on how to select a platform or rather a specific platform recommendation? Your question asks for a speed requirement, but your comment to an answer mentions specific platform. \$\endgroup\$ – Jurkstas Feb 11 at 14:48
  • \$\begingroup\$ @Jurkstas, I edited the question to fit with the rules and deleted the comment now. in fact, if I can get recommendations on "how to select a platform", I should be able to select a specific platform. \$\endgroup\$ – Pojj Feb 11 at 14:55
  • \$\begingroup\$ @Colin, Thanks, I will try your suggestion. \$\endgroup\$ – Pojj Feb 11 at 16:09
  • 2
    \$\begingroup\$ You'll have to read the datasheets and compare timer peripherals and the maximum clock frequency for that peripheral. Some processors (TI is one supplier) use some interesting tricks to get as good as 150ps PWM resolution without insane clock frequencies. \$\endgroup\$ – Spehro Pefhany Feb 11 at 16:24
-3
\$\begingroup\$

You could use something as simple as an Arduino Nano (main processor is an ATMega328) and run the following code (from official arduino site):

int outPin = 8;                 // digital pin 8

void setup()
{
  pinMode(outPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(outPin, HIGH);   // sets the pin on
  delayMicroseconds(5);        // pauses for 5 microseconds
  digitalWrite(outPin, LOW);    // sets the pin off
  delayMicroseconds(5);        // pauses for 5 microseconds
}

The code as I've shown it here should get you to 200KHz

However, I believe that function can only go down to 3us so in reality you may not be able to quite make it to 1MHz.

\$\endgroup\$
  • 1
    \$\begingroup\$ Arduino default digitalWrite() is slow. \$\endgroup\$ – Long Pham Feb 11 at 14:46
  • \$\begingroup\$ @LongPham It may be but I successfully created a simple square wave generator using this method and I tested it using a very simple hobbyist oscilloscope (amzn.to/2BukFWE) and it worked well enough for my purposes. It was just an idea. \$\endgroup\$ – raddevus Feb 11 at 15:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.