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.

Rapidly poll GPIO Input

Other Parts Discussed in Thread: OMAPL138, TMS320F28335

I'm trying to use the GPIO to receive a fiberoptic input. Is it possible to rapidly check the GPIO input using a clock and or interrupt?

I've been doing some reading, and it looks like I'd use SYSCLK4, but I'm confused at the limitations and implementation of creating an interrupt to check the input at the GPIO pin.

Is it possible to sample the GPIO input at 1 MHz? If so, would I use a GPIO interrupt, or would I initialize a clock signal using SYSCLK4 and the timer.h/timer.c files?

  • Dear Steven,
    Are you doing bitbang the GPIO as data input (reading the data) ?
    If yes, I suggest you try to configure the timer to set 1MHz for polling the data on GPIO.
  • I'm slightly confused how to configure the timer for polling the data on the GPIO at 1 MHz. Can you offer any guidance?
  • I think, you can configure the timer to trigger the interrupt for 1MHz and put GPIO read code in ISR...
    Is it fulfill your requirement ?

  • Just for clarification, would I use timer.h to trigger the interrupt for 1 MHz? Would I have to do anything with SYSCLK4?

    I don't really see how to set the frequency to 1 MHz. I see a feature to set the period as a number of clock ticks, but I was under the assumption that if you set the period to 1, that meant 1 ms.

    Thanks in advance for your help!
  • Hello Steven,

    According to the datasheet, the OMAPL138 has 64bit timers, 32bit timers and GPIO interrupts.

    Couldn't you just configure the GPIO pin to generate interrupts and and use one of the 64bit or 32 bit timers to time the interrupt generation?

    Stephen

  • Hi Stephen,

    Regarding the 64-bit (or 32-bit) timer, is there a corresponding ISR in the code, and if so, would you happen to know where it is? I haven't been able to find it in the starterware.

    Thanks,
    Steven
  • I only work with the TMS320F28335 and other C2000 microcontrollers.

    You might want to try www.ti.com/.../toolssoftware

    What type of format is the fiberoptic signal? Does it have a UART interface?

    Stephen
  • The fiberoptic signal is very simple. I'm using GPIO8-12 to turn on an led laser, transmit across a fiberoptic cable, and I have a simple photodiode and transistor-based circuit on the other end, which is hooked up to GPIO8-10 as the input.

    I'd like to ideally transmit between two separate LCDK's (& computers), but I'm first trying to figure out how to set up the GPIO interrupt and see how fast I can potentially transmit ( turn on the led laser / sample the input on the other end) using the GPIO pins.

    I just find the documentation very confusing and I'm not sure exactly how to instantiate an interrupt that I could potentially use at 1 MHz to sample the GPIO input. There's a file called timer.h in the OMAP138 starterware, and there is also a timer example called timerCounter.c that is often referenced in other forum posts (though its for the C6748). I'm not sure if these are the correct starting point, or if I'm looking in the wrong area. I also don't see how to set the frequency to 1 MHz...

    Thanks,
    Steven