TI MSP430

From ErikaWiki

Revision as of 21:27, 23 June 2011 by Steve (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Requirements

ERIKA for MSP430 microcontrollers currently supports the GCC toolchain: MSP430GCC. It can be downloaded from http://mspgcc.sourceforge.net/

MSP430 support

ERIKA Enterprise supports MSP430 microcontrollers.

RT-Druid support is working under both Linux and Windows hosts. See #Configuration

The MSP430 support includes:

  • support for single and multi stack configurations
  • isr interrupt not nested/nested supported
  • support for LPM management

Mode of operation

  • Mono-stack: This configuration of the ERIKA Kernel models the fact that all tasks and ISRs in the system share the same stack.
  • Multi-stack: Every task can have its private stack, or it can share it with other tasks.

LPM management

An important feature of MSP430 is management of low power consumption and this is possibile by LPM (low power mode). ERIKA Enterprise supports this feature. To use it you should set the option:

CPU_DATA = MSP430 {
	USELPM=TRUE
};

The functions available are:

  • void EE_msp430_enter_LPM(EE_UINT8 lpm): it allows to enter in a particular low power mode
  • void EE_msp430_exit_LPM(EE_UINT8 lpm): it allows to exit from a low power mode ( can be use only in ISR )
  • void EE_msp430_change_LPM(EE_UINT8 lpm): it allows to change a low power mode ( can be use only in ISR )


MCU

MCU support is defined using the following OIL object, substituting the relevant MCU type where appropriate:

    MCU_DATA = MSP430 {
        MODEL = CUSTOM {
            MODEL = "-mmcu=msp430x2012";
        };
};

If working directly with a Makefile, the MCU should be passed to the tool chain using the following directives:

CFLAGS  += -mmcu=msp430x2012
ASFLAGS += -mmcu=msp430x2012
LDFLAGS += -mmcu=msp430x2012

The following functionality is implemented:

  • Watchdog, using EE_watchdog_disable()
  • System clock, using EE_sysclk_init_1MHz() [also 8, 12 and 16 MHz supported depending on device type]

BOARD

UTMOST

Supported devices:

  • LED. Please use the USELEDS option.
BOARD_DATA = UTMOST {
    USELEDS = TRUE;
};

LaunchPad

General

OIL:

EE_OPT = "__MSP430_LAUNCHPAD__";

Makefile:

EEOPT += __MSP430_LAUNCHPAD__

Note that the msp430x2231 device variant supplied with the LaunchPad is not supported by MSPGCC version 4.4.3 so use msp430x2012 instead.

LEDs

There are two LEDs: red on P1.0 = led_0 ; green on P1.6 = led_1

OIL:

EE_OPT = "__USE_LEDS__";

Makefile:

EEOPT += __USE_LEDS__

API:

  • EE_leds_init()
  • EE_led_0_off()
  • EE_led_0_on()
  • EE_led_0_toggle()
  • EE_led_1_off()
  • EE_led_1_on()
  • EE_led_1_toggle()

BUTTONs

The LaunchPad has a single button on P2.3 = BUTTON_0

OIL:

EE_OPT = "__USE_BUTTONS__";

Makefile:

EEOPT += __USE_BUTTONS__

API:

  • EE_buttons_init()
  • EE_buttons_enable_interrupts (BUTTON_0) - raises interrupts on PORT1_VECTOR
  • EE_buttons_disable_interrupts (BUTTON_0)
  • EE_buttons_interrupt (BUTTON_0) - returns non-zero if button has raised interrupt
  • EE_buttons_clear_ISRflag (BUTTON_0) - clears pending interrupt
  • EE_buttons_get_state (BUTTON_0) - returns non-zero if button is currently pressed

Configuration

If you are trying to build under RT-Druid on Windows and see something like this:

MAKE_DIRECTORIES
CPP   eecfg.c
eecfg.c:1:16: error: ee.h: No such file or directory
eecfg.c:4: warning: data definition has no type or storage class
eecfg.c:4: warning: type defaults to 'int' in declaration of 'DeclareTask'
eecfg.c:4: warning: parameter names (without types) in function declaration
eecfg.c:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_hal_thread_body'
eecfg.c:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_th_ready_prio'
eecfg.c:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_th_dispatch_prio'
eecfg.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_th_next'
eecfg.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_th_nact'
eecfg.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_stkfirst'
eecfg.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_rqfirst'
eecfg.c:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EE_sys_ceiling'
make: *** [obj/eecfg.o] Error 1

... add a variable called "PLATFORM" with the value "WINDOWS" to your project environment variables (Project->Properties->C/C++ Build->Environment->Environment variables to set).

Acknowledgements

This port was provided by Christian Grioli.

The LaunchPad Board Support Package was added by Steve Langstaff

Personal tools