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.

MSP430FR6047: UART in ultrasonic program, use low power mode

Part Number: MSP430FR6047
Other Parts Discussed in Thread: MSP430F5528, MSP430WARE

I want to change the communication in the MSP430FR6047EVM_USS_Water_Demo from I2C to UART. For now it should just send the same informations to my terminal program as it does to the GUI.

I already changed the bit-setting in comm_config.h and set the power mode of the whole project to "Disable_LPM" by manipulating the properties. Unfortunately I am still not able to receive UART-signals and the board is not sending anything to the COMM_RXD or TXD jumper eather.

When I debug the program it gets stuck in 'commonTimerWaitEvent'. The lpmMode is lpm0 but the debugger does not find GIE. Maybe this information is helpful.

In Properties->Debug->Misc/Other Options 'Allow power transitions while running if suported (low power running)' is set and I am not able to uncheck the box. Is it necessary to uncheck it?

Are my settings correct and what do I also have to change?

Furthermore I have a problem with debugging when I try it with the Flash Emulation Tool. The emulation tool led-signals always switch between mode and power and the EVM tries to display the 'FLOW RATE IN LPH' but retries always after displaying 'FL'. Is there a problem with the power connection? I used the JTAG power.

Thanks for your help

  • Hi Kathrin,

    From hal_uart.c, it looks like the UART is configured by default to work over pins P1.2 and P1.3. Are these the pins you are checking with your scope?

    BR,
    Leo

  • Hi Leo,

    yes, these are the pins I checked.

  • Hi Kathrin,

    I'm asking because these aren't the signals that correspond to the COMM_RXD or TXD lines you mention in the thread above. P1.1 and P1.2 are part of the JTAG connector pins.

    BR,
    Leo

  • Yes, I read that the COMM_RXD and TXD are for the USB-UART communications and the 'normal' UART pins are the other RXD and TXD pins. I checked them (and all pins that are connected to the Chip) for signals. But no one transmits binary code.

    What exactly is the difference between the UART pin and the USB-UART? They should send the same information, I suppose.

  • Hi Kathrin,

    The USB-UART pins are intended for communication via the MSP430F5528 to the PC over it's USB interface.  I'll consult my colleagues on why you might not be seeing activity on these lines.

    BR,
    Leo

  • Hi Kathrin,

    The template project should have a UART implementation with some further explanation in the readme on how to enable the UART. Have you looked at this? This readme should be in the USS Lib installation directory:

    C:\ti\msp\USS_02_40_00_00\USS\examples\USSSWLib_template_example

    BR,
    Leo

  • Hi Leo,

    thank you. I did not know about this readme or example project yet. I will test it next week and see if I can change all settings correctly in my normal project afterwards.

    Kathrin

  • I now tested the software of the example. It sends the informations without problems. But the uart_parse.py document has an error. The print command has no brackets and in line 30 there is a problem with the list index:

    Traceback (most recent call last):
      File "C:\ti\msp430ware_3_80_13_03\usslib\tools\examples\uart_parse.py", line 46, in <module>
        decode_file(sys.argv[1], sys.argv[2])
      File "C:\ti\msp430ware_3_80_13_03\usslib\tools\examples\uart_parse.py", line 30, in decode_file
        result = struct.unpack("f", struct.pack("I", int(line_list[1], 16)))[0]
    IndexError: list index out of range

    The translation process stops after

    AbsTof-UPS,5.676555e-05
    Undefined  ,

    Would you please send me a working version of the uart_parse.py?

    Unfortunately the Readme does not explain how to implement the right settings to the normal ultrasonic poject. Is there an other readme that I did not see?

    BR,
    Kathrin

  • Hi Kathrin,

    I'm consulting my colleague and will get back to you.

    BR,

    Leo

  • Hi Kathrin,

    Can you post the *.csv file used as input for this script?  Can you confirm that you are using 02_40_00_00 release? Can you try the parser in your c:\ti\msp\USS_02_40_00_00\ directory?

    BR,
    Leo

  • Hi Leo,

    here is my input file and a screenshot of the commands for parsing. I use the project USS_02_40_00_00 but I found the uart_parse.py not at the path you told me. To my mind, this should not be a problem.

    EVM_original.csv

  • Thanks Kathrin,

    I've been able to reproduce this issue here, I'll need some time to dig into the problem to determine what's going on.

    BR,
    Leo

  • Hi Kathrin,

    Please find updated python script script below. You'll get a warning if data is dropped in communication, but it should at least complete parsing and generate the output file.

    #!/usr/bin/python
    """ Parses USS Template project UART data (src.csv) and store result in out.csv"""
    import re
    import struct
    import sys
    
    def decode_file(file_in_name, file_out_name):
        """ Decodes input file using delim_dict and stores decoded output"""
        delim_dict = {"$": "AbsTof-UPS", "#": "AbsTof-DNS", "%": "DToF", "!": "VFR"}
        # Open File Input and Output Files
        input_file = open(file_in_name, "r")
        target_file = open(file_out_name, "w")
        lineNum = 1
        # Iterate through the data
        for line in input_file:
            # Remove New Line
            line = line.rstrip("/n")
            # Remove Spaces in front
            line = line.lstrip(" ")
            # Remove White space and tabs
            pattern = re.compile(r"\s+")
            clean_line = re.sub(pattern, " ", line)
            # Split the line by spaces
            line_list = clean_line.split(",")
            if (len(line_list) == 2):
                # Check if the first Value is supported by dictionary
                if line_list[0] in delim_dict.keys():
                    target_file.write(delim_dict[line_list[0]])
                else:
                    target_file.write("Undefined " + line_list[0])
                target_file.write(",")
                try:
                        result = struct.unpack("f", struct.pack("I", int(line_list[1], 16)))[0]
                        # Format the output in exponent notation
                        target_file.write("{0:e}".format(result) + "\n")
                except:
                    print("Warning: Potential corrupted data in line: "+ str(lineNum) + " \""+ line + "\"\n")
            else:            
                if(len(line_list[0]) >1):
                    print("Warning: Potential corrupted data in line: "+ str(lineNum) + " \""+ line + "\"\n")            
            lineNum = lineNum + 1
        # Close Files
        input_file.close()
        target_file.close()
        print("Successfully Generated: \n", file_out_name)
        return
    
    if __name__ == "__main__":
        if len(sys.argv) != 3:
            print ("Invalid input. Usage uart_parser.py <input_csv> <output_csv>")
        else:
            # Parse the USS Template project src input file and store result in
            # output csv
            decode_file(sys.argv[1], sys.argv[2])
    

    BR,
    Leo

**Attention** This is a public forum