TI eZ430 Watch – Unboxing and Hello World


It’s been almost a month since my last post, and this is due among others, to some August holidays in France… This being the 1st week-end back in London I thought I HAD to hack something and blog about it… :)

While away I have received the eZ430 Chronos Development Tool / Watch from Texas Instruments (have I ever mentioned how great their service is, how quick and free the delivery, etc. … !? ) and therefore had to put aside my Android / IOIO related projects, and delve into this new gadget !

1. First impressions

TI eZ430 Watch Box

The packaging looks good, as good or even better than “real” watches… !

TI eZ430 Watch opened box

TI eZ430 Watch box contents

The contents are quite impressive, and TI seems to be taking these eval kits quite seriously : not only they include the USB programmer / debugger and an USB wireless access point for remote communication, but even a screwdriver and a couple of spare screws…

Have I mentioned that this kit costed me only 25$ (on sale from the original 50$) including free shipping to the UK !?  I know it’s all about advertising their products, but still… THANK YOU TI, this is a lot of stuff for ~ 15£ !

Now let’s get down to business and try to program this “beast”…

2. Connect the hardware

This is quite easy, and here’s how it looks with the internals exposed:

TI eZ430 Watch Internals

And now connected to the USB programmer / debugger :

TI eZ430 Watch Connected to the PC

3. Software environment

Now the hard stuff commences…

First look at the “Sports Watch” code (basically the firmware that the watch comes with) reminds me why I’m a Java programmer by trade…

Then I install the IAR development environment and all of a sudden memories from high school rush back to my mind… haven’t these guys notices we’re in 2011 !

I can’t even seem to be able to open an existing project… lol…

I try Code Composer Studio… much better, Eclipse based… Java rocks indeed, at least for the IDE !

Code Composer Studio - TI eZ430

Ok, I know that I’m just a newbie when it comes to embedded electronics and that IAR is probably one of the best tools out there, but hey I want to have fun, I’m not paid to do this ! It’s enough that I have to program these little marvels in C and that even the slightest string manipulation takes 5 lines of code, I want to enjoy my hobby ! :)

One issue worth nothing is also the general slowness of both the compilation and the download of the firmware to the eZ430. It takes around 1min 20secs even for the slightest change to get re-compiled and transfered over.

 

4. My first program

All I want to do is create a new mode on the watch that simply displays “Hello World”. To make things slightly more complex, and because there are not enough digits, I want the text to scroll.

I struggle a couple of hours on a Friday night but finally start to appreciate TI’s code… it’s quite clean and well organised, in some sort of state machine.  All I need to do is replicate the already existing code for the “acceleration” mode (the one that periodically reads the accelerometer chip and displays the values on the screen).

1. the code for the new MODULE

The HEADER - trandi.h

#ifndef TRANDI_H_
#define TRANDI_H_

// ******************************************
// Defines section
#define TRANDI_MODE_OFF		(0u)
#define TRANDI_MODE_ON		(1u)

// ******************************************
// Global Variable section
struct trandi
{
	// TRANDI_MODE_OFF, TRANDI_MODE_ON
	u8			mode;
	// Data to display
	u8  		msg[20];
};
extern struct trandi sTrandi;

// ******************************************
// Extern section
extern void reset_trandi(void);
extern void sx_trandi(u8 line);
extern void display_trandi(u8 line, u8 update);
extern u8 is_trandi_active(void);
extern void do_trandi_random(void);

#endif /*TRANDI_H_*/

The IMPLEMENTATION – trandi.c

// ******************************************
// Include section

// system
#include "project.h"

// driver
#include "display.h"
#include "vti_as.h"

// logic
#include "trandi.h"
#include "simpliciti.h"
#include "user.h"
#include "string.h"

// ******************************************
// Global Variable section
struct trandi sTrandi;

// ******************************************
// Extern section

// ******************************************
// @fn          reset_trandi
// @brief       Reset / INIT trandi data.
// @param       none
// @return      none
// ******************************************
void reset_trandi(void)
{
	// Reset state is not active
	sTrandi.mode = TRANDI_MODE_OFF;

	strcpy(sTrandi.msg, (u8*)"TRANDI HELLO WORLD  ");
}

// ******************************************
// @fn          sx_trandi
// @brief       Button UP does nothing for now...
// @param       u8 line		LINE2
// @return      none
// ******************************************
void sx_trandi(u8 line)
{

}

// ******************************************
// @fn          display_trandi
// @brief       Display routine.
// @param       u8 line			LINE1
//		u8 update		DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_CLEAR
// @return      none
// ******************************************
void display_trandi(u8 line, u8 update)
{
	if (update == DISPLAY_LINE_UPDATE_FULL)
	{
		display_chars(LCD_SEG_L1_3_0, sTrandi.msg, SEG_ON);
		display_symbol(LCD_ICON_HEART, SEG_ON_BLINK_ON);

		// Set mode
		sTrandi.mode = TRANDI_MODE_ON;
	}
	else if (update == DISPLAY_LINE_UPDATE_PARTIAL)
	{
		display_chars(LCD_SEG_L1_3_0, sTrandi.msg, SEG_ON);
	}
	else if (update == DISPLAY_LINE_CLEAR)
	{
		display_symbol(LCD_ICON_HEART, SEG_OFF);

		reset_trandi();
	}
}

// ******************************************
// @fn          is_trandi_active
// @brief       Returns 1 if trandi module is currently active and needs doing random stuff.
// @param       none
// @return      u8		1 = trandi module needs random stuff
// ******************************************
u8 is_trandi_active(void)
{
	return sTrandi.mode == TRANDI_MODE_ON;
}

void do_trandi_random(void)
{
	// Move the text
	u8 firstElem = sTrandi.msg[0];
	u8 len = sizeof(sTrandi.msg) / sizeof(u8);
	u8 i;
	for(i = 0; i < len - 1; i++) sTrandi.msg[i] = sTrandi.msg[i+1];
	sTrandi.msg[len - 1] = firstElem;

	// Set display update flag
	display.flag.update_trandi = 1;
}

2. modify the main MENU

In the menu.c define this new structure

// Line1 - Trandi secret function
const struct menu menu_L1_Trandi =
{
	FUNCTION(sx_trandi),				// direct function
	FUNCTION(dummy),					// sub menu function
	FUNCTION(display_trandi),			// display function
	FUNCTION(update_trandi),			// new display data
	&menu_L1_Alarm,
};
u8 update_trandi(void)
{
	return (display.flag.update_trandi);
}

Add it to the chain of L1 menus, after the “Time” one, like so:

const struct menu menu_L1_Time =
{
	FUNCTION(sx_time),			// direct function
	FUNCTION(mx_time),			// sub menu function
	FUNCTION(display_time),		// display function
	FUNCTION(update_time),		// new display data
	&menu_L1_Trandi,
};

3. modify the MAIN logic

In main.c , update init_global_variables() with a pointer to the new menu (if we want it to be displayed by default) and a call to reset_trandi().

void init_global_variables(void)
{
	// --------------------------------------------
	// Apply default settings

	// set menu pointers to default menu items
//	ptrMenu_L1 = &menu_L1_Time;
	ptrMenu_L1 = &menu_L1_Trandi;
//	ptrMenu_L1 = &menu_L1_Alarm;
//	ptrMenu_L1 = &menu_L1_Heartrate;
...................
	// Reset acceleration measurement
	reset_acceleration();

	// Reset / init trandi stuff
	reset_trandi();

	// Reset BlueRobin stack
	reset_bluerobin();
}

Also add if (request.flag.trandi) do_trandi_random(); in process_requests().

4. update the TIMER calls to enable scrolling

There’s plenty of stuff in timer.c and we need to add a trigger on one of the periodic events, so that the trandi module gets “woken up” periodically and moves the custom string left.

Initially timer.c is EXCLUDED from the build, simply because I’m using the Core Edition of CSS which limits the max size of the code compiled (have I told you how much I love Arduino and the Open Source community !? :) ). However I could easily add back this file to be compiled with the others, without going beyond the limit … hooray…

In TIMER0_A0_ISR() (this is called every second which is really what we want !):

	// Send a signal / do some random stuff every second on Trandi, WHEN enabled
	if (is_trandi_active())
	{
		request.flag.trandi = 1;
	}

	// If BlueRobin transmitter is connected, get data from API
	if (is_bluerobin()) get_bluerobin_data();

And that’s it ! The text “TRANDI HELLO WORLD” scrolls on the L1 display ! (notice that understandably there’s no easy way to fit a “W” in a 7 segments digit, so it’s not displayed correctly, I get a “-” instead…lol..;) )

At the end of the day, it’s not terribly complex, it works and it took me only about half a day to get here…

If you’re reading this, then thank you for your patience and interest, and please don’t forget to leave your feedback which would be more than appreciated !

About these ads

51 Responses to TI eZ430 Watch – Unboxing and Hello World

  1. Batuhan says:

    Hi, I bought a Chronos and installed CCS over Eclipse. I am new at this area. Therefore I have a question for you. How do you import original code into Eclipse ? and where did you import original source code from?

  2. Sugs says:

    Hi Dan,

    Thanks for the great post. So far it’s looking good however there is one error:

    struct “” has no field “update_trandi” at return “(display.flag.update_trandi)”. I know this question was already asked and I looked for a similar structure so I can copy from the same definition of the structure and add the relevant extra field from the code posted below but I couldn’t find it in the workspace. Here is an example where I couldn’t find the location.

    u8 update_temperature(void)
    {
    return (display.flag.update_temperature);
    }

    Could you lead me to the right file to where I can find these. By the way, I am trying to use this for a biomedical application.

    Thanks,
    Sugs

  3. Orphee says:

    Hello and thanks for share

    I’m french so sorry for faults.
    I just bought eZ430 watch and would like to learn how to program it.
    My BIG problem, opening Code Composer Studio is to understand how to START
    I know how to program a PIC for example, using Mikroelectronica, PicKit … but here it seem me not clear at all, perhaps because my english is poor.
    So could you explain me:
    My watch is actually connected to USB port and, now, what to do exactly ? how to set the “CC430F6137″ processor, “new file” or “new project” …
    Could you explain me in simple words ?
    Thanks you

  4. Deepesh Agarwal says:

    Hi,

    I am planning to grab this one under the promo, I would like your help to decide if this fits the bill for my following needs :

    1). Connect to Raspberry Pi via the provided RF interface and supply temperature data which script on raspberry pi will upload to my website for realtime temperature updates.

    2). Control other RF devices by sending appropriate codes.

    Thanks

    • trandi says:

      1) YES I’ve never tried from Linux (for my post I’ve run everything in Windows), but from what I know it should work. Though if I were you I’d double check that the correct drivers are available for the RaspPi distribution

      2) this obviously depends completely of the other RF devices you want to control. Are they compatible with this watch? What frequency protocol do they use ? Even this watch has 3 models, depending on the country you’re in (866, 900 and 433MHz or something like this)

      Hope this helps,
      Dan

      • Deepesh Agarwal says:

        Hi Dan,

        Thanks a lot for the quick reply. It does work on Raspberry Pi (Debian Wheezy) and yes I am aware of the RF freq. so will take care of that.

        Thanks

      • trandi says:

        No problem. Great, then it sounds good. The only question is then, will the watch always be in range for the RaspPi? Or do you plan on storing data on the watch until it comes close enough to the RaspberryPi and then send over all the history since the last synchronisation?

        dan

      • Deepesh Agarwal says:

        The idea is to sync data when in range.

  5. ZED says:

    Hi trandi
    I have found ur application very nice and trying to do that. But please can u tell me how u included timer.c to the build. thank u!

  6. p. says:

    Hi,
    I recently received my ez430 – but didn’t noticed any cd in the box.
    Is there any image of this cd somewhere to download ?

  7. Santosh says:

    How Do I reset my Watch? I did programming of hi EArth and now my watch is showing the same thing all time..

  8. Tori says:

    Hi trandi,
    Awesome work with this!
    Just a quick question, I’m using the source files from http://sourceforge.net/projects/ez430chronos/ for the Chronos firmware yet can’t seem to find the menu.c file that you used. Is this file automatically included in the firmware and if so is there any chance you could please point me to its location?
    Any advice would be greatly appreciated, especially as your clear documentation above has been helping me get to grips with how different bits of the code work.
    Cheers,
    Tori

    • trandi says:

      Hi Tori,

      I’m glad you found my post useful.
      I’m not familiar with the firmware that you mention in your question, I remember using the original one, this alternative one from sourceforge.net didn’t exist back then…
      In any case I can’t seem to find the project on my computer, so I’m not even able to tell you where exactly the main.c was on my version of the project…

      Sorry I can’t be of more help than that…

      Dan

  9. agg23 says:

    How did you modify the request struct in project.h without it throwing errors (since there are precomplied libraries)?

  10. Joey says:

    Hi trandi,

    I just used this to break in my new chronos toy. It works great!! Have you done anything with the watch since this posting? I have a few projects in mind, but still looking for other ideas

    Joey

    • trandi says:

      Hi Joey,

      I’m really glad it was helpful!
      No, I worked on other projects since then, and for the last several months I’ve more or less stopped doing anything for my hobby due to other personal stuff… but I hope to start “playing around” again this summer…

      I’m curious to hear / see your other ideas !

      Dan

      • Joey says:

        Ok, the idea I’m running with now is to use the watches architecture to monitor household devices and combine TIs newest eval kit the CC3000 to broadcast over the internet…..lots work ahead, but that’s the fun part right? I’m also setting up a blog site with my wife and my many hobbies. btw my strong point is LabVIEW front end software, so if you need a quick interface executable to interact with any of your projects let me know.

      • trandi says:

        Quite a classic idea, but still interesting… I guess the “devil is in the details” and how well it will be put together…

        Thanks for the offer, I’m a programmer by day myself, so usually I don’t have an issue with putting together the PC side of the software, but I haven’t done LabVIEW in at least 15 years since the beginning of university… lol…:)

        Dan

  11. toon says:

    now i can reloaded that into my watch.
    and i found a problem.
    “trandi hello world” is not scroll.

  12. toon says:

    When I try to build the project I get a error saying “struct “” has no field “update_trandi.” in menu.c at return (display.flag.update_trandi); ???

    • trandi says:

      Indeed.
      The code I pasted on my post is only as an indication, so I haven’t put there the complete list of modifications.
      You’ll simply have to go to the definition of the structure and add the relevant extra field. (it’s the same type as the other ones in there, so just copy / paste and change the name)

      Dan

  13. newbee says:

    How did you load the firmewarefiles like projekt.h in your CCS?
    If i import the files i get a lot of errors so there is no projekt.h file in the folder, etc.

    • trandi says:

      Hi Paul,

      To be honest I don’t recall the details I have simply followed the instructions on the TI site to set up the project and all the rest.
      The only “difficulty” I remember about was the fact that you have to choose the right frequency (there are basically 3 versions of some of the project files, one for each frequency of the wireless communication).
      Other than that, it was straight forward…

      dan

  14. Kevin says:

    Hi, Trandi:

    Nice post!

    I follow your post and got the code compiled, but at the link stage (I am using IAR kickstart), I run into this error:

    Linking
    Error[e24]: Segment DATA16_AN (seg part no 2, symbol “TA0R” in module “stopwatch”, address [350-351]) overlaps segment DATA16_AN (seg part no 4, symbol “_A_TA0R_L” in module “BRRX_Radio”, address [350-351])
    Error while running Linker

    I don’t know where “BRRX_Radio” module is called in this project. Does this mean the code size overlimit?

    I included “timer.c” in build as you mentioned, also included “ports.c” to avoid warnings.

    Do you experienced same problem? Any suggestions?

    Thanks in advance!

    Kevin

    • trandi says:

      Hi Kevin,

      Thank you for your comment !

      I’m personally using CodeComposer 4 (have tried IAR but I feel like going back 20 years in time, and just seeing its GUI makes me cringe… :) ) and have never seen this error.

      But to be honest I’m far from an expert on this, I barely followed the tutorials myself…

      Sorry for not being able to help more…

      Dan

  15. hulu says:

    How do I transmit data[10-digit_code] from my laptop to the watch and store it in the watch ?

    next, I want to read the data from the watch[same data] from my laptop..how do I do it?

    Thanks

  16. Paul M. says:

    Nice work. I did have a question though.

    You’ve used “request.flag.trandi” in two places, namely in main.c as [if (request.flag.trandi) do_trandi_random();] and in timer.c as [request.flag.trandi = 1;].

    When I try to build the project I get two errors saying “struct “” has no field “trandi.”

    Why is this happening and how can fix it?

    thank you.

    p.s. to implement the “W” i’ve used “SEG_B+SEG_D+SEG_F” where the segments are labeled as such. It seems to be unique and looks okay.

    // A
    // _
    // F |_| B (G for the middle)
    // E |_| C
    // D

    • trandi says:

      Good point !
      I have actually updated the s_request_flags in project.h like so :

      // Set of request flags
      typedef union
      {
      struct
      {
      u16 temperature_measurement : 1; // 1 = Measure temperature
      u16 voltage_measurement : 1; // 1 = Measure voltage
      u16 altitude_measurement : 1; // 1 = Measure air pressure
      u16 acceleration_measurement : 1; // 1 = Measure acceleration
      u16 buzzer : 1; // 1 = Output buzzer
      u16 trandi : 1; // 1 = Do stuff in Trandi
      } flag;
      u16 all_flags; // Shortcut to all display flags (for reset)
      } s_request_flags;
      extern volatile s_request_flags request;

      But forgot to put this modif in this post…

      Update your struct accordingly and let me know if it works for you ?

      Hope this helps,
      Dan

      P.S. Thanks for the feedback on “W”…

      • Paul M. says:

        I had already updated the struct in display.h with “u16 update_trandi: 1;” but didn’t know where the request struct was.

        Cool! Thanks Dan. It works great.

        -Paul

      • trandi says:

        Great, glad it helped your !

        I’d be curious to see what exactly you’re doing with your watch, don’t hesitate to post a link to your project if you have put anything online…

        Dan

  17. hulu says:

    I am trying to make the watches communicate with each other how do I proceed ? Thanks

  18. Moris says:

    Nice software. I suggest you hghlight to inform the modification on process_requests.

    Thanks.

  19. lada1k says:

    I’ve also just started with this great toy:-)

  20. dirk says:

    _ |_| | | Most use the right char to display a “W” on 7 segment displays |_| _

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 142 other followers

%d bloggers like this: