Hi, I managed to set up a Linux development environment for the ez430-RF2500 successfully, thanks to the TI forums and other helpful resources. Here is a description of how i did it, hope it helps someone. This has been tested on Gentoo Linux, kernel version 2.6.34.
25 June 2010
This document describes how to set up a development environment on Linux for the ez430-RF2500. Tested on Gentoo Linux, kernel version 2.6.34.
Basically we need to:
Configure the kernel so that we can view the serial port output from the board.
Setup the MSPGCC toolchain so that we can compile source code into a binary executable that runs on the MSP430.
Install MSPDebug so that we can flash the binary executable onto the RF2500 board.
Download the SimpliciTI library, which is needed to use the CC2500 radio, and modify some code so that we can compile the library using MSPGCC. Note that we don’t need to use the entire library but we need 2 entities: the Minimal RF Interface (MRFI) and the Board Support Package (BSP). The MRFI and the BSP are described in [5].
Create a Makefile for development.
The recommended kernel version is >2.6.31, it seems [1]. When configuring the kernel, enable USB Serial Converter support, USB TI 3410/5052 Serial Driver, and USB Modem (CDC ACM) support.
Device Drivers ---> [*] USB support <M> USB Modem (CDC ACM) support <M> USB Serial Converter support ---> <M> USB TI 3410/5052 Serial Driver
Download radhermit’s MSP430 overlay [2] and add it to the Gentoo system. Untar it into /var/lib/pizu-overlay and add to /etc/make.conf:
# must be below sourcing of layman’s make.confPORTDIR_OVERLAY="${PORTDIR_OVERLAY} /var/lib/pizu-portage-overlay"
Emerge sys-devel/crossdev from this overlay.
Install the MSPGCC toolchain with GDB support:
sudo crossdev --ex-gdb msp430
After crossdev successfully creates the toolchain, symlink the ldscripts folder into a place where the linker will find it. Run:
sudo ln -s /usr/$CHOST/msp430/lib/ldscripts /usr/msp430/lib/ldscripts
where $CHOST is something like x86_64-pc-linux-gnu or i686-pc-linux-gnu for standard amd64 or x86 architectures running Gentoo.
Download MSPDebug from [3].
Unpack, compile and install the source:
tar xvfz mspdebug-version.tar.gzcd mspdebug-versionmakemake install
Create a new udev rule named /etc/udev/rules.d/99-msp430.rules:
ATTRS{product}=="Texas Instruments MSP-FET430UIF", MODE="0660", GROUP="plugdev"
Now all users in the plugdev group should be able to access the device.
Information here is from [6].
Download the latest release of SimpliciTI from [7]. Choose the version for IAR.
Create a development folder where the source code and modified SimpliciTI will reside.
Copy the bsp/ and mrfi/ subfolders from Components/ into the development folder.
Optional: Some of the code is unused and can be removed. CC2500 is a Family 1 radio, so remove unused radios (Family 2 to Family 5) from mrfi/radios/. Remove unused boards from bsp/boards/.
Optional: For the complete SimpliciTI stack, copy the simpliciti/ subfolder from Components/ into the development folder.
Modify bsp/mcus/bsp_msp430_defs.h.
Replace the line:
#error "ERROR: Unknown compiler."
with:
#include <io.h>#include <signal.h>#include <iomacros.h>#define __bsp_ISTATE_T__ uint16_t#define __bsp_ISR_FUNCTION__(f,v) interrupt (v) f(void)#define __bsp_ENABLE_INTERRUPTS__() eint()#define __bsp_DISABLE_INTERRUPTS__() dint()#define __bsp_INTERRUPTS_ARE_ENABLED__() (READ_SR & 0x8)#define __bsp_GET_ISTATE__() (READ_SR & 0x8)#define __bsp_RESTORE_ISTATE__(x) st(if((x&GIE))_BIS_SR(GIE);)
Modify bsp/drivers/code/bsp_generic_buttons.h.
Remove the line:
#error "ERROR: Debounce delay macro is missing."
Optional: If the simpliciti/ folder was copied, modify simpliciti/nwk/nwk_QMgmt.c.
#include <intrinsics.h>
Modify mrfi/mrfi_defs.h.
Change all occurrences of
#define __mrfi_MAX_PAYLOAD_SIZE__ 20
to
#define __mrfi_MAX_PAYLOAD_SIZE__ 53
To compile for the MSP430F2274, do:
msp430-gcc -o zzz -mmcu=msp430x2274 zzz.c
To upload the program to the board:
mspdebug -R “prog zzz”
Watch the serial output using minicom. The device is /dev/ttyACM0, 9600 baudrate.
# Adapted from Makefile example at# http://senstools.gforge.inria.fr/doku.php?id=lib:simpliciti:example# Includes only BSP and MRFI entities, not the whole SimpliciTI stack.SIMPLICITI_COMPONENTS_PATH = ./BSP_PATH = ${SIMPLICITI_COMPONENTS_PATH}/bspMRFI_PATH = ${SIMPLICITI_COMPONENTS_PATH}/mrfiBOARD = EZ430RFCPU = msp430x2274RF = -DMRFI_CC2500INCLUDES = -I${MRFI_PATH}/ \ -I${BSP_PATH}/ \ -I${BSP_PATH}/drivers/ \ -I${BSP_PATH}/boards/${BOARD}/ \OBJECTS = bsp.o mrfi.oCC = msp430-gccCFLAGS = -DMAX_HOPS=3 ${RF} ${SMPL_NWK_CONFIG} -mmcu=${CPU} -O2 -Wall -g ${INCLUDES} all: zzzclean: rm -f ${OBJECTS} zzz%.o: %.c $(CC) ${CFLAGS} -c -o $@ $<mrfi.o: ${MRFI_PATH}/mrfi.c ${CC} ${CFLAGS} -c $< -o $@ @echo CC $<bsp.o: ${BSP_PATH}/bsp.c ${CC} ${CFLAGS} -c $< -o $@ @echo CC $<zzz: zzz.c ${OBJECTS} $(CC) ${CFLAGS} -o zzz zzz.c ${OBJECTS}
[1] http://www.koka-in.org/~kensyu/handicraft/diary/20100419.html
[2] Radhermit’s MSP430 Gentoo overlay - github.com/radhermit/msp430-overlay
[3] MSPDebug - http://mspdebug.sourceforge.net/
[4] MSPGCC - http://mspgcc.sourceforge.net/ and http://mspgcc4.sourceforge.net
[5] SimpliciTI Developers Notes
[6] Setting up the MSP430 environment - http://www.tooz.us/projects/MSP430/
[7] SimpliciTI TI Software Folder - http://focus.ti.com/docs/toolsw/folders/print/simpliciti.html
Hi. Very impresive the path you have follow. I'm new in microcontrollers programming and also in linux (ubuntu 10.04 user). I've looking for a lot of data to get the ez430-rf2500 working under linux. With the mspdebug installed I've tested some short programs and they work fine, but I don't know if it's necesary to modify de kernel so you can watch the port in minicom. When I had the demo program written in the MCU I tried to watch the data received using minicom, but it said something like ttyACM0 wasn't a modem or so. Could you paste the source where you got how to configure the kernel, please?
Another question, have you tried the "demo" temperature program compiled in mspgcc and seen the data through minicom?
I hope you can help me.
Thanks.
In reply to sennin.apprentice:
My guess is that it's a kernel configuration issue. The steps for compiling the kernel can be found here: http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
In the kernel config (step 2), make sure these are enabled:
After plugging in the ez430, try typing "dmesg"; you should see something like this:
usb 4-1.2: new full speed USB device using uhci_hcd and address 8hub 4-1.2:1.0: USB hub foundhub 4-1.2:1.0: 4 ports detectedusb 4-1.2.2: new full speed USB device using uhci_hcd and address 9cdc_acm 4-1.2.2:1.0: This device cannot do calls on its own. It is not a modem.cdc_acm 4-1.2.2:1.0: No union descriptor, testing for castrated devicecdc_acm 4-1.2.2:1.0: ttyACM0: USB ACM device
I have not tried the demo temperature program...
In reply to seadreamer:
Hello, I am currently working on my Final Year Project and I am using ez430-rf2500,SimpliciTI protocol. I used your method suggested in the previous post that there's something that we need to replace in the original code. So, I followed what you did, and i got some errors. I don't know whether is it the same for the protocol that I am using now, with the protocol that you are using. Can you please guide me through, as I don't know why i get the error, they say
Fatal Error[Pe035]: #error directive: "ERROR: Unknown or missing radio selection." C:\Users\songye\Desktop\demo\20th_try\Components\mrfi\mrfi_defs.h 100
What does that mean, since I've already removed all the unnecessary radio in the Simpliciti folder I downloaded.
Regards.
In reply to songye ho:
Well. you really shouldn't be doing what I did because you are using Windows and probably IAR. I'm using Linux with mspgcc... Unfortunately I'm a Windows noob with zero IAR experience so I can't help you.
Or, you could just switch to Linux ;)
seedreamer,
Thanks for this excellent post. I could program and get working the compiler as well as mspdebug to program the board. Great work!
Just have a question, regarding what you say to "Watch the serial output using minicom. The device is /dev/ttyACM0, 9600 baudrate.", do you require anything else to run minicom? I want to have access to the serial but I'm unable to. I configured minicom with those settings and I just get the following message (either as my user or root):
minicom: cannot open /dev/ttyACM0: No such file or directory
The messages file indeed sees the board as ACM0:
Oct 4 00:29:31 w00292 kernel: [10919.890156] cdc_acm 7-1:1.0: ttyACM0: USB ACM deviceOct 4 00:29:41 w00292 kernel: [10929.954256] generic-usb 0003:0451:F432.0002: timeout initializing reportsOct 4 00:29:41 w00292 kernel: [10929.954522] generic-usb 0003:0451:F432.0002: hiddev96,hidraw0: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1d.2-1/input1
Any help would be appreciated.
In reply to MEDARZ:
try doing:
ls /dev/tty*
and post the output?
I also managed to get the serial output using:
stty 9600 -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -F /dev/ttyACM0
cat /dev/ttyACM0
Occasionally there are input/output errors for which I have to unplug and replug the USB programmer..
Hi seadreamer,
Thanks for your quick response. I've been playing with the board for some time but unfortunately still haven't been able to see its UART.
Here is the output of the command:
mario@medarz:~$ ls /dev/tty*
/dev/tty /dev/tty19 /dev/tty3 /dev/tty40 /dev/tty51 /dev/tty62
/dev/tty0 /dev/tty2 /dev/tty30 /dev/tty41 /dev/tty52 /dev/tty63
/dev/tty1 /dev/tty20 /dev/tty31 /dev/tty42 /dev/tty53 /dev/tty7
/dev/tty10 /dev/tty21 /dev/tty32 /dev/tty43 /dev/tty54 /dev/tty8
/dev/tty11 /dev/tty22 /dev/tty33 /dev/tty44 /dev/tty55 /dev/tty9
/dev/tty12 /dev/tty23 /dev/tty34 /dev/tty45 /dev/tty56 /dev/ttyACM0
/dev/tty13 /dev/tty24 /dev/tty35 /dev/tty46 /dev/tty57 /dev/ttyS0
/dev/tty14 /dev/tty25 /dev/tty36 /dev/tty47 /dev/tty58 /dev/ttyS1
/dev/tty15 /dev/tty26 /dev/tty37 /dev/tty48 /dev/tty59 /dev/ttyS2
/dev/tty16 /dev/tty27 /dev/tty38 /dev/tty49 /dev/tty6 /dev/ttyS3
/dev/tty17 /dev/tty28 /dev/tty39 /dev/tty5 /dev/tty60
/dev/tty18 /dev/tty29 /dev/tty4 /dev/tty50 /dev/tty61
Also, executing the commands that you suggested throws me what you were saying about input/output errors. The thing is that I always have these errors when trying to read from the device:
mario@medarz:~$ stty 9600 -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -F /dev/ttyACM0
stty: /dev/ttyACM0: Input/output error
mario@medarz:~$ cat /dev/ttyACM0
cat: /dev/ttyACM0: Input/output error
I remove the board and plug it in, chech which number it is assigned (ACM0, ACM1.. etc) and execute the commands again, and the result is the same error.
Regards,
Hi,
Same issue here as MEDARZ.
Using Fedora 14 with msp430-gcc and mspdebug from Fedora repos. Kernel is 2.6.35.10-74.fc14.i686
/dev/ttyACM0 is created but can't be accessed with minicom
P.S. There seems to be some possibly relevant discussion here: http://groups.google.com/group/ti-launchpad/msg/1dacabc8a4f00ab6?pli=1
In reply to Konstantin Svist:
Thank you Konstantin, Konstantin Svist P.S. There seems to be some possibly relevant discussion here: http://groups.google.com/group/ti-launchpad/msg/1dacabc8a4f00ab6?pli=1 ".. More investigation still seem to indicate a buffer on the ti chip's side fills up and then asks for a disconnection ..."
Thank you Konstantin,
Konstantin Svist P.S. There seems to be some possibly relevant discussion here: http://groups.google.com/group/ti-launchpad/msg/1dacabc8a4f00ab6?pli=1 ".. More investigation still seem to indicate a buffer on the ti chip's side fills up and then asks for a disconnection ..."
".. More investigation still seem to indicate a buffer on the ti chip's side fills up and then asks for a disconnection ..."
In my case, that was the key. Prior to successfully establishing a serial connection to the MSP430F2274, I would get "/dev/ttyACM0: No such file or directory". Even though /dev/ttyACM0 existed and I could clearly see from dmesg that ttyACM had been created:
[2071821.184142] usb 5-1: USB disconnect, address 58[2071821.920058] usb 5-1: new full speed USB device using uhci_hcd and address 59[2071822.123940] usb 5-1: configuration #1 chosen from 1 choice[2071822.133877] cdc_acm 5-1:1.0: This device cannot do calls on its own. It is not a modem.[2071822.133883] cdc_acm 5-1:1.0: No union descriptor, testing for castrated device[2071822.133905] cdc_acm 5-1:1.0: ttyACM8: USB ACM device[2071832.184653] /build/buildd/linux-2.6.31/drivers/hid/usbhid/hid-core.c: usb_submit_urb(ctrl) failed[2071832.184665] generic-usb 0003:0451:F432.003C: timeout initializing reports[2071832.184796] generic-usb 0003:0451:F432.003C: hiddev96,hidraw3: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1d.3-1/input1
Trying to use "minicom -s" to open a /dev/ttyACMx would results in the "No such file or directory" error. The TI chip (with the default firmware) appears to overflow the serial buffer and disconnect before a serial program has the chance to open the port and drain the buffer. Or so I thought. The situation turned out to be a bit more complex (maybe someone here can explain why the following works for me).
The following seems to be working for me: Unplug the TI module from the TI usb programmer . Plug the TI usb programer into a usb port. Plug the TI module into the the TI usb programmer. Use "mspdebug rf2500" to connect to the MSP430F2274 and reset it (this will prevent the serial buffer from constantly being overflowed and consequently causing the serial port to close?). In a different terminal (as specified above):
stty 9600 -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -F /dev/ttyACM0 cat /dev/ttyACM0 Back in mspdebug, run the firmware. Back in the terminal with the "cat /dev/ttyACM0" I can see the serial output from the MSP430F2274. Note: if I establish a serial connection to the /dev/ttyACMx port after plugging the the programmer , but prior to plugging in the TI module, when the TI module is plugged in, the ttyACM serial connection closes and the ttyACM port number increaments (in my dmesg above you may have noticed that I've already reached ttyACM8). Only by stopping the overflow of the serial buffer (by using mspdebug) was I able to successfully open a serial connection to the device.
Back in mspdebug, run the firmware. Back in the terminal with the "cat /dev/ttyACM0" I can see the serial output from the MSP430F2274.
Note: if I establish a serial connection to the /dev/ttyACMx port after plugging the the programmer , but prior to plugging in the TI module, when the TI module is plugged in, the ttyACM serial connection closes and the ttyACM port number increaments (in my dmesg above you may have noticed that I've already reached ttyACM8). Only by stopping the overflow of the serial buffer (by using mspdebug) was I able to successfully open a serial connection to the device.
In reply to Tyler Brandon:
Let me further clarify the "solution" that works for me (Ubuntu 9.10).
If I don't force the ttyACM port to increment then trying to establish a serial connection results in a "/dev/ttyACM: Input/output error". Once the serial connection is established, then the TI chip module can be stop/restarted, via mspdebug, without issue. However, once the serial buffer has been overflowed, the ttyACM port is dead and I need to force the ttyACM port increment to a fresh port to get it going again.