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.

MSP430FR6989: Implementing an auxiliary Serial2 using pins p2.1 and p2.0.

Part Number: MSP430FR6989
Other Parts Discussed in Thread: ENERGIA,

Hello,

I tried implementing another auxiliary serial using pins p2.1 and p2.0 which falls in UCA0 and are tx and rx pins as read in the datasheet.

I did the changes in pins_energia , hardware serial.h and in hardware serial.cpp in the cores folder.

And when used a code it gives an error: redeclaration of 'ring_buffer* rx_buffer_ptr' and same error continues with tx also so i changed the rx_buffer_ptr to ptr1 then it compiled successfully but the rx and tx did not work at all and i tried serial1 after these changes that worked but not serial2, i need to use serial2 with a wireless device which uses the tx and rx pin to transmit data.

  i attached the files please look into it and tell me where iam wrong and what changes need to be done.

Thank  you5543.pins_energia.hHardwareSerial.cppHardwareSerial.h  

  • Hi,
    1. So you define SERIAL1_AVAILABLE and SERIAL2_AVAILABLE at the same time?
    2. Just see from the code, if you want to use uart1 and uart2 at the same time, you need to give another name to rx and tx buffer for UART2 which is different from UART1.
    3. For example: ring_buffer *rx_buffer2_ptr
    Eason
  • Hi,

    the FR6989 only has 2 Hardware Uart interfaces. So adding another one will not work.

    If you would like to use UART based on UCA0 on P2.0 and P2.1 instead of P4.3 and P4.2

    you can do this with simply changing the pin assignment in the pins_energia.h

    static const uint8_t AUX_UARTRXD = 19;     /* Receive  Data (RXD) at P2.1 */
    static const uint8_t AUX_UARTTXD = 8;     /* Transmit Data (TXD) at P2.0 */

    Note: Please avoid adding notes and reference to other issues. This will clutter the database and help others.

    The tracking is done with the Tags, so a proper set tag as you have done (msp430fr6989 and energia) is perfect.

    ~ Stefan

  • Thank you for your reply Eason,
    Yes i define both serials at a time one for gsm/gps and other for the wireless
    i did the changes it compiled good without errors but no data transmission
    and i did do some changes in usci_isr_handler files but still no use....
  • thank you for your reply Stefan,
    But i see in the data sheet there are more than 3 UART's so adding serial2 wont work? by changing the hardware serial.h and .cpp?
    and i did doo some changes it compiled without errors but no data transmission
  • Hi,

    there are two UARTs (eUSCI_A0 and eUSCI_A1) which are mapped do different pins but even if a UART is mapped to 2 pins (e.g. UCA0 Port 2 and Port4) there is just one hardware available which could be used at one time.

    Regards,

     Stefan

  • thank you for your reply ....im clear now
  • Then what about software serial on that pins is that possible?
  • The software serial functions are build on top of the TimerA module.
    This pins only have TimerB available. That could also work but with more restrictions on timing.
    If you can use other pins which would have a TimerA available it would be easier as this does support capturing the Trigger state of the IO.

    You can use the Serial UART as template but the code is done in the assumption that there is now hardware uart there and does not take care about interacting with the Hardware uart implementation. So that needs to be considered and rewritten.

    ~ Stefan
  • so can i change the pin numbers of
    static const uint8_t DEBUG_UARTRXD = 42; /* Receive Data (RXD) at P3.5 */
    static const uint8_t DEBUG_UARTTXD = 41; /* Transmit Data (TXD) at P3.4 */
    to
    static const uint8_t DEBUG_UARTRXD = 19; /* Receive Data (RXD) at P2.1*/
    static const uint8_t DEBUG_UARTTXD = 8; /* Transmit Data (TXD) at P2.0 */

    can this be done?

    If not but why?

  • Hi,

    yes, as described in once of the posts above you can do this.

    Regards,
    Stefan
  • Thank you for your reply,
    I actually changed the pin numbers of the DEBUG uart not AUX i changed it from p3.5 and p3.4 to p2.1 and p2.0 as mentioned above but it did not work i connected a gsm module and sent at commands to the gsm module but nothing worked but after changing the pins to 3.5 and 3.4 it works again...So what might be the issue?
  • Hi,

    P3.4 and P3.5 are connected to UCA1
    P2.0 and P2.1 are connected to UCA0

    So be just swapping the pins will not work - you also need to exchange the eUSCI modules behind.
    In Energia this is controlled by
    #define DEBUG_UART_MODULE_OFFSET 0x20 /* Offset for USCI A1 */
    #define AUX_UART_MODULE_OFFSET 0x00 /* Offset for USCI A0 */

    Regards,
    Stefan

**Attention** This is a public forum