USB-firmware complete

The USB-enabled STM32F405RG firmware for driving the TCD1304 is complete. The firmware is written for this custom board:

which has high speed rail-to-rail opamps on four analog inputs.

The STM32F4 MCU is identified as a virtual com port (VCP) when connected to a PC. On linux it’s attached as a ttyACM-device, just as the ST-link on a nucleo board. Unlike the nucleo’s St-link (which is setup as a USART-bridge) that has a maximum bit-rate of 115.2 kbps, the STM32F405RG  is working in full speed mode (12 Mbps).

Of course high speed is also possible, but the HS-USB-OTG core of the STM32F405 is on different pins, and so require a different layout of the board, and 12 Mbps is fast enough that the real bottleneck becomes the read-out time of the CCD.

Using essentially the same VCP framework as the UART-FW, there’s not a lot of difference in the source code (except for the large USB-stack of course). so the CLI and GUI for UART work just as well for the USB-fw.

This whole ordeal was an attempt to lower noise, and here’s how that’s going:

With the good old nucleo board I would see fluctuations of about 8 mV ..and at first glance there’s no real improvement with the new board, I still see the same 8 mV. However, since the opamp on the analog input has a gain of ~2, the noise is actually down 50% 🙂

That still makes for a slightly fuzzy line though:

The CCD at close to full saturation. The opamp has inverted and scaled the signal to match the 12-bit ADC’s input range.

However the CCD’s register imbalance is now quite obvious, and subtracting 10 from the signal of every odd pixel, it looks like this:

The same data as in the previous figure, but the CCD’s register imbalance has been taken into account yielding a much cleaner signal.

So mission accomplished. I will update the tcd1304.wordpress site someday in the near future.

4 thoughts on “USB-firmware complete

Leave a reply to Mikis Cancel reply

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