This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F2013 powered and communicated using USB question

Other Parts Discussed in Thread: MSP430F2013, MSP430G2231, MSP430F2012, LM3S5749, Z-STACK

Hi all,

I am working on a scale system that is powered and communicated with PC using USB. The system I am using has MSP430F2013 from TI. I am kind of new with USB stuff, only used serial to USB converter before not building one. I am reading about FDTI USB chip but not sure which one is the right one and which one is easy to build. And I am wondering which USI mode I should use, I2C or SPI to do a communicate. Note that MSP430F2013 does not have UART.

Is there any suggestions on the design? Any help would be much appreciate.

Thank you,

  • I don't know what the goals and intents of your project are, but it sounds like a good idea to use a USB to serial chip which supports SPI to

    communicate with the MSP430F2013 in SPI mode.  SPI mode will be a bit faster than I2C but for UART purposes I don't think it will matter very much.

    I am sure I have seen the FDTI chips like the FT2232H supporting SPI modes on their web site and data sheets.  I don't recall if they have very easy to use

    I2C support though I would be suprprised if it was totally impossible to use them for I2C. At the very least you could presumably program the invididual bit

    transitions to implement I2C at a low speed even if the chip's own sequencer logic did not have a mode to intrinsically support an I2C system.

     

    Anyway if I was going to do a new design for hobby or professional use I would try to use the newest and best chip that they have available since it will likely have the

    most features as well as the most future support and availability should you need that in months and years to come.  I believe that latest model chip is the FT2232H revision.

    Of course you COULD use any of their older version or less capable chips and it would probably work fine for this project so long as they support SPI and device drivers

    for the newest OS versions you plan to run on the PC (e.g. Windows 7 / 64 bit suppor, maybe LINUX, t et. al.).

     

    The nice thing about the FT2232 D or H is that it is used in some of TI's JTAG programmers like the XDS100 so you could find some schematics for the implementation of

    the FT2232 right from TI.  You could even presumably buy an XDS100V2 or TMDX28xxxx C2000 Experimenters Kit / Control card dock from TI and get a premade

    XDS100 or XDS100V2 which you could possibly modify to interface to SPI instead of JTAG.  You'd have to check the schematics to see if the pins needed for SPI

    are available and that there is no reason you could not reprogram one of the two channels on the IC to be SPI or I2C.  I know they do implement a UART on channel #2

    even when they use JTAG on channel #1 in some applications.  I think the TI stellaris experiementers boards like the EKC-LM3S8962 may use an onboard FTDI chip too though

    I am not sure about that, but the schematics are available.

     

    Or even if you build it yourself you could possibly include support for SPI, I2C or JTAG or RS232 on the same interface board if that has any use for your experimentation

    and R&D convenience.  Of course the protocol to program a MSP430 is not true JTAG but rather SpyByWire or a modified JTAG so if you wanted to program the MSP430

    itself you would have to make some changes to the software and hardware configurations.

     

    As for design, you'd need to make sure that you regulate the USB 5VDC down to a maximum of 3.6VDC for the MSP430, probably 3.3 or 3.4VDC more likely, and that

    the I/O signals between the FDTI chip and the MSP430 use those appropriate voltage levels.  Of course you'd also have to be careful to not assign a GPIO output pin

    on the MSP430 to correspond to an output of the FDTI since that is accidentally possible. 

     

    I don't know what package the FDTI is using but I imagine it can't be too hard to work with.  You are probably not going to have much luck in finding DIP socket type USB to serial/SPI/I2C chips these days.

     

     

  • It is possible to implement a software UART with the 2013 using the timerA2 and its two CC registers. With some programming effort even an autobaud UART can be implemented (so you're independent of clock tolerances).

    Some examples are available on the TI website.

    Of course you then have no CCR left for other timing purposes or need to switch between them or make a double-use. The TX side is simple and straightforward and you can simply count the interrupts for all other timings you need in your program.

    You can check your code against a 'real' serial connection and once it works you can proceed with the rest.

  • Hi,

    Just a curious question. Why would I implement UART in the MSP430 while there is a SPI-USB interface chip (from the above reply - the FT2232H)? If I tried to implement UART software, eventually I have to use FTDI chip to make a communication so why not use the SPI feature from MSP430F2013? Is there anything wrong with that SPI (USI) compare to other SPI (USCI)?

    For my application, all I need is to powered from USB and transfer data from MSP430F2013 to PC through USB. Should FT2232H is the right one?


    I will try the FT2232H.

     

    Regard,

  • I don' tknow the FT2232H. But I know that, while being an SPI master is slick and easy and real fun, implementing an SPI slave is a real pain. Even with teh hardware support for the bit-banging, it is very difficult to write the code so it will respond properly. So it depends on the USB chip - is it acting as SPI master or as SPI slave? And if it is slave, will it notify you if anything arrives or do you have to poll it? Also, all the other USB related stuff isn't real fun (including all those problems with the PC driver side). So if a simple serial connection is doable, it is the more desireable solution.

    The SPI in the USI itself isn't faulty in any way (at least as far as I know). And I used SPI often enough myself (e.g. for interfacing an SD card). But if it isn't YOU who initiates the SPI transfer, the fun suddenly ends.

  • I believe the FTDI's SPI implementation is such that the FT2232 chip is the SPI Master, or at least that is what their comment here would lead me to believe: http://www.ftdichip.com/Projects/MPSSE/FTCSPI.htm "The FTCSPI DLL has been created to simplify interfacing the FT2232 to devices using the SPI protocol by taking care of all the required MPSSE commands. Please note that the FT2232 can only act as an SPI master device, not an SPI slave." I don't know if you could modify their source code or create your own code for their multi protocol serial engine to implement the FT2232 as a SPI slave. Anyway I don't know exactly what the FT2232 chips cost, but I can only assume it is comparable or more to the inexpensive MSP430F2013. If I was starting with a set of requirements which included that the project should use a MSP430, and that it should be powered by USB and communicate as a USB serial device, I'd be looking at one of two options -- A: A MSP430 chip with a "real" hardware UART peripheral. That would make the difficulties of converting to I2S or SPI to UART simplified and would consume less other resources in your MSP chip leaving them free for other application needs. B: A MSP430 chip with a built in USB device peripheral and available USB serial device reference code / libraries. I believe the MSP430F5529A is the highest capability chip of this nature in TI's line up that is said to be entering widespread production and availability now. I believe there are several other models with less capabilities but still USB serial integrated device capability in the same series of MSP430F5xxx chips. ANY of those will have FAR more capabilities of memory, peripherals, et. al. than the MSP430F2013. Of course they'll cost more and be harder to engineer with, but when looking at the implementation costs of the FTDI FT2232 chip AND a MSP430F2013, you may find that the costs of implementing the two chip solution are higher than implementing it with one MSP430. Of course you'd need to be a little patient to get F5529 samples and find them in stock at a distributor, but they say they'll be in stock more places sometime soon if I recall correctly. The other thing you should look at is the new "Launchpad" development system for the MSP430G2231 and similar MSP430 "Value Line" chips. I believe those boards have some kind of built in USB to serial chip on them as well as a socket for a MSP430 that is at least similar to the MSP430F2013 in that it is a 14 pin socket for a chip that supports SpyByWire programming; I think the MSP430G2231 pinout is very similar to the MSP430F2012, and I know the F2012 isn't all that different than the F2013 except for the SD16 vs ADC10 A/D converter. Anyway they say (so I recall) the new launchpad board will program any MSP430 with SpyByWire programming and I believe therefore it should work with the F2013 even though that is the older non-ValueLine chip model for which there isn't AFAIK a direct ValueLine equivalent. So there are free gerber files, CAD schematics, et. al. for the launchpad board available now for download, and the board only costs $4.30. You might be able to use it with a F2013 directly (check the pinout and docs and such). The other interesting thing besides the USB to serial converter on board (I presume it is a TI chip and not a FDTI one) is that it also implements reference source code for the MSP430G2231 which implements a software based UART so that it will have a serial port connection to the PC through the onboard USB to serial chip. I believe that same software UART code OUGHT to run on a F2013 with little or no modification, so maybe that could be of use to you. I suppose if I was going to use a F2013 I'd use this launchpad board as a prototyping unit and maybe hardware reference design. Otherwise I'd just use the F5529 if it is sufficiently available for your schedule and not bother with a software UART, not bother with SPI/I2C, and not bother with a second USB to xxxx chip. Of course if I didn't mind paying $7 or so I'd just buy a wholesale USB to serial cable as a ready made product and interface it to a MSP430 with either a hard or soft UART and a RS232 transceiver on the MSP board; it might not be a bad cost trade off versus implementing the USB chip / interface yourself at those prices, though I suspect the F5529 or its lower end kin might be more cost effective in volume.
  • Hi Hayes,

    Hmm, F5529 looks like a very good candidate. In my application, I need at least one SD16 ADC (cheap way to get higher resolution) and one way to communicate with PC through USB. I guess by using F2013 and F5529 can satisfy my needs. You are right about the price, before I know about F5529, I though I need at least F2013 (cant change) + F122 (it has SPI, UART) + 1 FTDI chip (for UART-USB) + TPS71533 (3.3V voltage regulator to convert power from USB).

    SD16 ADC: F2013: SPI -> SPI: F122 :UART -> UART: FTDI : USB-> USB: PC

     

    So now, I only need F2013(for ADC) + F5529 (for USB + voltage regulator) with lower price (even buying 1 unit/component) and size down!!!

    SD16 ADC: F2013: SPI -> SPI: F5529 :USB -> USB: PC

     

    Is my though correct (for both cases)? I really need to verify if this is the general picture!

    So, is F5529 easy to use? I do not have any experiences with USB before. I will need many helps on this!

  • I think the 5529 should be OK for a basic USB to F2013 serial port duty using the USB serial port profile. I believe TI has the USB serial port profile example code available on the 5529's product page, so in theory it should not be too difficult to get it to act as a USB serial port device. I believe they have reference design information as well to show you how to hook up the USB port and such. The problems with the 5529 that I've been aware of over the past several months are -- 1 -- It had not been very available for purchase, and seems to have undergone some delays in this respect. I understand that there may be news about it having reached or being soon to reach a more general state on availibility. 2 -- Early revisions of the chip along with other 55xx / 54xx series chips had several rather significant errata that affected them in ways that were difficult to overcome in some cases. I think there may be newer revisions by now, so I'd guess that some of the more serious problems may now have been identified, documented, and corrected. Ask others who are more experienced with this chip about more up to date availibility and errata / difficulty reports, and of course look at the published errata versus the revisions that are available to you. I'd use it, given available resolutions to these issues. My initial interest in the part was for its potential compatibility with TI software like Z-stack, et. al. If you don't want/need MSP430 architecture software compatibility, the TI Stellaris USB devices like the LM3S5749 are nice and also have historically been sooner available than the MSP430F5x series parts with USB. Though if your application has modest requirements and is cost sensitive, I suppose that the 5529 and its kin will be lower cost than some of the Stellaris USB chips, and either should work.
  • C. Hayes said:

    Of course you'd also have to be careful to not assign a GPIO output pin

    on the MSP430

    Hi,

    Unfortunately, i have done just that. Any suggestions on how to transfer data from MSP430 to PC now.

    my schematics :

    my MSP430 pin connections :

    8863.MSP430_Pin_connections.xls

    thanks in advance.

    best wishes

    janmay

**Attention** This is a public forum