--- In msp430@msp4..., "lewis" <oldrine@y...> wrote:
> I need to implement a system with having 1 SPI,1
UART, 1 USB
> interface . The MSP430 supports at most 2 UARTs. I have a couple of
> USB<->UART devices shortlisted but am facing with a shortage of 1
> Port. Bit Banging was a suggestion i made , but it was not feasible
> due to other restrictions.
>
> I tried swithcing between UART and SPI at run time as needed but it
> dint wrk as the mc resetted each time.
We run USART1 as both an RS-232 link and a USB link, and manage the
connection in software at runtime. Details in my ATC 2005 presentation
here:
http://www.pumpkininc.com/content/doc/press/Pumpkin_MSP430ATC2005.pdf
Also, we switch between SPI, I2C and UART on USART0 without problems.
You do have to follow their instructions pretty closely ...
--Andrew
Hi Micah ,
I tried switchin between a UART and SPI on a MSP430F1232, the mc
always resets when the second configuration is done. I wrote a small
est pgm that just changes from uart to SPI after a few dummy
instructions. I found that the microcontroller resets on the
instruction
U0CTL = CHAR | SYNC ;// CHAR -> 8bit data, SYNC-> SPI mode
Please advice.
Regards,
Lewis
//////////////////////////////////////////////////////////////////#in
include "msp430x12x2.h"
int i;
void Init_UART(void);
void InitSPI_Rcvr(void);
int main( void )
{
WDTCTL = WDTPW + WDTHOLD;
_EINT();
Init_UART();
for(i = 0 ; i <1000; i ++)
{}
InitSPI_Rcvr();
return 0;
}
void InitSPI_Rcvr(void)
{
P3SEL |= (BIT1 + BIT3);
P3DIR &= ~(BIT1 + BIT3);
U0CTL = CHAR | SYNC ;// CHAR -> 8bit data, SYNC-> SPI mode
ME2 = USPIE0; //USART0 SPI enabled
IE2 |= URXIE0 ; // enable interrupts for USART0
}
void Init_UART(void)
{
U0CTL = CHAR ;
U0TCTL = SSEL1;
U0BR0 = 0x53; //=N0 - N7 /* N = BRCLK(SMCLK = 800khz)/BaudRate
(9600) N0k/ 9600 = 83.33 */
U0BR1 = 0x00; //N7 - N15 /* where UxBR1 + UxBR0 = UxBR */
U0MCTL = 0x03;
ME2 |= UTXE0;
IE2 |= UTXIE0;
P3SEL |= BIT4;
}
///////////////////////////////////////////////////////////////////
--- In msp430@msp4..., Micah Stevens <micah@9...> wrote:
>
>
> You should be able to switch roles during run time. You say the
MSP is
> resetting every time you do this?
>
> -Micah
>
> On Tuesday 08 November 2005 9:36 pm, lewis wrote:
> > Hi ,
> >
> > I need to implement a system with having 1 SPI,1 UART, 1 USB
> > interface . The MSP430 supports at most 2 UARTs. I have a
couple of
> > USB<->UART devices shortlisted but am
facing with a shortage of 1
> > Port. Bit Banging was a suggestion i made , but it was not
feasible
> > due to other restrictions.
> >
> > I tried swithcing between UART and SPI at run time as needed but
it
> > dint wrk as the mc resetted each time.
> >
> > Please advice.
> >
> >
> > Regards,
> > Lewis
> >
> >
> >
> >
> >
> >
> > .
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
>
Reply by lewis●November 9, 20052005-11-09
Hi Micah,
I tried switching between SPI and UARTs in a MSP430F1232 . When i
call the second configuration function, the Microcontroller resets.
I have provided the test program i used , that changes from UART to
SPI mode after a couple of blank instrructions
While debuggin i noticed that the microcontroller resets when
U0CTL = CHAR | SYNC ;// CHAR -> 8bit data, SYNC-> SPI mode
is executed.I am unable to figure out the problem with the code.
Thanx,
Lewis
////////////////////////////////////////////////////////////////////
#include "msp430x12x2.h"
int i;
void Init_UART(void);
void InitSPI_Rcvr(void);
int main( void )
{
WDTCTL = WDTPW + WDTHOLD;
_EINT();
Init_UART();
for(i = 0 ; i <1000; i ++)
{}
// InitSPI_Rcvr();
InitSPI_Rcvr();
return 0;
}
void InitSPI_Rcvr(void)
{
P3SEL |= (BIT1 + BIT3);
P3DIR &= ~(BIT1 + BIT3);
U0CTL = CHAR | SYNC ;// CHAR -> 8bit data, SYNC-> SPI mode
ME2 = USPIE0; //USART0 SPI enabled
IE2 |= URXIE0 ; // enable interrupts for USART0
}
void Init_UART(void)
{
U0CTL = CHAR ;
U0TCTL = SSEL1;
U0BR0 = 0x53; //=N0 - N7 /* N = BRCLK(SMCLK = 800khz)/BaudRate
(9600) N0k/ 9600 = 83.33 */
U0BR1 = 0x00; //N7 - N15 /* where UxBR1 + UxBR0 = UxBR */
U0MCTL = 0x03;
ME2 |= UTXE0;
IE2 |= UTXIE0;
P3SEL |= BIT4;
}
///////////////////////////////////////////////////////////////////
--- In msp430@msp4..., "lewis" <oldrine@y...> wrote:
>
> Hi ,
> Thnx Micah,
>
> I tried using USART0 as a UART and then switch to SPI at run time.
I
> used a software reset each time i configure the
port(either for
> RS232 or SPI).everytime i doa software reset the MC started
> execution from start
>
> Thnx,
> Lewis
>
>
> --- In msp430@msp4..., Micah Stevens <micah@9...> wrote:
> >
> >
> > You should be able to switch roles during run time. You say the
> MSP is
> > resetting every time you do this?
> >
> > -Micah
> >
> > On Tuesday 08 November 2005 9:36 pm, lewis wrote:
> > > Hi ,
> > >
> > > I need to implement a system with having 1 SPI,1 UART, 1 USB
> > > interface . The MSP430 supports at most 2 UARTs. I have a
> couple of
> > > USB<->UART devices shortlisted but am facing with a
shortage
of 1
> > > Port. Bit Banging was a suggestion i
made , but it was not
> feasible
> > > due to other restrictions.
> > >
> > > I tried swithcing between UART and SPI at run time as needed
but
> it
> > > dint wrk as the mc resetted each time.
> > >
> > > Please advice.
> > >
> > >
> > > Regards,
> > > Lewis
> > >
> > >
> > >
> > >
> > >
> > >
> > > .
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> >
>
Reply by lewis●November 9, 20052005-11-09
Hi ,
Thnx Micah,
I tried using USART0 as a UART and then switch to SPI at run time. I
used a software reset each time i configure the port(either for
RS232 or SPI).everytime i doa software reset the MC started
execution from start
Thnx,
Lewis
--- In msp430@msp4..., Micah Stevens <micah@9...> wrote:
>
>
> You should be able to switch roles during run time. You say the
MSP is
> resetting every time you do this?
>
> -Micah
>
> On Tuesday 08 November 2005 9:36 pm, lewis wrote:
> > Hi ,
> >
> > I need to implement a system with having 1 SPI,1 UART, 1 USB
> > interface . The MSP430 supports at most 2 UARTs. I have a
couple of
> > USB<->UART devices shortlisted but am
facing with a shortage of 1
> > Port. Bit Banging was a suggestion i made , but it was not
feasible
> > due to other restrictions.
> >
> > I tried swithcing between UART and SPI at run time as needed but
it
> > dint wrk as the mc resetted each time.
> >
> > Please advice.
> >
> >
> > Regards,
> > Lewis
> >
> >
> >
> >
> >
> >
> > .
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
>
Reply by Micah Stevens●November 9, 20052005-11-09
You should be able to switch roles during run time. You say the MSP is
resetting every time you do this?
-Micah
On Tuesday 08 November 2005 9:36 pm, lewis wrote:
> Hi ,
>
> I need to implement a system with having 1 SPI,1 UART, 1 USB
> interface . The MSP430 supports at most 2 UARTs. I have a couple of
> USB<->UART devices shortlisted but am facing with a shortage of 1
> Port. Bit Banging was a suggestion i made , but it was not feasible
> due to other restrictions.
>
> I tried swithcing between UART and SPI at run time as needed but it
> dint wrk as the mc resetted each time.
>
> Please advice.
>
>
> Regards,
> Lewis
>
>
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
Reply by lewis●November 9, 20052005-11-09
Hi ,
I need to implement a system with having 1 SPI,1 UART, 1 USB
interface . The MSP430 supports at most 2 UARTs. I have a couple of
USB<->UART devices shortlisted but am facing with a shortage of 1
Port. Bit Banging was a suggestion i made , but it was not feasible
due to other restrictions.
I tried swithcing between UART and SPI at run time as needed but it
dint wrk as the mc resetted each time.
Please advice.
Regards,
Lewis