Jump to content
43oh

Programming an MSP430F2012IPW


Recommended Posts

The Launchpad and ez430 are essentially the same thing in different sizes. Same with the F2012IN and F2012IPW. Considering the low cost and the fact that I guess your company will be paying for it then ordering both sounds like a good idea. Anything you learn and any code you write will easily transfer between the two.

 

Were are you? I'm in the UK and could send you an EZ430 if you need it in a hurry. (I haven't got any F2012 target boards, just the very similar F2013 it comes with.)

Link to post
Share on other sites
  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Thanks for the offer, but I already ordered from a different company which had all items available for short-term delivery. So now I will probably bug you guys with the coding ;-)

 

Thanks you all very much for the advice so far! I hope I will be able to contribute to the commuity as I get more acquainted with the 4-3-oh

 

edit.: grammar

Link to post
Share on other sites

There are several companies involved, and I am brought in because of some disagreements between some of them. So I basically have to figure it all out.  I am not sure what you mean about "tag-connect footprint".

 

Ugh...hate it when that happens.  Surprised they brought you in if you don't have MSP430 experience though, but it's not too hard to pick up if you've done embedded and C programming before.

 

FWIW, you can jumper the pins over to your JTAG programmer.  I've done that before w/ the Olimex to work around the stupid pinout issue and I've done it using the Launchpad as well.  Max wire length is supposedly 6", but the tag-connect folks have used 10" cables w/o issues.

Link to post
Share on other sites

So I have been able to program the system with an ez430 and it works remarkably well. I have started making the I2C routines for communication with the on-board peripherals.

 

The device is to communicate with a PC through SPI. The wires are connected to P1.2, SCLK, SDO and SDI. So I need some kind of SPI interface for the PC. Is it possible to use the launchpad as an SPI to USB interface or would it be easier to just buy an SPI-USB adapter?

Link to post
Share on other sites

Why do you want to communicate to the PC over SPI?

UART is readily available in the form of FTDI cables.

At a later stage, there will be a wireless interface implemented in the design. This is set up to communicate via SPI. In any case, this is how it is designed.

Link to post
Share on other sites

If you REALLY want to do SPI to the computer, FTDI does make chips that do the conversion....they actually make I2C, SPI, UART and parallel FIFO converters.

 

http://www.ftdichip.com/Products/ICs.htm

 

 

A premade version would be a bus pirate, which allows you to manually send and receive raw data over the SPI bus...if you are already buying test gear it's one of the most valuable $30 I've spent, as it handles uart and I2C as well.

 

If you want to use the Launchpad it would be simple to write some code to relay info back and forth.  You would just need to write something to interpret an incoming command on the UART (if you want more than one command), do the SPI voodoo, then format and return the result on the UART.

Link to post
Share on other sites

If you REALLY want to do SPI to the computer, FTDI does make chips that do the conversion....they actually make I2C, SPI, UART and parallel FIFO converters.

 

http://www.ftdichip.com/Products/ICs.htm

 

 

A premade version would be a bus pirate, which allows you to manually send and receive raw data over the SPI bus...if you are already buying test gear it's one of the most valuable $30 I've spent, as it handles uart and I2C as well.

 

If you want to use the Launchpad it would be simple to write some code to relay info back and forth.  You would just need to write something to interpret an incoming command on the UART (if you want more than one command), do the SPI voodoo, then format and return the result on the UART.

 

Thank you. I might look into an FTDI IC at a later stage. For now, I've decided to use an Arduino to act as the SPI master.

 

There is only one slave, which will be the MSP430. I have configured the USI for SPI operation in slave mode as follows:

 

  // Slave by default
  USICTL0 	|= USIPE7       // Enable SPI input mode on P1.7
  		+ USIPE6 	// Enable SPI output mode on P1.6		
  		+ USIPE5 	// MUX P1.5 to SCLK
  		+ USIOE; 	// Enable output 

The slave select line is wired to P1.2 of the MSP430F2012. Do I need to configure this pin aswell (make it inactive or whatnot)? 

Link to post
Share on other sites

Clock polarity and phase are not set in stone, but are configurable through the UCCKPL and UCCKPH registers.  Read chapter 16 of the 2 series family user's guide for the details (http://www.ti.com/lit/ug/slau144i/slau144i.pdf).  You will need to decide on a standard for both master and slave and make sure both are programmed to match.

 

Why are you trying to run SPI and I2C on the same bus?

 

Since SPI is totem driven, just make sure your pull ups are large enough not to cause problems.

Link to post
Share on other sites

I am running SCLK at 125 kHz, so I don't think parasitic capacitance will be a big problem. 

 

I probed the MOSI and SCLK lines with an oscilliscope. The clock looked fine (when neglecting the shape of the pulses) and levels ranging from 0 to 3.2 V. MOSI however, had a Vmin of 1.5 V and Vmax equal to 3.1 V. I figured it had something to do with the voltage being divided by some other resistances on the PCB (though there shouldn't be). So I roughly calculated a new external voltage divider, and the levels looked much better. While looking at the scope, I saw that the value of the MOSI signal changed on falling edges. So I configured the MSP430 USICKPH to 1. After doing that,  I found the same value that I transmitted from the arduino (0xAA) in the USISRL register during debug. Hooray!

 

The MISO line also gives back the correct value, but it reads "0" every other transfer.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...