Skip to content
This repository

Is it possible to make Energia compatible with MSP-EXP430FR5739 Experimenter Board? Works!!! #70

Closed
Diecore opened this Issue June 13, 2012 · 28 comments

7 participants

Diecore robertinant Rick Kimball StefanSch Lucas Fragomeni Zac Manchester Rei Vilo
Diecore

Hi !

I have 2 MSP-EXP430FR5739 Experimenter Boards and i am wandering how difficult is to make Energia compatible on that platform?

Regards

Rick Kimball
Collaborator

Probably not that difficult. The FRAM board has more flash, ram, pins and timers than the g2553 so some code would actually be easier to get working. You just need to create a new variant directory, maybe call it msp-exp430fr5739 and assign pin numbers. The hardware serial code would be slightly different because the fr5739 chip has an EUSCI instead of a USCI. There are more leds on different ports and pins of course. An entry would have to be created in boards.txt that to pass build.mcu=msp430fr5739. The clock system is different and the existing clock initialization code wouldn't work. The java code that calls mspdebug would have to use "load" instead of "prog" because "prog" attempts to erase the flash, you don't need/can't erase the fram you just load code. All the code that uses any hardware specific features would have to be looked at so you can verify it works properly.

This would be a great addition, and with the impending Wolverine announcement sometime this month might put us in a better to position to take advantage of that new board also. (I'm guessing the Wolverine stuff is going to be similar in peripherals to the FR57XX series .. but I have no inside knowledge, I'm just hopeful it will )

StefanSch
Collaborator

it takes ~ 2 hours,
I just pushed my branch (Branch_F2274_Fr57xx_support) which has the basic support for both devices.
At least it does compile without errors and also brings the LED to toggle.
Feel free to start working and testing on it.
I have not changed the download option but in windows it works well, also here the erase is supported to initialize the FRAM.
EUSCI changes are not done , but clock and WDT and ADC10B setup are in.
~ Stefan

robertinant
Owner

Thanks Stefan! That's great. Don't have access to an FR board until early next week but will give it a try as soon as I do.

StefanSch
Collaborator

Please be aware - i made a lot of changes esp. for the handling of the PxSEL Register which get different names in the different device families. I am not sure if this is the best one but for sure a try. So any feedback is welcome.

Please also have a close look on the launchpad compatibility - i have not this hardware to test it at this time.

Lucas Fragomeni

Hey, I've tried it on Mac OS X and unfortunately it didn't work. Got the following error msg bellow.
Btw, is the rf2500 the write programmer for this device?


Binary sketch size: 748 bytes (of a 15,872 byte maximum)
fet: FET returned error code 14 (Could not erase device memory)
fet: erase command failed
ihex: error on line 40

robertinant
Owner

Could it be that you did not select the "LaunchPad w/ msp430fr5739" board from the board menu. A similar error code is given when compiling for e.g. msp430g2553 and then trying to program it into a msp430g2452. See also "Could not write device memory" on "https://github.com/energia/Energia/wiki/Common-error-messages"

Lucas Fragomeni

Its not that. I've seleted the board and the port.
What if I didn't build the distribution correctly? Actually, I've only overwritten the 'hardware' directory from the original dist by Stefan's.

StefanSch
Collaborator

Hi,
unfortunately i have no easy access to a MAC but i think Rick is right that the prog command may need to be replaced by load. On the windows system (tiusb) the eraseFunction is internally replace by an write mem so as soon as the debug driver knows that the connected device is an FRAM it does not call the Flash Erase but a Fill Mem function instead.
I have assumed that the RF2500 does the same but not 100% sure.
Lucas may you can do an local hack and excange in
...\app\src\processing\app\debug\MSP430Uploader.java
params.add("\"prog " + buildPath + File.separator + className + ".hex\"");
with
params.add("\"load " + buildPath + File.separator + className + ".hex\"");

I have assumed that this is handled by the Firmware inside the FET but i am not sure.

If this still would not work then it might be the driver RF2500 but for this i would need to dig much more into the mspdebug code.
It might be then also work to think about porting the TI open lib for the USB to the MAC and then use the tilib driver also on MAC and Linux but i think this could give some issues with the HID implementation.....

Thanks,
Stefan

robertinant
Owner

The load works perfectly. Now we need a clean way of distinguishing between FRAM and FLASH based parts.. How does the driver on windows detect that it is a FRAM part? I like the suggestion of using the TI open lib. What would it take to do this?

An easy fix for this would be to do an additional parameter in the board.txt file like xxxxx.memtype=fram.

Suggestions?

StefanSch
Collaborator

I got now the rf2500 also on my windows PC running (with patching the HID driver) but could not see the issue that the FRAM could not use the prog command. On the command line i get the same return with load and prog.

Robert can you just double check which version of mspdebug is included in the package
mspdebug --version

I put the TI open lib on my backlog - it could take some iterations till it is clean for all OS and interfaces (CDC/HID)

Thanks,
Stefan

Lucas Fragomeni

Guys, I can test it, no problem. The only inconvenient is that i'm not experienced in building that package. Can you guys generate a build so I can test?

robertinant
Owner

MSPDebug in Energia is @ version 0.19. This is the case for both Mac OS X as well as Windows.

robertinant
Owner

@lucasfragomeni, Looking at your previous posts it seems that you were already able to build Energia from source?
If so, then the only thing you would have to do is to patch MSP430Uploader.java as indicated above and rebuild as you have done before.

Diecore

I see there is a lot of "noise" here :)
is it possible to have an automated build? so i can also test it immediately without the need of building the source...

robertinant
Owner

Easiest would probably be to check out the repositories and copy the hardware/msp430/ directory form the git repository to the Energia distribution.

Diecore

The EXP430FR5739 works even better comapred to my try with launchpad with energia! (I had compiling/speed problems but maybe it just happened because my windows installation is bloaded...)

I just downloaded the EXP430FR5739 energia branch and as robertinant recommended i erased the hardware/msp430/ folder of energia and extracted the newone from the EXP430FR5739 energia branch.

I tested the blink demo and ASCII serial port demo and t works very good! I haven't tested the SPI yet.
Question where is the F_CPU definition? How can we change the RC OSC speed?
I know by default launchpad value line msp's osc is ~1 Mhz which is quite slow. I dont have any idea what is the default speed for the MSP430FR5739.

BTW whats the official foroum for energia? 430h?

StefanSch
Collaborator

Hi,
the F_CPU definition is in the wiring.c file (initClocks function). Here you can see which defines are implemented but originally i comes from the boards.txt file and goes into the system as define passed by the commandline.

Diecore

OK
Thanks Stefan

I just checked the boards.txt and i saw that the small msp430g2231 is configured to run at 1Mhz but it supports 16mhz like the other msp's except the FR series why?

robertinant
Owner

@Diecore, msp430g2231 DCO is only calibrated for 1MHz. You could run it at 16MHz but this requires manual calibration of the DCO using e.g. a external watch crystal.

Rick Kimball
Collaborator

This works. You can set your DCO frequency without any soldering. However, you do need to measure it with a frequency counter or an oscilloscope. P1DIR |= BIT4; P1SEL |= BIT4; /* enable SMCLK out on P1.4 */

// 16.025000 MHz as measured on my chip. Yours will be different
DCOCTL = 0;
BCSCTL1 = XT2OFF | (1 << 3 | 1 << 2 | 1 << 1) ;
DCOCTL = (1 << 7 | 1 << 6 | 1 << 5);

-rick

Zac Manchester

Hi! I'm trying to get Energia working with the CC430f5137 evaluation board (http://www.ti.com/tool/em430f5137rf900). I'm wondering if anyone can give me some hints or point me toward some documentation on how to get started. I've looked at StefanSch's commits for the ez430-rf and MSP-EXP430FR5739 and I realize I need to set up a "variant" and define the pin mappings. I eventually want to develop a library for using the CC430 radio. Any help is much appreciated!

Diecore

I assume you have and a MSP-FET430UIF JTAG programmer / debugger right?

That means that you also have to make an interface for the MSP-FET430UIF if its not already implemented to Energia ide or to use launchpad board for programming.

Zac Manchester

I'm actually using the launchpad debugger with the em430f4137rf900 board (with code composer at the moment).

StefanSch
Collaborator

To add a new device family to Energia you basically have to do the following steps:
(This should work without issues on Windows, it might have some driver adjustments on other OS (which i have no much experience)

If you would like to add a new EVM or device Family you should start with

  • create a new folder in

    with a descriptive name of the EVM or Device Family

    Extend the board.txt file with the sections describing the devcie features:
    (..../build/hardware/msp430/boards.txt

    lpmsp430fr5739.name=LaunchPad w/ msp430fr5739
    lpmsp430fr5739.upload.protocol=rf2500
    lpmsp430fr5739.upload.maximum_size=15872
    lpmsp430fr5739.bootloader.lock_bits=0x0F
    lpmsp430fr5739.build.mcu=msp430fr5739
    lpmsp430fr5739.build.f_cpu=8000000L
    lpmsp430fr5739.build.core=msp430
    lpmsp430fr5739.build.variant=EXP430FR57xx
    ##############################################################

    Note: Adjust the label at the beginning of the line to your devcie lp+devicename
    Use rf2500 if you have and ez430 or USB FET adapter till another driver is available

  • add Pining file (this is the biggest chunk of work to start)
    (..../hardware/msp430/variants/[evm_name]/pins_energia.h)

    I think the file is selfexplaing - or not?

  • finally for the full integration you may have do add and modify the peripheral parts in folder
    (..../hardware/msp430/cores/msp430)
    e.g.

    • clock setup in wiring.c
    • ADC integration and setup in wiring_analog.c

and HAVE FUN !!!

StefanSch
Collaborator

but would be great if you can share your experience so we may can put this into a Wiki as getting started

Zac Manchester

Thanks - that was very helpful. I'll definitely share.

Rei Vilo
Collaborator

If this issue is solved, could we close it?
Thanks.

robertinant robertinant closed this July 15, 2012
robertinant robertinant reopened this July 17, 2012
robertinant robertinant closed this August 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.