Close

Communication protocols

A project log for Linear CCD module

TCD1304-based linear CCD module driven by a Nucleo F401RE + Raspberry Pi.

esben rosselesben rossel 07/07/2016 at 17:330 Comments

The first versions of the firmware communicated using UART through the built-in ST-link. Calling it communication might be a bit of a stretch though. The integration time was fixed to whatever value was set during compilation. Every time the CCD was read, the pixel-values were sent to the termnial by redirection of print with the newlib_stubs library.

All in all a very clumsy way to transmit the data, and above all it was slow, and by slow I mean 1-2 seconds (I don't remember exactly how slow).

After reading up on the various communication protocols available on the rpi, I settled on SPI - not because it was the right choice, but simply because I could understand it. The rpi's SPI is annoying though, because it insists on being master, so the data from the CCD is transmitted at the will of the user and not the hardware, potentially creating interrupt conflicts - I think¹. On the upside it's fast: each transmission of 7.4 kb of data takes only 4ms.

However I find myself wanting to go back to UART. Firstly it would allow the mcu to send data whenever, secondly - and more importantly - it would enable me to cut the ties to rpi and make the module more ..universal: With UART the module could become a readily usable part for custom made spectrometers in university/teaching labs and the fantastic WINSPEK32 could probably be used for data-collection.

So that's on the program for this summer holiday - provided I find the time between travelling.

[1] Every once in a while I experience firmwarecrashes, and I suspect the interrupts are to blame. However, I'm an idiot at debugging, so I actually don't know what's going on.

Discussions