Thursday, June 30, 2016

I2C on the C2000 LaunchPad

Alright, let's see what the (only?) peripheral that doesn't have APIs in the peripheral driver library offers us - yeah, we're forced to combine the nasty software driver model with the direct register access model :(. Running short on any examples or whatsoever (literally the only example is a messy I2C EEPROM controlling program, but believe me, it's highly over-complicated), I had a fear that it will be long, complex and difficult task to use I2C without APIs; the C2000 isn't a simple MCU after all, there's so much to configure if we go by the manual way. However, after spending more than a day studying the I2C Module Reference Guide, I can now say that while it was a tough experience, I had no reason to fear.

Monday, June 27, 2016

LED control using UART on the C2000 LaunchPad

Continuing from where we left off in the previous article, we're going to make use of the SCI (UART) peripheral on the C2000 in order to toggle the on-board LEDs using PuTTY.

Sunday, June 26, 2016

C2000 programming basics, code skeleton

In this article we're going to put together our first C2000 application to control the on-board LEDs.
Parts of this article are based on an old article from the Forty-Two, and now? blog. Huge thanks to that guy, as I learned some of the basics there - I'm just going to extend and update that article a bit here, as the original one was written in 2012.


Introduction to the C2000 LaunchPad

Before jumping into the middle, let me introduce myself - I'm a student studying computer engineering in Hungary, less than a year away from getting my degree, so I have to work on my thesis. Without going into the details, let's just say that at the moment, I need an MCU for PWM control, I2C communication, and some simple GPIO switching, plus, it has to communicate with remote devices over UART. More requirements might be added in the future.


I spent a couple days thinking what MCU to use - of course, the first that came into my mind was the Arduino. I have several of them, used for various rather simple projects and experiments - I actually have a couple ATMEGA328P chips and a programmer as well, I can say that I really like them - ATMEGA MCU's have a relatively short learning curve, I was able to make use of most parts of the hardware (ie. PWM, I2C, TWI/UART) without having to use the Arduino libraries at all (I used Atmel Studio, direct register access).
However, I have decided not to use an AVR/Arduino for my thesis. I always wanted to write about something new and interesting. Since half of the project is about the MCU and the software running on the it, I simply couldn't say too much new things if I used an AVR - there are plenty of guides and tutorials out there about it, as they're the most popular devices for hobbyists (thanks to their simplicity and effectiveness, I guess), a lot of the professors at the university know them in and out. Instead, I wanted to use something new and interesting - an MCU that is widely used in the industry, yet not known widely.