12 Mbps Communication Between A PC And MCU

The world of hobby electronics have only started putting USB in projects for the last few years, and right now, pushing 1.5 Mbps down a USB port is good enough for most cases. This isn’t true for all cases; that’s a terrible data rate, really, and to get the most out of a USB connection, you can at least move up to USB Full Speed and 12 Mbps.

[Linas] is using the STM32F4 microcontroller for this example, an extremely large and very capable chip. [Linas] is using FTDI’s FT2232D USB UART to send data from an SPI port over USB. This chip does support 12 Mbps, but only after a few additions; an external EEPROM must be connected to the FTDI chip to provide a USB 2.0 device descriptor, otherwise the connection between the microcontroller and a computer is limited to 1.5 Mbps. Even using the USB on the STM32 would be a bottleneck in this case; [Linas] is moving data out of the processor using only the DMA controller – using the USB on the STM32 would eat up processor cycles in the microcontroller.

Thanks to the DMA controller inside the STM32, the microcontroller is capable of sending and receiving data through SPI at the same time. The STM32 is capable of reading and writing to the Tx and Rx buffer at the same time, but the computer is only capable of half-duplex operation – it can only read or write at any one time. [Linas] is setting up the DMA controller on the STM32 as a circular mode, putting everything in the buffer into the FTDI chip, and reading everything sent from the computer back into the STM32’s memory. After counting off the correct number of packets. the controller resets everything, moves the circular buffer back to the beginning, and starts the whole process over again.

The circuit was prototyped with an STM Discovery board. With Labview, [Linas] can see the bits coming out of the microcontroller, and send some bits back to the micro over USB. [Linas] has an extraordinarily detailed video tutorial on this project. You can check that out below.

Continue reading “12 Mbps Communication Between A PC And MCU”

Down The Rabbit Hole Of STM32 Clock Options

Once you venture beyond the tame, comfortable walls of the 8-bit microcontroller world it can feel like you’re stuck in the jungle with a lot of unknown and oft scary hazards jut waiting to pounce. But the truth is that your horizons have expanded exponentially with the acceptable trade-off of increased complexity. That’s a pretty nice problem to have; the limitation becomes how much can you learn.

Here’s a great chance to expand your knowledge of the STM32 by learning more about the system clock options available. We’ve been working with STM32 chips for a few years now and still managed to find some interesting tidbits — like the fact that the High Speed External clock source accepts not just square waves but sine and triangle waves as well, and an interesting ‘gotcha’ about avoiding accidental overclocking. [Shawon M. Shahryiar] even covers one of our favorite subjects: watchdog timers (of which there are two different varieties on this chip). Even if this is not your go-to 32-bit chip family, most chips have similar clock source features so this reading will help give you a foothold when reading other datasheets.

There is a clock diagram at the top of that post which is small enough to be unreadable. You can get a better look at the diagram on page 12 of this datasheet. Oh, and just to save you the hassle of commenting on it, the chip shown above is not an f103… but it just happened to be sitting on our desk when we started writing.

A Complete C64 System, Emulated On An STM32

The Commodore 64 is the worlds bestselling computer, and we’re pretty sure most programmers and engineers above a certain age owe at least some of their career to this brown/beige keyboard that’s also a computer. These engineers are all grown up now, and it’s about time for a few remakes. [Jeri Ellisworth] owes her success to her version, there are innumerable pieces of the C64 circuit floating around for various microcontrollers, and now [Mathias] has emulated everything (except the SID, that’s still black magic) in a single ARM microcontroller.

On the project page, [Mathais] goes over the capabilities of his board. It uses the STM32F4, overclocked to 235 MHz. There’s a display controller for a 7″ 800×480 TFT, and 4GB of memory for a library of C64 games. Without the display, the entire project is just a bit bigger than a business card. With the display, it’s effectively a C64 tablet, keyboard not included.

This is a direct emulation of the C64, down to individual opcodes in the 6510 CPU of the original. Everything in the original system is emulated, from the VIC, CIAs and VIAs, serial ports, and even the CPU of the 1541 disk drive. The only thing not emulated is the SID chip. That cherished chip sits on a ZIF socket for the amazement of onlookers.

You can check out some images of the build here, or the video demo below.

Continue reading “A Complete C64 System, Emulated On An STM32”

PCB of the NoteOn Smartpen showing components

THP Semifinalist: NoteOn Smartpen

There are a ton of apps out there for taking notes and recording ideas, but sometimes the humble pen is best. However, if you have the tendency to lose, crumple, or spill caffeinated beverages on your pen and paper notes, having a digital copy is quite nice.

The NoteOn Smartpen by [Nick] aims to digitize your writing on the fly while behaving like a normal pen. It does this by using the ST LSM9DS0TR: a 9-axis inertial measurement unit (IMU). These inertial measurements are processed by a STM32 Cortex M4F processor and stored on the internal flash memory.

To retrieve your notes, the Nordic nRF8001 Bluetooth Low Energy radio pairs the MCU with a phone or computer. The USB port is only used to charge the device, and the user interface is a single button and LED.

The major hardware challenge of this device is packaging it in something as small as a pen. Impressively, the board is a cheap 2 layer PCB from OSHPark. The assembled device has a 10 mm diameter, which is similar to that of ‘dumb’ pens.

The NoteOn doesn’t require special paper, and relies only on inertial measurements to reconstruct writing. With the hardware working, [Nick] is now tackling the firmware that will make the device usable.

SpaceWrencherThe project featured in this post is a quarterfinalist in The Hackaday Prize.

Sprite Graphics Accelerator On An FPGA

A demo running on a FPGA sprite accelerator

Graphics accelerators move operations to hardware, where they can be executed much faster. This is what allows your Raspberry Pi to display high definition video decently. [Andy]’s latest build is a 2D sprite engine, featuring hardware accelerated graphics on an FPGA.

In the simplest mode, the sprite engine just passes commands through to the LCD. This allows for basic control. The fun part sprite mode, which allows for sprites to be loaded onto the FPGA. At that point, you can show, hide, and move the sprite. By overlapping many sprites, you something like the demo shown above.

The FPGA is from Xilinx, and uses their Block RAM IP to store the state of the sprites. The actual sprite data is contained on a 128 Mb external flash chip, since they require significant space.

The game logic runs on a STM32 Cortex M4 microcontroller which communicates with the FPGA and orders the sprites around. The FPGA then deals with generating frames and sending them to the LCD screen, freeing up the microcontroller.

If you’re wondering about the LCD itself, it’s 3.2″, 640 x 360, and taken from a Ericsson U5 Vivaz cellphone. [Andy] has a detailed writeup on reverse engineering it. After the break, he gives us a video overview of the whole system.

Continue reading “Sprite Graphics Accelerator On An FPGA”

Frankenstein, The Open Source Engine Control Unit

The Engine Control Unit is a vital part of every car made in the last 40 years or so, but unlike just about every other electronic device, open source solutions just don’t exist. [Andrey] is trying to change that with rusEfi, a project that hopes to bring together hardware, software, and engines in one easy to use package. He’s even designed Frankenstein, a full ECU ‘shield’ for the STM32F4 Discovery dev board.

This isn’t the first time we’ve seen [Andrey]’s adventures in building an ECU. An earlier board was also powered by the STM32F4 Discovery, and he actually drove his 96 Ford Aspire around using this homebrew ECU. It was only firing on two cylinders, but that was only a loose solder connection.

Of course building an ECU from scratch is worthless without the proper firmware that balances and engine’s fuel economy and performance. This sort of testing must be done empirically and [Andrey] has a Kickstarter going for the development of this firmware and some dyno time. No rewards, but it’s worth chipping in a buck or two. I did.

Videos below.

Continue reading “Frankenstein, The Open Source Engine Control Unit”

Smart Reflow Oven Is Over-Engineered

reflow

[Linas] reverse engineered an AMOLED HTC 800×480 screen and interfaced it with an STM32 micro-controller, along with some other components, to make a gorgeously over engineered reflow oven.

Under the hood there is a PSoC5LP PID controller to control the 800W IR heating coil and two K-type thermocouples for sensing.

The real beauty is in the relatively small STM32 chip powering the HTC AMOLED screen. The AMOLED screen is high contrast and has a wide viewing angle, giving it a clear crisp view from all front facing viewpoints. Though pushing the limits of what the STM32F429i can do, [Linas] managed to make a very nice “home-grown” user interface, complete with user configurable settings and current temperature graphs.

The user interface looks very responsive and using some clever programming, [Linas] was able to make use of the potential of the screen to provide beautiful plots and interface widgets.

[Linas] goes into quite a bit of detail about the programming involved with rendering to the screen, so be sure to check out the video after the jump.

Continue reading “Smart Reflow Oven Is Over-Engineered”