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.

RS232 conntection with TM4C123BH6PM, using TI TRS3221

Other Parts Discussed in Thread: TRS3221, MSP430F135, MAX3232

Hello, I'm trying to connect my MCU to RS232 ports.

This is the schematic.

I'm not using EK or DK board. The DOUT, RIN is connected to the RS232 pins using a USB to serial cable.

I'm trying to use the UART0 to echo my keyboard inputs to putty.

I used the UART-Echo example code from Tivaware.

However it doesn't work... No printing at putty. The example code is using PIOSC with 115200 baud rate.

Did I connected incorrectly?

The IC chip is TI TRS3221.

  • Hello Min-Ku

    Yes, the connection is not correct.

    1. The FORCEOFF has to be tied off to HIGH

    2. The INVALID is an output and you should not tie it to GND. If not required then keep it floating.

    Please refer to the data sheet of the device, function table on Page-2

    http://www.ti.com/lit/ds/symlink/trs3221.pdf

    Regards

    Amit

  • A very caring, nicely presented post - good job my friend.

    That (assumed) level shifter IC offers (so many) choices - not too hard for someone new to be bit challenged.  (i.e. does not inclusion of both, "ForceOn & ForceOff pins" seem bit of an, "over-kill?"  (toggle of just one pin should achieve similar)

    Amit's covered the essence of hook-up issues - but might one more issue lurk?  Your neat schematic uniquely includes a scan of your USB -> RS232 converter.  (label on the device so states)  Might it be possible that - this device does not produce (nor expect) true RS232 signal levels (i.e. yields/wants cmos/mcu signal levels) - and/or that it flips/inverts all signals it handles? 

    If it converts USB signals into "true" RS232 levels - then your imposition of an RS232 to cmos/mcu IC - between the USB/RS232 converter and targeted mcu - is correct.  But - should the USB/RS232 converter yield/expect cmos/mcu levels - then its use is mistaken/unnecessary -  & sure to impede communication...

    {note that RS232 signal levels are normally/customarily defined as between +7 to +12V and -7 to -12V (either of which capable of causing harm to an unsuspecting/unprotected MCU input)}

  • Thanks Amit and cb1_moblie.

    Then does this TRS3221 chip cannot be used to RS232 ports?

    At the datasheet, the output voltage is up to -13.2 ~ 13.2V at DOUT, -0.3 ~ Vcc+ 0.3V  at ~INVALID and ROUT.

    I didn't understand well cb1_mobile... @.@ (my terrible brain)

    /////////

    I corrected the connection. However, it still didn't work.

    While debugging, the UARTCharPutNonBlocking function couldn't send the data.

    ///////////////////////////////

    bool
    UARTCharPutNonBlocking(uint32_t ui32Base, unsigned char ucData)
    {
        //
        // Check the arguments.
        //
        ASSERT(UARTBaseValid(ui32Base));

        //
        // See if there is space in the transmit FIFO.
        //
        if(!(HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF))
        {
            //
            // Write this character to the transmit FIFO.
            //
            HWREG(ui32Base + UART_O_DR) = ucData;

            //
            // Success.
            //
            return(true);
        }
        else
        {
            //
            // There is no space in the transmit FIFO, so return a failure.
            //
            return(false);
        }
    }

    ////////////////////////////////

    The UART0 Flag Register value was 0x90, meaning TX and RX is empty.

    So the if stament was true, but after writing to the data register,

    the UART0_DR_R value was 0.

    Is it impossible to check the data register?

    Also, when I didn't type anything on my PC's keyboard,

    the UART0 Interrupt Handler activates...

    What might be the problem..?

  • Nothing terrible about your brain my friend.  Let me try again.

    The IC w/in your diagram is an RS232 level shifter.  That is required to convert the higher voltage, RS232 signal levels - to voltages compatible with an MCU.  With Amit's suggested hook-up changes - that chip should be ok.

    I remain concerned as to the signals - both into and exiting from - the "USB to RS232 converter" product you display.  I believe that you should measure - or use the data sheet for that converter product - to confirm that it seeks RS232 signal levels as both input and output.  (Some such USB to RS232/Serial converters output levels which are directly MCU compatible - if that's your case then your use of the IC in your drawing is a mistake - and will prevent - not aid - serial communication.

    You describe the signals from, "the datasheet" - but myself/others are unclear "which datasheet" you are describing.  (i.e. there is your IC as listed on your schematic and then there is a photo showing USB to RS232 converter - it is that data sheet's specifications (USB to RS232 converter) that I'm seeking.

  • Hello cb1_mobile. Oh, I see.

    The product I use is KW-925. It's a USB (NETmate USB) to RS232 Converter.

    (USB A Male => RS232 Serial 9 Pin Male) When it's connected to the PC, it activates as a Serial COM port.

    (Setting : Baud Rate = 115200, Stop bit : 1, data : 8bit, no parity)

    This product don't have a datasheet.

    However I used it with MSP430F135 and MAX3232 chip and it worked correctly few days ago.

    I don't know what is the problem... I'm suspicious that the UART0_DR didn't put the characters.

    I think the UARTCharPut function isn't working correctly. (I'm using UART Echo example from Tivaware)

    While debugging, I checked the UART0 Flag registers and it gets stuck in there.

    When I looked at the oscilloscope, the TX pin(PA1, no.18) was just 3.3V all the time.

    Did I misused UARTCharPutNonBlocking and UARTCharPut?

  • You've given us much good info. with which to work now - thank you - appreciated.

    May I suggest the following for your future design/development efforts?  Our group believes strongly in KISS - it is almost never a good idea to introduce more than one change at a time into a new design effort.  (while surely it can - and has worked - odds against success rise - and that's unwelcome/unwise)  In your case - you've a proven history w/that MAX3232 chip - and have now discarded it in favor of another.  And - you've a similar history w/this vendor's other class of MCU - it too has been replaced.  Thus - you have introduced two, new elements into your design - and either (or both) may spoil your efforts.  (KISS argues for just one change - simplifying the task - and increasing the odds of success.)

    Might you (temporarily) replace the new RS232 level shifter IC with that past, "proven" MAX3232?  I'm not suggesting a board redesign - just a, "tacked signal/wire kludge" so that the level shifter is reduced/removed as your problem's source.  Suspect you can "steal" the key signals from your earlier board - attach wires - and then route these wires into your new MCU. 

    You report successful RS232 level communication between your PC and that past/lesser MCU.  Have you maintained those same PC settings?  Double check that HW Flow Control has not been enabled and that all other communication settings "match" between PC and your MCU.

    If you can eliminate an issue w/the RS232 level shifter and your PC setup - then I'll provide, "quick/dirty" UART test code which our group uses w/success.  Again - KISS dictates that we, "fight & slay single dragon at a time..."