UART-USB using MSP430

Thread Starter

CrackJack

Joined Aug 7, 2009
127
hello everyone,
i WOULD like to send data from a flash to computer using UART-USB converter... i have a TI-MSP430f2619 micro-controller.

Can anyone please give me heads up how to get started? which UART-USB should i use? i know TI have their own TUSB3410, but i found tat was very complex as compared to MCP2210 and Silicon Labs 21xx.

Is there a compulsion that i have to use only TI UART-USB for development with
MSP430? or i can use any??

thankss..
 

terra

Joined May 12, 2011
13
Option No1: Sending data through UART and convert the UART-USB at the PC using FTDI or other available cable and it is easy

Option 2 : Use UART to USB chip from TI, SiLab etc then send to USB
Either option as a programmer you no need to send a data through UART

Option 3; Chane to MCU which has inbuilt USB then write the USB driver for the Chip and send through USB
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
At everyone, thanks a lot, i actually bought a demo kit from MAXIM to perform SPI-USB interface using MAXIM3420e.
I tried their enumeration code, but somehow, i was unable to get through it.

has anyone used this chip MAX3420e with MSP430? Can anyone please suggest me how to proceed with it?

I have made some changes in the enumeration code that Maxim has provided... however, i could not get through the SPI_Test function... please help, attached is the code...
Rich (BB code):
void SPI_Init(void)
{
  unsigned int i;
 
  WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer
 /* if (CALBC1_8MHZ ==0xFF || CALDCO_8MHZ == 0xFF)                                     
  {  
    while(1);                               // If calibration constants erased
                                            // do not load, trap CPU!!
  }  
  BCSCTL3 |= XCAP_3;                        // Configure load caps*/
  BCSCTL1 = CALBC1_8MHZ;                    // Set DCO to 8MHz
  DCOCTL = CALDCO_8MHZ;
  // Wait for xtal to stabilize
 /* do
  {
  IFG1 &= ~OFIFG;                           // Clear OSCFault flag
  for (i = 0x47FF; i > 0; i--);             // Time for flag to set
  }
  while ((IFG1 & OFIFG));                   // OSCFault flag still set?
  for(i=2100;i>0;i--);                      // Now with stable ACLK, wait for
  */                                          // DCO to stabilize.
 // UCA1CTL1 &= UCSWRST;                      // reset SPI mode
 
 
 
  ///port settings///
  SPI_MOSI;                                 // Assign port 3.6 in MOSI mode
  SPI_MISO;                                 // Assign port 3.7 in MISO mode
  SPI_CLK;                                  // Assign port 5.0 as SPI clk
  Slave_Select;                             // Assign port 5.1 as SS#
  INT_From_Slave;                           // Assign port 5.2 as Intr from slave
 
 
 
  ///// D I R E C T I O N  ////////////
  MISO_DIR_INPUT;
  MOSI_DIR_OUTPUT;
 
  SPI_CLK_DIR_OUTPUT;                       // Assign SPI Clk as Output
  Slave_Intrpt_DIR_IN;                      // Assign P5.0 as input
  Slave_Select_DIR_OUT;                     // Assign P5.1 as output
 
 
 
  ///// register settings///
  UCA1CTL0 |= UCMST+UCSYNC+UCMSB;           // 3-pin, 8-bit SPI master
  UCA1CTL1 |= UCSSEL_2;                     // SMCLK
  UCA1BR0 = 0x02;                           // 2
  UCA1BR1 = 0;                              //
  UCA1MCTL = 0;                             // No modulation
  UC1IE |= UCA1TXIE + UCA1RXIE;
 
  UCA1CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
 
  Slave_Reset;                              // ss low
  UCA1TXBUF = 0x01;
  Slave_Set;                                //ss high
 
}
void wreg(BYTE reg, BYTE dat)
{
  BYTE dum;
  unsigned int i;
  Slave_Reset;                   // Set SS# low
 
  UCA1TXBUF = reg+2;             // send the register number with the DIR bit (b1) set to WRITE
  while (UCA1STAT & UCBUSY);     // loop if data still being sent
 
  dum = UCA1RXBUF;
 
  UCA1TXBUF = dat;               // send the data
  while (UCA1STAT & UCBUSY);     // loop if data still being sent
 
  dum = UCA1RXBUF;
 
  for (i = 0x2; i > 0; i--);   // little time to put CS in high state
  Slave_Set;                     // set SS# high
}
 
BYTE rreg(BYTE reg)
{
BYTE dum;
  int i;
  P5OUT &= ~0x02;
 // Slave_Reset;  
  UCA1TXBUF = reg;               // reg number w. dir=0 (IN)
  while (UCA1STAT & UCBUSY);     // loop if data still being sent
  dum = UCA1RXBUF;               // NECESSARY TO RE-ENABLE THE INPUT BUFFER in BYTE MODE
  UCA1TXBUF=0x00;                // data is don't care, we're clocking in MISO bits
  while (UCA1STAT & UCBUSY);     // loop if data still being sent
  for (i = 0x2; i > 0; i--);   // little time to put CS in high state
  P5OUT |= 0x02;
  //Slave_Set;  
  return(UCA1RXBUF);
}
 
 
void test_SPI(void)         // Use this to check your versions of the rreg and wreg functions
{
BYTE j,wr,rd;
SPI_Init();                 // Configure and initialize the uP's SPI port
wreg(rPINCTL,bmFDUPSPI);    // MAX3420: SPI=full-duplex
wreg(rUSBCTL,bmCHIPRES);    // reset the MAX3420E
wreg(rUSBCTL,0);            // remove the reset
wr=0x01;                    // initial register write value
for(j=0; j<8; j++)
  {
  wreg(rUSBIEN,wr);
  rd = rreg(rUSBIEN);           
  wr <<= 1;       // Put a breakpoint here. Values of 'rd' should be 01,02,04,08,10,20,40,80
  _NOP();
  }
}
the complete code is available online as well from the link... http://pdfserv.maxim-ic.com/en/an/AN3690.pdf
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
I took a very quick glance at your MCU specs. It has non usb ports (that is as far I can see, I can be wrong here) But it has 4 serial ports. I have used USB converter chips from FTDI like this. http://www.ftdichip.com/Products/ICs/FT232H.htm very simple to use.

Have you ever tried the Maxim ones? i have spent too much time on Maxim now, and would like to continue using them...
what are your suggestions over it??

Please help...
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
I've had good success with the MAXIM3420e, although I'm not sure what support it will have going forward, due to the peripheral being common place on many micros.

I'm not familiar with the TI-MSP430f2619, preffering Atmels 8051/AVRs, but that shouldn't be a hindrance.

I've found this to be the required code to initialize the device. Managing the toggle is the other headache, but once properly coded, you can move on.

Rich (BB code):
void Reset_MAX(void)
{
 wMAX(rPINCTL,(bmFDUPSPI|bmINTLEVEL)); // MAX3421E: Full duplex mode, INTLEVEL=0, POSINT=1 for pos edge interrupt pin
 wMAX(rUSBCTL,bmCHIPRES);  // chip reset This stops the oscillator
 wMAX(rUSBCTL,0x00);       // remove the reset
 while(!(rMAX(rUSBIRQ) & bmOSCOKIRQ)) ;  // hang until the PLL stabilizes
 wMAX(rIOPINS2,0x00);
 sendserial(sprintf(serialbuffer,"- MAX3421 has been reset \n"));
}

OOPs, I lied, I'm using the host (MAX3421), not the device (20e) device.
 
Last edited:
Top