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.

2 peripherals with just 1 USART?



Hi,

 

i am fairly new to MSP430 programing. i am trying to use 2 peripherals (1 GPS, 1 BT) which both use a standard serial port interface on a CC430. i have the following code working and talking to one of the devices just fine:

 

    PMAPPWD = 0x02D52;                         

    P1MAP5 = PM_UCA0RXD;                      

    P1MAP6 = PM_UCA0TXD;                      

    PMAPPWD = 0;                            

    P1DIR |= BIT6;                       

    P1SEL |= BIT5 + BIT6; 

 

    UCA0CTL1 |= UCSWRST;

    UCA0CTL1 |= UCSSEL_2;

    UartBaudSettings();

    UCA0CTL1 &= ~UCSWRST;

 

if i now wanted to use another device, lets say on pins P1.3 and P1.4, can i just remap the UART port pins on the fly? i.e. just issue:

 

    PMAPPWD = 0x02D52;                         

    P1MAP3 = PM_UCA0RXD;                      

    P1MAP4 = PM_UCA0TXD;                      

    PMAPPWD = 0;  

 

or do i have to reset anything?

even if this would work, this still wouldn't give me the ability to talk to both devices at the same time. is there a way to have 2 simultaneous USART's on a CC430?

 

thanks in advance,

-r

 

 

 

 

 

  • It would be doubtful that the Bluetooth and GPS devices you are using would accept this.

    Is it possible for one of these devices to be accessed via SPI or I2C?  The USCI peripheral has 2 ports, A and B.  The A side supports UART and SPI.  The B side support I2C and SPI.

  • As a Ham Radio homebrewer, but MCU newbie, I have a similar question in the back of my mind:  I plan to experiment and see if I can use one MCU UART to read (but I have no need to output) serial from two sensors by simply putting diodes on the sensor outputs.  They should block the signal from one sensor from entering the other, so it may just be a question of whether the MCU can handle the diode voltage drop on the input.  Not necessarily a cure for your needs, but maybe it will give you other ideas.  An option for bi-directional may be a simple diode-switch (Google for it in the Ham  Radio arena); although typically used for low RF signals, it will switch any low voltage signal (similar to a relay).  Of course, a relay may do the trick as well :-).

  • In theory, remapping the port pins would work if you just want to interface one of the two devices at a time.

    If both run at the same baud rate, you can even talk to one while listening to the other. It's not a nice job to handle the management though.

    Actulaly you can even map the UART pins to BOTH at the same time and just enable/disable the port pins with PSEL.

     

    But if one of the devices ( most likely the GPS one) runs at a low baudrate or at elast requires a low one, using a software UART would be the easier solution. With 9600Bd, it shouldn't be a problem, doign input/output just by port pin interrupts and a timer. The MSPs bootloader works that way and there is an example code available at the Ti website.

    Or, of course, the suggested SPI or I2C interface, if supported by one of the devices.

     

**Attention** This is a public forum