Micromouse 5/2012

I recently added my documentation for my Micromouse project to my Projects page. Check it out:

Micromouse 2012

More of my projects will be added to my Projects page soon, stick around!

 

Stellaris LM4F120 LaunchPad Thoughts

I just received my Stellaris LaunchPad in the mail! It shipped on the 25th and arrived at my house today on the 27th. I put in the order within a few minutes of getting TI’s email announcing the pre-order. Looking at TI’s store they are now estimating 2-8 weeks for orders placed before prior to the 25th. I remember it taking them a while to get the MSP430 launchpad shipped when that was first announced, and I would say the LM4F120 is a much better deal for $5. It just goes to show the LaunchPad’s are being shipping.

The demo application on the board shows off the basic hardware on the board. The RGB LED is fades between different colors when left alone and the buttons cycle between the different colors. Holding both buttons down enters hibernation mode.

Not shown in the video the demo application also features serial control over the color, light intensity, and hibernation. The serial drivers do need to be installed for this to work, although I had no issues getting everything up and running on Windows 7 per TI’s included instructions.

Running the demo application draws around 22mA, switching to hibernation reduces this to an average of 850µA. In both cases the LEDs draw the most current. I figured because they included the hibernation feature I might as well test it.

The biggest draw to getting the Stellaris LaunchPad was that it is a Cortex-M4 ARM core which is very capable when it comes to doing DSP. That coupled with the dual on-chip 1MSPS Analog to Digital Converter means that some very interesting mixed signal projects should be possible with this dev board. An interesting feature of the LM4F120’s ADCs are that they can be phase shifted relative to each other (around 20-30°), and they can also be shifted by 180° to get an effective 2MSPS sampling rate. Considering most entry-level MCU’s have ADCs with a 200kSPS or lower sample rate this is fantastic.

Unlike the MSP430 LaunchPad the programmer cannot be separated from the without cutting through and destroying the programming section. The headers are also pre-soldered instead of being included in the box.

An interesting thing to note is that the programmer is exactly the same LM4F120 microcontroller which handles all of the USB serial communications and debugging interface.

I do wish that the board had a more interesting peripheral than an RGB LED, but for 5$ I can’t complain. The LM4F120 MCU has plenty of on-chip features and I am excited to see what people come up with using this development board.

 

Breadboard-able LPC1114 ARM Cortex-M0 Followup

Around the beginning of the year I posted this article about my idea for a breakout board for NXP’s LPC1114 ARM Cortex-M0 microcontrollers after being inspired their announcement for a DIP packaged Cortex-M0 micro. Earlier this month I received the PCBs for my design and built two of the boards using my reflow oven.

In the above pictures I didn’t populate the power LED, but everything else is in place and tested. The LPC1114 QFN package was actually a pleasure to work with using solder paste and a reflow oven. I didn’t have a small enough tip for my solder paste which meant I had a little too much solder in places but that was easily cleaned up with a fine tipped iron. The most obvious place where there is too much solder is around the crystal oscillator on the right, and the 0805 capacitors on the left of the board.

After building two of the boards there were a few things I was happy with, and a few more disappointments. Firstly due to the pin layout of the LPC1114 chip in the QFN package I could make this breakout board quite small and still keep a fairly large ground plane. The small size was a goal of mine especially considering I wanted to be able to plug this board into a standard breadboard. It was almost something I would use!

Now on to the disappointments: My idea presented in my other post about reset and boot-loader buttons was a failure. I had an idea of using small edge mounted buttons to reset and enter the boot-loader mode on the LPC1114. While the idea worked in terms of functionality the implementation failed in terms of ergonomics. Pressing the buttons to load code onto the chip was an unpleasant experience which I think cost too much in usability. My next gripe which I thought might be a problem is that I still need to hook up an external device (In this case a FTDI USB to UART chip) to reprogram the LPC1114. Lastly the silkscreen on the board was blurry! Although this was my fault for making the size too small. It was legible, but it is nice to be able to read which pins you are connecting without squinting.

I am quite happy with building these breakout boards as a learning experience. I do plan on making a second revision which incorporates what I have learned. I plan on doing away with the buttons and instead adding a small FTDI USB to UART chip in a QFN package. This can also be used along with lpc21isp software to automatically reset and enter the ISP boot-loader. As an added bonus this would add USB serial functionality to the board without adding anything extra for easy debugging and prototyping. The external crystal could also be eliminated  with the pins being broken out so that any crystal could be used. This would offset some of the cost added with the FTDI chip and USB connector, especially considering the LPC1114 has a 12MHz internal oscillator.

I will post schematics and layouts for the updated version 2 of my breadboard-able ARM microcontrollers once I have them ready to send off.

LPC1769 Fast Fourier Transform

I recently discovered that NXP has published a DSP library for their ARM Cortex-M3 microcontrollers and I thought it would be fun to write an FFT example using my OpenLPC dev board. It works wonderfully!

I apologize for the video of a computer monitor, the screen capture software didn’t run well when trying to refresh the terminal that quickly.

The example code is actually fairly simple seeing as the heavy lifting is done by the pre-complied library. I turn on and set up the on-chip analog to digital converter and then take 1024 samples storing them in SRAM. There are no imaginary samples so I just store 0 every other sample. The array is then sent as an argument to the Fast Fourier Transform function along with a separate pointer to another location in SRAM on the LPC1769 where the results are stored. The magnitude is then calculated and scaled for printing to the terminal. Because I am using a higher resolution FFT I just print a few of the frequency bins (in the video I print 74) so that it will fit on my screen. My current code doesn’t use interrupts and so the sampling frequency depends on the execution time to store the ADC results in  SRAM along with some logic operations and the 65 clock cycles for the actual conversion. When it is all set and done I repeat the process at 20Hz.

The hardware setup was very simple. An arbitrary signal comes from my function generator centered at 1.5V and fed through an RC low pass filter with a cutoff frequency at ~70KHz for anti-aliasing. This is roughly around the Nyquist frequency of the ADC as I am sampling at around 160KSPS. For practical applications this wouldn’t work well and would allow a lot of signals to alias into the sampled signal, however it takes the edge off of what I was working with.

In all it took a couple hours to get everything set up and running correctly. I will clean up my code and use interrupts in the future to get a more predictable sampling frequency. For now my code is available on my GitHub repository.

https://github.com/willhb/lpc/tree/master/fft_adc.lpc17xx

LPC Bootloader Auto-Baud

Before I found the updated version of lpc21isp I thought I was stuck using flashmagic, or writing my own tool to program the chip over serial. When I first looked through the user manual I unfortunately missed the syntonization protocol the bootloader follows. I was about to try looking at the data being transmitted on an oscilloscope when I found the correct way to finish the auto-baud routine. Section 21.3.3 of the lpc111x user manual (UM10398) fits it all into one paragraph.

The confusing aspect of this protocol is that earlier in the user manual section 10.5.14 specifies doing auto-baud using an ‘A’ or ‘a’ character and gives reasoning as to why those characters are used. The ISP auto-baud protocol requires the ‘?’ character.

If one character was all that was needed to enter the bootloader I would try and think of a couple reasons for the use of the ‘?’ character. However, after sending the initial ‘?’ there are another couple of steps required.

Connected to the bootloader.

The protocol to access the bootloader is as follows:

  • Reset with the ISP pin held low
  • Connect to RX/TX and open a terminal with your favorite program
  • ‘?” and hit return
  • LPC111x will return ‘Synchronized’
  • Reply with ‘Synchronized’
  • LPC will return ‘OK’
  • Reply with the crystal frequency in kHz (12000 in my case)
  • LPC will return ‘OK’
  • Auto-baud is now finished and ISP commands can be executed.

In my case the formatting covered up some of what I had typed, but everything worked perfectly even at 115200 baud.

I might still write something in python to flash new code onto my board, but the new version of lpc21isp looks promising and covers OSX and Linux.