The firmware

The are two versions of the firmware:

  1. UART-enabled
  2. SPI-enabled

Current UART- and SPI-version differ mainly in the communication protocol used.¹ For UART the data-rate is 115.2 kbps so transmission a full dataset takes 640 ms to complete. For SPI the data-rate is 16 Mbps so transmission of a full dataset takes 4 ms.

The consequence is that with SPI, frame rates of at least 75 Hz is feasible², whereas the UART firmware can’t read the CCD much faster than 1.25 Hz.

Because SPI and UART are different and behave differently, there are also small differences in main() and some of the interrupts.

The fM-frequency is 2.0 MHz by default, but can be changed by editing main.h and recompiling.


The CCD should be connected to the nucleo board through the following GPIO’s:

  1. fM connects to PB1
  2. SH connects to PB10
  3. ICG connects to PA1
  4. Output connects to PC3

look at the howto for more details.


The UART-enabled firmware can communicate with any (linux or macOS) pc over the nucleo’s USB connection. The SPI-version must be connected to a raspberry pi (or something else with an SPI-controller).

The SPI firmware will only work with a CLI or GUI written specifically for SPI, and similarly for UART. It’s entirely possible to connect a nucleo with the UART-fw to a raspberry pi, but the rpi must then use the programs written for UART.

The user LED on the nucleo boards flashes with the ICG-frequency. The feature may be disabled by editing stm32f4xx_it.c but it can be useful for debugging (or simply checking if the upload went well).

¹ Prior to March 2017, the SPI-enabled firmware used other GPIO’s than the UART.

² At 2.0 MHz the CCD read-out time is 7.4 ms and the theoretical transmission time is 3.7 ms. This gives a theoretical frame-rate of:
(7.4ms + 3.7ms)⁻¹ = 89 Hz.
The experimental transmission time is 4.2 ms corresponding to a practical limit of 86 Hz. With an fM of 4.0 MHz the read-out time is 3.7 ms, giving a practical frame-rate of 126 Hz.
If an even faster frame-rate is needed, the ADC-DMA can be set up in double-buffering mode. The STM32F401RE will then be able to transmit and collect data simultaneously, yielding a frame-rate of:
(4.2 ms)⁻¹ = 238 Hz
If a faster SPI-controller than the rpi’s is used, the frame-rate can be as high as (3.7ms)⁻¹ = 270 Hz, but probably not higher, as the TCD1304 is specified to run with a maximum clock of 4.0 MHz.