Tag Archive | "IDE"

Exploring the TI MSP430 platform with Energia Arduino-compatible IDE

Introduction

Over the last year or so Texas Instruments have been literally pushing their MSP430 development platform hard by offering an inexpensive development kit – their LaunchPad. For around ten dollars (not everyone could get it for $4.30) it includes a development board with flash emulation tool and USB interface, two of their microcontrollers, crystal, USB cable and some headers. It was (is?) a bargain and tens of thousands of LaunchPads were sold. Happy days.


However after the courier arrived and the parcel was opened, getting started with the LaunchPad was an issue for some people. Not everyone has been exposed to complex IDEs or university-level subjects on this topic. And to get started you needed to use a version of Code Composer Studio or IAR Embedded Workbench IDEs, which scared a few people off. So those LaunchPads went in the cupboard and gathered dust.

Well now it’s time to pull them out, as there’s a new way to program the MSP430 using a fork of the Arduino IDE – Energia. Put simply, it’s the Arduino IDE modified to compile and upload code to the LaunchPad, which makes this platform suddenly much more approachable.

Getting Started

You’ll need to download and install the appropriate USB drivers, then the IDE itself from here. To install the IDE you just download and extract it to your preferred location, in the same manner as the Arduino IDE. Then plug your LaunchPad into the USB. Finally,  load the IDE. Everything is familiar to the Arduino user, except the only surprise is the colour (red as a nod to TI perhaps…):

ide

Looking good so far. All the menu options are familiar, the files have the .ino extension, and the preferences dialogue box is how we expect it. Don’t forget to select the correct port using the Tools > Serial port… menu. You will also need to select the type of MSP430 in your LaunchPad. At the time of writing there is support for three types listed below (and the first two are included with the LaunchPad v1.5):

  • MSP430G2553 – <=16 MHz, 16KB flash, 512b SRAM, 24 GPIO, two 16-bit timers, UART, SPI, I2C, 8 ADC channels at 10-bit, etc. Cost around Au$3.80 each**
  • MSP430G2452 – <=16 MHz, 8KB flash, 256b SRAM, 16 GPIO, one 16-bit timer, UART, I2C, 8 ADC channels, etc. Cost around Au$2.48 each**
  • MSP430G2231 – <=16 MHz, 2KB flash, 128b SRAM, 10 GPIO, one 16-bit timer, SPI, I2C, 8 ADC channels, etc. Cost around Au$3.36 each**

** One-off ex-GST pricing from element14 Australia. In some markets it would be cheaper to buy another LaunchPad. TI must really be keen to get these in use.

There are some hardware<>sketch differences you need to be aware of. For example, how to refer to the I/O pins in Energia? A map has been provided for each MSP430 at the Energia wiki, for example the G2553:

g2553pinouts

As you can imagine, MSP430s are different to an AVR, so a lot of hardware-specific code doesn’t port over from the world of Arduino. One of the first things to remember is that MSP430s are 3.3V devices. Code may or may not be interchangeable, so a little research will be needed to match up the I/O pins and rewrite the sketch accordingly. You can refer to pins using the hardware designator on the LaunchPad (e.g. P1_6) or the physical pin number. For example – consider the following sketch:

You could have used 2 (for physical pin 2) instead of P1_0 and 14 (physical pin … 14!) instead of P1_6. It’s up to you. Another quick example is this one – when the button is pressed, the LEDs blink a few times:

Due to the wiring of the LaunchPad, when you press the button, P1_3 is pulled LOW. For the non-believers, here it is in action:

So where to from here? There are many examples in the Energia IDE example menu, including some examples for the Energia libraries. At the time of writing there is: Servo, LiquidCrystal, IRremote, SPI, wire, MSPflash and Stepper. And as the Energia project moves forward more may become available. For help and discussion, head over to the 4-3-Oh forum and of course the Energia website. And of course there’s the TI MSP430 website.

Conclusion

Well that was interesting to say the least. If you have a project which needs to be low-cost, fits within the specifications of the MSP430, has a library, you’re not hung up on brand preference, and you just want to get it done – this is a viable option. Hopefully after time some of you will want to work at a deeper level, and explore the full IDEs and MSP430 hardware available from TI. But for the price, don’t take my word for it – try it yourself. 

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, energia, I2C, LCD, lesson, MSP430, MSP430G2231, MSP430G2452, MSP430G2553, TI, tutorialComments (14)

Review – Digilent chipKIT Uno32

In this review we consider a Digilent chipKIT Uno32 development board made available by element14.

Introduction

This is a development board that is based on the Arduino Uno, however uses a Microchip PIC32MX320F128 microcontroller instead of the Atmel ATmega328 we are used to:

Digilent’s decision to use the PIC32 introduces some interesting changes to the Uno format, and the largest change to take note of is the clock speed – 80 MHz instead of the Uno’s 16 MHz. That certainly took my attention, and we can see this demonstrated shortly.

When shipped the board arrives alone in a cardboard box, without a USB cable:

All documentation is found on the Digilent website. There is also a support forum to discuss libraries, IDE updates and so on. The board itself is quite familiar upon initial inspection:

You can see that Arduino shield will physically fit onto the board, and the extra I/O pins are accessed through the second rows of jumpers inside the board. With some crafty PCB creation skills you could make your own Uno32 shields, or consider one of the boards available from element14 or Digilent.

As for the other specifications of the Uno32:

  • Clock speed – 80 MHz
  • 128K flash program memory
  • 16K SRAM data memory
  • I/O pins – 42 (12 used as analogue inputs or digital I/O)
  • Five PWM pins
  • FTDI chip for USB interface
  • Two user LEDs
  • Same form factor as Arduino Uno boards, which allows physical shield compatibility
  • Five interrupt pins
  • On board real-time clock (external crystal required)

You will need a new IDE, and you can download Uno32-modified versions of the Arduino v22 and v23 IDE from here for Windows, MacOS and 32-bit Linux (no 64-bit…). The bootloader is preinstalled on the Uno32 and after installing the special IDE it works just as our normal Arduinos do in terms of editing and uploading sketches. The board also is compatible with the Microchip MPLAB IDE and PICkit3 in-circuit debugger if you want to use the Uno32 as a normal PIC32 development board. There is a row of holes between the USB socket and the DC socket that will need header pins soldered in for PICkit3 use.

Speed comparison

Naturally you want to see the speed test. The following sketch was run on an Arduino Uno and the Uno32 boards using IDE v1.0 for the Uno and the MPIDE v23 for the Uno32:

And here are the results of running the sketch four times on each board:

speedtest1

Well that’s pretty impressive – over sixty times faster than the Arduino Uno. Therein lies the major reason to use this board over the Uno. The eagle-eyed among you may have also noticed the difference in the compiled binary sketch size – 6432 bytes for the Uno32 vs. 2540 bytes for the Arduino Uno. That’s interesting.

Nevertheless there are many things to take note of when moving from Arduino to Uno32, or in other words – you can’t just swap out an Arduino Uno for an Uno32, recompile and run your sketch at the faster speed. The Microchip PIC32 is very much a different beast to the Atmel AVRs we’re used to, so it is important that you understand the differences in hardware and software to take advantage of the Uno32. So let’s run through those  now.

Power Differences

The Uno32 is a 3.3V board due to the PIC32. You can still power it via USB, or connect between 7~15 VDC to the power socket on the board. You can change a jumper and feed 5V directly into the board bypassing the 5V regulator. External power is regulated to 5V then to 3.3V. From a total of 1A current, the PIC32 uses 75mA, so you can draw up to 925mA from the 5V bus or 425mA from the 3.3V bus (or a mixture from both). It would pay to determine your current load before testing to avoid damaging the board, however  the  manual notes that the regulators will become hot at high current loads but do have thermal protection. Finally there is also a jumper that chooses between a 5V or 3.3V voltage feed to the shields. As always, consult the manual first.

I/O Differences

Although the PIC32 being a 3.3V part, the manual states that the digital I/O pins are 5V tolerant, so applying 5V to a digital input won’t damage the PIC32. Logic on the other hand is a different kettle of fish. According to the manual a digital ‘high’ when sourcing 12mA of current will only reach close to 3.3V. This may be too low in some situations so check your threshold voltages when choosing external parts. Furthermore, the analogue reference voltage (AREF) is restricted to 3.3V.

One stand-out difference is that you can only source 18mA from a digital pin, which is OK if you’re blinking some LEDs. However for logic output to keep the voltage range below 0.4V for ‘low’ and above 2.4V for ‘high’ the current must be restricted to -12~+7mA – another different limitaion. Finally, the maximum current you can source over all the I/O pins at once is 200mA.

There are two UARTs, number one where we expect it (D0/D1) and another on pins 39 and 40. I2C is on A4/A5 but needs to be activated with a jumper. Note that unlike an Arduino there aren’t any inbuilt pull-up resistors for the I2C bus, so add your own. There is also an SPI bus at the usual position (D10~13) and interestingly you can change the board between SPI master and slave via another set of jumpers. There are five pulse-width modulation outputs, however one is on D10 which is also part of the SPI bus. Finally there are five hardware interrupt pins.

Shield Compatibility  

Arduino shields will physically fit onto the Uno32 – but you need to be aware of the I/O differences listed above, the voltage and current specification and also the software side of things. Again – do your research before making the commitment to the hardware.

Software Compatibility

The Uno32 is compatible with a variety of Arduino sketches, but not all. This in a large part is due to the libraries which will need to be sourced from the community or rewritten yourself if not provided with the MPIDE software. There is a community on the support forum which is contributing their own, such as the real-time clock library – but again, research needs to be done before use. When trying to use an existing Arduino sketch and hardware, you will need to spend some time checking for compatibility. Again – it’s much easier to design a new project around the Uno32 than rejig an existing one.

Open Source? 

One of the things many people love about the Arduino ecosystem is that the entire system is open source hardware and software. Without causing a pro/con argument about software licensing you should note that not all of the software toolchain for the Uno32 is open, nor the USB or TCP/IP stack. There is some interesting discourse about this here.

Conclusion

A lot of work needs to be done to ensure compatibility with existing Arduino applications. The Uno32 is tempting due to the raw clock-speed increase, however the sketch/library and hardware differences may introduce a few road blocks. However, when designing a project from scratch and understand the licensing limitations, the Uno32 would be great as you know what you have to work with – a much faster board with much more I/O. And it is very inexpensive, less than ~$35. You can order your new Uno32 from element14.

Finally, if you’re looking for a very inexpensive PIC32 development board to use with Microchip MPLAB, the Uno32 is a great deal that can possibly interface with a wide variety of shields from the Arduino world.

Disclaimer – The Chipkit Uno32 board reviewed in this article was a promotional consideration made available by element14.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, chipkit, digilent, microchip, PIC32MX320F128, review, uno32Comments (6)

Initial Review – Arduino v1.0 IDE

Hello Readers

Recently the Arduino team have released version 1.0 of the IDE (integrated development environment) that we all know and love. This is a significant milestone as the IDE has previously been in alpha release since 2005. For the platform to have survived and thrived this long is a credit to the community and especially to the Arduino team themselves.

Arduino? Not sure where to start? There’s a couple of tutorials right hereOr buy my book!

[Update 13/07/2013… this review is probably moot as the Arduino IDE v1 and greater has become prevalent. However if you’re still using v23 for some reason, keep reading]

Moving forward, let’s have a look and see what has changed:

Installation is quite simple. As always, download the IDE from the Arduino website. Before installing the new version, copy and backup your sketchbook folder and the entire folder system of your current IDE installation. This shouldn’t take long as … I’m sure everyone does this on a regular basis. The move to v1.0 is a major one, and you will still need to use the older IDE – so don’t delete it from your computer.

Once installed, copy over the contents of your ../arduino-002x/libraries folder to the new ../arduino-1.0/libraries folder. When your operating systems pauses and asks what to do with duplicate folders, click “skip”. That is, don’t overwrite the new libraries with old ones.

Now run the new IDE, and you will be presented with the following (note we have already loaded the “blink” example):

ide

The cosmetic changes in the design of the tool bar are slight yet refreshing. The buttons in order are: verify (we used to call this “compile”), upload sketch, file new, file open, file save and the serial monitor button has been moved across to the far right.

At the very bottom-right of the IDE window the board type and port connection is displayed – which is great if you are working with more than one Arduino board at once – a nifty feature. Furthermore when verifying and uploading a sketch, a progress bar appears at the top right of the message window, for example:

The last cosmetic change that became apparent is the automatic creating of hyperlinks in the sketch when the IDE detects a correctly-formatted URL, for example:

Cosmetic changes are all well and good, however that is only the tip of the iceberg. For starters, the file extension for sketches compatible with v1.0 is now .ino.

The next thing is to review the update release notes, also listed below with my own notes – where a lot of surprises can be found. As listed below, several functions and libraries have changed in behaviour or existence. Therefore some work may be required to convert sketches from v23 IDE to v1.0. At the current time I can’t see any reason to do this, and if you have any projects relying on existing libraries – make a backup copy of your existing environment in case the original source of the library disappears. The Arduino team have mentioned the idea of a centralised repository for libraries, however this has not been finalised at the time of writing this article.

The new Serial.print() behaviour is interesting. Let’s compare the output of the following sketch:

Using IDE v23, the output from the serial monitor is:

However when we run the same sketch in IDE v1.0, the output is:

So if you need the actual ASCII characters represented by the BYTE variable, use Serial.write() not Serial.print().

Well this is interesting. The ability to parse incoming serial data will make using that nefarious GSM shield easier…

One less library to worry about…

This should help us use memory more efficiently…

Frankly I’m not a genius when it comes to the Internet area, however clearer naming is a plus 🙂

Looks like another mental note to make when working with I2C and v1.0

Well this is a win, now multiple forms of data can be logged into separate files. As mentioned at the start, this is an initial review and by all means not complete. Feel free to leave your comments or notes for others to review as well, and as always if you find any errors please let us know.

For now the new IDE is an interesting juncture in the Arduino evolution. For new sketches and development in general there wouldn’t be any reason not to use it, as you can happily run several versions of the IDE on a single computer. However – there is a lot of published material that will not work with the new IDE – and all this will need to be updated, or at least noted by the authors concerned telling people to use an older IDE. And for this I am not too happy – the Arduino world has had a virtual “axe” chopped through it, breaking a lot of things which will take some time to move forward from.

So in the meanwhile, backup your existing libraries, your older IDE software, and be prepared to run two IDE systems in parallel for the near future.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, IDE, product review, review, tutorialComments (6)


Subscribe via email

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: