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.

Efficiently Generating a Fast GPIO Output Clock

Other Parts Discussed in Thread: TMS320C5535

I want to generate a 5.000MHz output clock from a TMS320C5535 running at 50.000MHz.  A 50MHz system clock implies that each instruction should take 20ns.  However, when I use the following two instruction to toggle a GPIO pin ('T0' has output bit = '0' and 'T1' has output bit = '1') I see a 60ns delay.  It's like the single instruction takes 3 clock cycles to complete!

MOV T0,port(#IOOUTDATA1)

MOV T1,port(#IOOUTDATA1)

If I add a 'NOP' between the instructions the delay increases to 80ns.

How can I toggle an output pin and get it done in a single instruction cycle?

  • Sheldon,

    There are wait cycles on the IO bus.

    Your post begs the question, why are you generating a clock with GPIO, when there are so many dedicated hardware peripherals that can do so much more efficiently?  Bit-banging is rather old-fashioned.

    Regards,

    Bill 

  • Bill,

    Thank you for your response. I appreciate your input.

    What you said (about the delay cycles) makes sense from what I have been seeing (and I now also think I remember reading about it somewhere too...there is so much to learn).

    I need to generate a 5MHz clock for my A/D converter and I can't drive the DSP with an external 5MHz crystal so I need to generate it somewhere else. I have come up with a solution, however: I am now using the LCD controller's external clock. I am running the DSP at 50MHz and dividing the system clock by 10 to produce the 5MHz clock output for the LCD peripheral (which I am not yet using for anything else).

    There may be a more efficient way of generating a 5MHz clock from the DSP that I am not familiar with but I now have what I need (I am new to TI DSPs so I am just beginning to get my feet wet).

    Regards,
    Sheldon