Part Number:TM4C123GH6PM
Tool/software: Code Composer Studio
I am trying to drive a CCD using a TM4C123G Tiva LaunchPad with the goal of developing an open-source spectrometer for science education. The CCD is supposed to output a series of voltages that vary with light intensity and exposure time. While the CCD should provide output in response to a signal sequence from the microcontroller, I am getting no change in output with light or time, just a DC voltage as measured using my oscilloscope. I suspect the problem may arise from uncontrolled delays in the timing of my signal sequence. Any recommendations or insight into the problem would be appreciated. If this results from physical limitations of the microcontroller, that information would be helpful as well.
The data sheet for the CCD says that it requires a clock running at between 0.8 and 2.4 MHz. Two other pins (ICG and SH) must be synchronized with the clock at the start and finish of an acquisition. Timing requirements are described here: tcd1304.wordpress.com/.../. The expected output is shown in a figure here: tcd1304.wordpress.com/.../. Until recently, my experience coding the LaunchPad has been limited to the Energia IDE. For this project, I am learning to use Code Composer Studio, mostly by following the Tiva workshop labs. I initially tried to run the clock using timer interrupts (as described in lab 2), but it appears that the interrupts introduce delays that limit the clock speed. I have a simplified code with two alternating methods; a StartSequence method and a clock method. Eventually, I will need to incorporate ADC measurements during the clock method, but right now I am just trying to clean up the LaunchPad output timing. The clock method just toggles the PF1 pin. It will eventually do this for several ms. To get a symmetric square wave, I set a delay of 2 system clock ticks during the low period of the clock cycle, which gives high and low times of ~450 ns each (measured with oscilloscope). The StartSequence method switches the ICG and SH settings on PF2 and PF3 between high and low states. ICG goes low as clock goes high, then 200 ns later, SH goes high. After three clock cycles, SH returns low. Then after three more clock cycles, ICG returns high. After that, the StartSequence method ends and the code goes back to the clock method.
It appears that changing methods (ie, leaving clock to enter StartSequence) introduces ~150 ns delay. I am also unable to sequentially change the state of the ICG and SH pulses without adding a delay of more than ~350 ns.
My system control clock settings (below) should give me 100 MHz, or 100 ns period.
SysCtlClockSet(SYSCTL_SYSDIV_2|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
Thanks for your help.
Jack