This post is from 2015. For an up-to-date version of the firmware and a more well structured presentation go to tcd1304.wordpress
Driving the Toshiba TCD1304 linear CCD was easy. See for yourself. Reading it is not as easy.
The output of a CCD is analog, so an ADC is needed. The STM32F401RE has one 12bit ADC capable of 2.4 Msps, which is fast enough to read the pixel values, that arrive at 1/4 of the master clock (ϕM) ie. 350 kHz.
Once converted the 12bit values must be transferred from the ADC data register to memory, and the most convenient way is to utilize the nucleo’s DMA2 controller.
This firmware shows how to do the above.
Of course it would be convenient to also be able to access the data. The STM32F401RE has several communication peripherals. I will at some point implement SPI-transfers, but until then here’s firmware with USART.
It’s clumsy and slow but it should get you your precious data.
As before, the source code contains more explanations.