MicroDMA and LEDs

[Jordan] has been playing around with WS2812b RGB LED strips with TI’s Tiva and Stellaris Launchpads. He’s been using the SPI lines to drive data to the LED strip, but this method means the processor is spending a lot of time grabbing data from a memory location and shuffling it out the SPI output register. It’s a great opportunity to learn about the μDMA available on these chips, and to write a library that uses DMA to control larger numbers of LEDs than a SPI peripheral could handle with a naive bit of code.

DMA is a powerful tool – instead of wasting processor cycles on moving bits back and forth between memory and a peripheral, the DMA controller does the same thing all by its lonesome, freeing up the CPU to do real work. TI’s Tiva C series and Stellaris LaunchPads have a μDMA controller with 32 channels, each of which has four unique hardware peripherals it can interact with or used for DMA transfer.

[Jordan] wrote a simple library that can be used to control a chain of WS2812b LEDs using the SPI peripheral. It’s much faster than transferring bits to the SPI peripheral with the CPU, and updating the frames for the LED strip are easier; new frames of a LED animation can be called from the main loop, or the DMA can just start again, without wasting precious CPU cycles updating some LEDs.

GPS Engagement Ring Box

gpsEngagementRingBox

[James] got engaged recently, in part thanks to his clever GPS Engagement Ring Box, and he sent us a brief overview of how he brought this project to life. The exterior of the box is rather simple: one button and an LCD. Upon pressing the button, the LCD would indicate how far it needed to be taken to reach a pre-selected destination. After carrying it to the correct location, the box would open, revealing the ring (and a bit of electronics).

Inside is a GPS antenna and a Stellaris Launchpad, which are powered by three Energizer lithium batteries to ensure the box didn’t run out of juice during the walk. To keep the lid closed, [James] 3D printed a small latch and glued it to the top of the box, which is held in place by a micro servo. Once the box reaches its destination, the microcontroller tells the servo to swing out of the way, and the box can then open. As a failsafe, [James] added a reed switch to trigger an interrupt to open the box regardless of location. It seems this was a wise choice, because the GPS was a bit off and the box didn’t think it was in the correct place.

Swing by his blog for more information on the box’s construction and the wiring. We wish [James] the best and look forward seeing his future hacks; perhaps he’ll come up with some clever ones for the wedding like our friend Bill Porter.

A Shell For The Stellaris & Tiva

cli

When [antoker] is working on a microcontroller project, he often has to write short bits of test code to make sure everything in his circuit is working properly. This is a time-consuming task, and a while back he started on a small side project. It’s a command line interface for a microcontroller that allows him to send short commands to the uC over a serial connection to play around with the ADC, UART, and GPIO pins.

[antoker]’s tiny Unix-like environment is based on modules  that can keep track of the time, print the current commands and stack to a terminal, and query things like the current speed of the uC and the available Flash and RAM.

This tiny shell also has scripting capabilities and a jump function, making this a true programming language, however minimal it is. Right now [antoker]’s work is available for the TI Stellaris and Tiva series microcontrollers, and a video of a scripted Larson scanner is available below.

Continue reading “A Shell For The Stellaris & Tiva”

$25 coupon code for Texas Instruments store

ti-25-buck-coupon

If you’ve been coveting a piece of Texas Instruments hardware you should put in an order before September 30th. A coupon code for $25 off a purchase was posted to the Stellaris ARM Community forums and it should work until that date. Above is the overview of an order placed yesterday for two Tiva Launchpads (apparently TI has rebranded the Stellaris chips as Tiva for some odd reason). After applying the coupon code “National-1yr” the total price of [BravoV’s] order is just under one dollar (including shipping). The coupon code can be entered into a box on the right hand column of step #3 (payment) when placing an order.

UPDATE: There are now multiple comments reporting that the coupon code no longer works.

We’re pretty sure you can use this coupon code on anything in the TI store. But if you don’t have a Stellaris/Tiva Launchpad yet we highly recommend getting one. We picked ours up about a year ago. It’s a great way to try your hand at ARM programming. We have had some issues with how the breakout headers are organized — there’s some gotchas with multiple pins being connected (read the last five paragraphs of the project write up linked in this post for more). But for the price and ease of programming this will get you up and coding in no time. If you need some ideas of what to do with the board look at our posts tagged as “Stellaris”.

[Thanks Vlad]

Evalbot as a JTAG programmer

evalbot-as-jtag-programmer

[Adarsh] needed a JTAG programmer to push code to a CPLD dev board he was working with. He knew he didn’t have a dedicated programmer but figured he could come up with something. Pictured above is his hack to use a Stellaris Evalbot as a programmer.

Long time readers will remember the Evalbot coupon code debacle of 2010. The kits were being offered with a $125 discount as part of a conference. We were tipped off about the code not know its restrictions, and the rest is history. We figure there’s a number of readers who have one collecting dust (except for people like [Adam] that used it as a webserver). Here’s your chance to pull it out again and have some fun.

A bit of soldering to test points on the board is all it takes. The connections are made on the J4 footprint which is an unpopulated ICDI header. On the software side [Adarsh] used OpenOCD with stock configuration and board files (specifics in his writeup) to connect to the white CPLD board using JTAG.

Video player built from Stellaris Launchpad

stellaris-launchpad-playing-video

We think it’s pretty impressive to see a Stellaris Launchpad playing back Video and Audio at the same time with a respectable frame rate. It must be a popular time of year for these projects because we just saw another video playback hack yesterday. But for this project [Vinod] had a lot less horsepower to work with.

He’s using a 320×240 display which we ourselves have tried out with this board. It’s plenty fast enough to push image data in parallel, but if you’re looking for full motion video and audio we would have told you tough luck. [Vinod’s] math shows that it is possible with a bit of file hacking. First off, since the source file is widescreen he gets away with only writing to a 320×140 set of pixels at 25 fps. The audio is pushed at 22,400 bytes per second. This leaves him very few cycles to actually do anything between frames. So he encoded the clip as a raw file, interlacing the video and audio information so that the file can be read as a single stream. From the demo after the break it looks and sounds fantastic!

Continue reading “Video player built from Stellaris Launchpad”

Making it Easier to Build Firmware

OSHW Logo

Most microcontroller manufacturers give you some kind of free development toolchain or IDE with their silicon products. Often it’s crippled, closed source, and a large download. This is pretty inconvenient when you want to have firmware that’s easy to build and distribute. I’ve found many of these toolchains to be annoying to use, and requiring closed source software to build open source firmware seems less than desirable.

It’s possible to build code for most microcontrollers using command line tools. You’ll need a compiler, the device manufacturer’s libraries and header files, and some method of flashing the device. A lot of these tools are open source, which lets you have an open source toolchain that builds your project.

Setting up these tools can be a bit tricky, so I’m building a set of templates to make it easier. Each template has instructions on setting up the toolchain, a Makefile to build the firmware, and sample code to get up and running quickly. It’s all public domain, so you can use it for whatever you’d like.

Currently there’s support for AVR, MSP430, Stellaris ARM, and STM32L1. More devices are in the works, and suggestions are welcome. Hopefully this helps people get started building firmware that’s easy to build and distribute with projects.