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.

MSP432E401Y: Implementing RS-232

Part Number: MSP432E401Y
Other Parts Discussed in Thread: TRSF3243, TRS232, MSP-EXP432E401Y

Hi,

I have an MSP432E401Y based product that I need to modify to implement an RS-232 interface. Looking through the data sheet for the MSP432E401Y I was able to find  the appropriate pins to use and where the UART registers are located in memory, but there are a lot of details about implementing RS-232 that are still not clear to me.

Just a few issues I still don't know how to do include how to set the baud rate, how to send a byte of data, where an incoming byte of data will be located, the polarity of incoming and outgoing data, etc.

Can someone explain these issues to me, or is there a document available that explains them?  I don't see any of it in the data sheet I have.

Thank you.

  • I created a few projects using RS232 and RS485 comms.

    If you are using the sys config tool, it's quite simple - just add a UART channel on the GUI, select which UART you wish to use, choose the IO pins from the list of those available. If you use UART 2 (this means the UART 2 driver, not UART number 2), you get extra options to use DMA.

    You can select the Baud and other serial comms settings in the code when you set up the device:-

    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;

    ...

    /* Create a UART for the console */
    uart = UART_open(CONFIG_UART_0, &uartParams);

    You then send and receive data with driver function calls UART_read and UART_write

    The data coming out of the micro is 3.3v positive logic (1 = high). An RS232 driver device is needed if that's what you want.

    If you are doing it the hard way, I would recommend starting with one of the examples in the SDK. There is a demo serial comms project for the launchpad. Step through and see what registers it sets. A bit laborious but it works. As far as I remember , in the Eclipse debugger, you can dump the register settings to a file so it is not too hard to check what has changed.

  • Thank you for the response, but I see I forgot to include an important piece of information. My project is written in assembly language, so I need to get more details about how to set up the UART registers to get the RS-232 functioning and how to send and receive data through those registers.  It seems like there must be a data sheet somewhere that explains how to do that.

    I'm not familiar with the SDK examples or how to use the debugger to figure out how to they are working so it would take me a lot of time to get answers to what are a few very simple questions. I'm hoping someone can either give me the information I need or point me to a relevant data sheet.

    I'll be using the TRSF3243 as an RS-232 driver.

  • Just a few issues I still don't know how to do include how to set the baud rate, how to send a byte of data, where an incoming byte of data will be located, the polarity of incoming and outgoing data, etc.

    All the registers are described in the TRM, not device datasheet. Please refer to TRM  https://www.ti.com/lit/pdf/slau723. UART data is written and received from UARTDR register. Baud rate is programmed in UARTIBRD and UARTFBRD registers. There are also control registers like UARTLCRH and UARTCTL to set up the line. 

    but I see I forgot to include an important piece of information. My project is written in assembly language, so I need to get more details about how to set up the UART registers to get the RS-232 functioning and how to send and receive data through those registers.

    There are UART examples in the SDK utilizing the provided UART drivers. Is there a hard reason to code in assembly for UART? UART is not a fast comms interface.  I really doubt any noticeable performance gain you can achieve coding in assembly but that is your call. Why wouldn't you use drivers to build your application? 

  • Thank you so much, I think that the slau723 document is exactly what I need.

    I'm using assembly for the UART because the whole product is written in assembly.  I realize I'm probably a minority of one, but I prefer coding in assembly language when designing stand-alone products.  I feel like I have a much better understanding of how the end product is working, and how the different functions interact with each other, because I'm dealing with it at the machine level.  Using higher level languages adds a level of abstraction that I don't like.  I also think I have more opportunities to optimize the code when using assembly coding which results in a superior product.

    If I'm writing code for a computer I'll use whatever higher level language is appropriate for the project.

  • More important than the software, external drivers will be required, like the TRS232:

    https://www.ti.com/product/TRS232

    Connecting straight RS232 to an MCU is a guaranteed way to kill it.

  • My plan is to use the TRSF3243 as an RS-232 driver. Is the TRS232 a better option?

  • I was just using it as an example. I have used the TRS3122 because it had an EVM.

  • I've been following the instructions in Section 26.4 of slau723 to setup UART2 on the PD4-7 pins expecting to see a byte of data at PD5 (pin 126) and I'm not having much luck. One thing that's not clear at all is how to configure the clock source by writing to UARTCC.  The instruction says to configure it by writing to UARTCC but I can't see anywhere what value I'm supposed to use.

    It might be interesting to look at one of the examples in the SDK that uses RS-232.  Is there a specific example that would be best to look at? I'm most interested if there is an nortos example.

    Thank you.

  • The instruction says to configure it by writing to UARTCC but I can't see anywhere what value I'm supposed to use.

    I agree it is a bit confusing that all fields are reserved. 

    Below is the datasheet for TM4C129 MCU which is the same silicon as MSP432E. 

    It might be interesting to look at one of the examples in the SDK that uses RS-232.  Is there a specific example that would be best to look at? I'm most interested if there is an nortos example.

    You can refer to this uart example. 

  • Ok, it looks like UARTCC = 0 uses the system clock, which is what I want and that is the default value, so I'll just leave it at that.

    I found the uart_echo example. It looks like it is exactly what I need and it would be very helpful for me to step through the code to see how they get the RS-232 I/O setup and working, but I haven't used these example programs for a while and don't remember the steps to get them loaded in and working.

    Can I get a quick tutorial on how to bring the uart_demo example up in css 11.2.0 and load it into an MSP-EXP432E401Y development board?  I'm sure it's probably a simple procedure but I don't remember how to do it.

    Thank you.

  • Use the Resource Explorer in CCS to download the uart_echo example. See below. 

    Once the example is download, it is just a matter of clicking the 'Hammer' icon and it will build the project, load the code to the MCU and you are ready to run. 

  • My problem with that approach is that I never put my development computer online.

    I do have all of the examples, including uart_demo, on that computer so I can use it from there.  I just don't remember how to load it in to get it working.  I think I need to load in the uart_echo_MSP_EXP432E401Y_nortos_css.projectspec file (which is in the ccs subdirectory) somewhere, but I don't remember what command I use to do that.

  • If your computer is not online then you can import the examples locally from your installed MSP432E SDK. 

    In CCS, Select File->Import and next select CCS Project.

    use the browse button to navigate to the directory that contains the uart_echo example which is at C:\ti\simplelink_msp432e4_sdk_4_20_00_12\examples\nortos\MSP_EXP432E401Y\driverlib\uart_echo\ccs

    After the project is imported, you just click on the 'Bug' button to build, connect and flash the program.

    Please go through the CCS user's guide too. https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_getting-started.html

  • I got it working. Thank you so much for the help.