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.

TM4C123GH6PZ: Generate a precise pulse with minimum Duration

Part Number: TM4C123GH6PZ

Hi,

I am doing a photo flash project where I need to generate a pulse with minimum pulse duration using TM4C123 microcontroller. My doubts are,

1. What is the minimum pulse width we can generate using TM4C123. I just want to generate a pulse, so I can use any method for pulse generation in TM4C123. But I don't know How to generate a single pulse with minimum duration. Please if anyone knows about it please explain how I can achieve it. If  any example or reference is there please share the link.

2. I want to generate only a single pulse. Please explain how to achieve minimum pulse duration in TM4C123.

I generated pulse using timers and all. But I am not having any idea about this. please share some thoughts that help me to solve this. I don't have that much experience in embedded programming. So please help me.

Thank you,

Alphy

  • Hello Alphy,

    The quickest pulse would be to just goggle a GPIO from low to high and then from high to low again while running the system clock at 80 MHz 120 MHz. TivaWare APIs would be good for this, but it would be even faster with a couple DRM calls to just handle the toggling of the pin after configuration. I am not sure off the top of my head what the speed is exactly, but depending on instructions to process, it should just be a few clock cycles, so something along the lines of 50-75 ns 25-50 ns pulse duration is what I'd expect.

    Since you only want to generate a single pulse, direct GPIO control is the way to go here.

  • Hi,

    I am using 8MHz external crystal as clock source. So in such case what will be the minimum pulse duration I can achieve. Only direct port toggling is enough for generating a pulse. 

    Thank you,

    Alphy

  • Hello Alphy,

    That shouldn't impact the measurement because you would still drive via PLL the MCU to max clock speed.

    That said I noticed in my post I said 120 MHz, I should have said 80 MHz because the TM4C123x series only goes to 80 MHz. TM4C129x goes to 120 MHz.

    So you are probably looking at more like 50-75 ns pulse duration.

  • Hi,

    I used 80 MHz PLL as the clock source and I am getting signal having following features,

    Period 1.6 us
    Rise time = 44 ns
    Fall time = 52 to 60 ns
     On time = 728 ns
    Off time = 872 ns

    I want signal of 1us But not able to get signal while using API functions.

    The given below is the program,

    int main()
    {
    SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_PLL |SYSCTL_XTAL_8MHZ|SYSCTL_OSC_MAIN);//80MHz crystall oscilator
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7);
    	
      while(1)
      {
       GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7,GPIO_PIN_7); //No delay
    
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7,0);
      }
    
    }

    I tried to with direct memory write and signal features are,

    Period 1.4 us
    Rise time = 48 ns to 43
    Fall time = 67 to 60
     On time = 574 ns
    Off time = 868 ns

    code given below.

    int main()
    {
    SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_PLL |SYSCTL_XTAL_8MHZ|SYSCTL_OSC_MAIN);//80MHz crystall oscilator
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7);
    	
    	while(1)
    	{
    	 // GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7,GPIO_PIN_7);
    		 GPIO_PORTA_DATA_R |= 0x80;  //Data write
    	
    	  GPIO_PORTA_DATA_R &= ~(0x80);  // Turn off the LED.
            }
    }

    Please let me know is there any other way to reduce this time to 1us range.or is any way to write the pin high and low by writing directly to the respective register.

    Thank you,

    Alphy

  • Hello Alphy,

    For one, that is about as fast as you can make it go.

    Also, I didn't even think about accounting for the response time in terms of signal rising, so sorry for that.

    But I am not following regarding the issue now. You wanted a 'single pulse' shorter than 1 us, but I see these stats:

    Rise time = 48 ns to 43
    Fall time = 67 to 60
     On time = 574 ns

    That adds up to be shorter than 1 us for a single pulse. If you want a continuous pulse, that is an entirely different topic...

  • Hi,

    Sorry for the late reply. There was a mistake in my clock set, the clock set was not 80 MHZ. So I didn't get the pulses what I expected. Once I changed the clock to run at 80 MHz, then I am able to achieve 1 microsecond. 

    Thank you,

    Alphy