High-framerate (125 Hz) TCD1304 firmware

Until now, the benefits of using a raspberry pi’s SPI-interface, compared to simply using the built in ST-link’s UART-over-USB to fetch the data collected by nucleo+TCD1304, has been negligible.

But thank dog for x-mas holidays, as it’s given me enough time to do a proper upgrade of the SPI firmware.

The long story short is, that while SPI is more than 100x faster than UART, the SPI-firmware wasn’t designed for multiple readings. A quick back-of-the-envelope estimate of the time required for one recording is:

  • Command upload time: 4.2 ms
  • Timer reconfiguration and CCD flushing: 15 ms
  • A/D conversion time (entire CCD) 7.4 ms
  • Data download time: 4.2 ms

Total: > 30 ms

The left the maximum possible frame-rate at < 33 Hz

This has all changed now:

The new otterly-hfCLI takes an option for collecting up to 65 535 measurements with identical integration times, which means the overhead spent by the first two bullets can be cut away.

While the upload time technically still is there, it’s present only once for potentially 2¹⁶-1 integrations.

Increasing the MCLK of the CCD to it’s maximum (4.0 MHz), the A/D-conversion time is halved, yielding a total time for each integration in a set to just below 8 ms.

And so the maximum frame-rate has been increased to 125 Hz. Ok, I should be modest, so let’s say 100 Hz, but just because it’s x-mas day.

So how is this possible? Part of the limitation of the previous set-up was that the raspberry is master of the SPI-communication, even if it has no clue when to speak and when not to. The nucleo now changes logic state of one of its GPIOs, which in turn triggers a callback-function on the rpi, effectively synchronizing the two.

However, this wasn’t possible at low latencies with wiringpi (at least I couldn’t get it to work), so it has now been substituted with pigpio.

Updated instructions and downloads will be coming to tcd1304.wordpress.com in the very near future.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.