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.

GPIO sampling rate on C6670

Other Parts Discussed in Thread: TMS320C6670

Hi,

I have a TMS320C6670 EVM. I am using it to interface 14 bit AD7367 ADC using GPIO. This ADC converts input signals and then sends 14 bits (for one conversion result) serially on providing 14 clocks on its CLK pin. So, I give 14 clocks from a GPIO pin and simultaneously read one by one bit from another GPIO pin using GPIORead function. From the TMS320C6670 datasheet, it takes 12*(1/SYSCLK1) time (minimum) for reading input. SYSCLK1 is the core clock, 983 Mhz in my case (currently set by PLL values). So it should be around 12ns or let's say at max 30~40 ns. But it takes 230 ns to read one input and hence I am not able to get required sampling rate.

I was trying this on the emulator which according to my knowledge runs at much slower clock rate (1Mhz as stated by the CCS config file). But when I loaded the same program on NOR, I got the same performance. So is it the case that emulator's and flash boot performance is same?   I also tried a simple program (on both emulator and NOR flash) in which I just clear and set output on a particular GPIO pin in an infinite while loop trying to figure out how fast can I generate clock on a GPIO pin and what I observed was 150ns time period square pulse. (Note: I was not giving any delay in between clearing and setting output on a GPIO). So I am missing any PLL configuration or this is the fastest clock that I can get via GPIO toggling? I am loading the gel file provided in the mcsdk folder and my DSP's main clock is currently set at 983 Mhz.

Please help!

Thanks and Regards,

Hardik Godara

Undergraduate Student at IIT Bombay

  • Hi Hardik,

    The GPIO module is considered a low speed module and was never intended for data sampling. You have made a couple of bad assumptions in you analysis.

    First, the 12C input timing requirement defines the minimum width pulse that the GPIO module can reliably sample. Note that the GPIO module samples this pulse independent of the processor.  If the pulse is a shorter duration than 12C, the GPIO module may not sample it. Usually this minimum is used to define the shortest interrupt pulse that may be used by the GPIO. This does not define how fast the GPIO pin can be read by the processor. The delays within the part and the delays added by the software can be significant. 

    Secondly, you are using the GPIO to generate the clock and to sample the data. That means you would have to write to your clock GPIO pin to set it low and then write again to set it high followed by a read of the data pin. That is three separate accesses to the GPIO module. The GPIO module is clocked at the slow peripheral clock rate of SYSCLK1/6. The minimum output pulse is 36C-8 or approximately 30ns for your core clock rate. Even if the device was able to execute two writes followed by a read without any other delays, (which it can't) you would need 72ns per data bit.  

    Finally, it looks like you are using GPIO functions to do your reads and writes. Function calls will add significant delays due to the overhead associated with saving the context before executing the function and restoring the context after it's complete. You may be able to speed up your accesses by writing your own function to sample all of the bits. It would have to operate in a manner similar to the following.

    Write OUT_DATA register to set clock bit low

    Write OUT_DATA register to set clock bit high

    Read IN_DATA register to get data bit value to a temporary register

    Mask off the data bit in the temporary register.

    Shift it to bit location 0

    Shift your result register one bit to the left

    OR the results register with the temporary register

    Repeat these statements thirteen more times. 

    Note that all reads and writes would have to be direct read and write statements and not GPIO function calls. Also note that using a FOR loop or a WHILE loop would add more overhead. Simply repeat the statements fourteen times to read all the bits. This may speed things up but I doubt you will reduce the time much.

    Regards, Bill