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.

[FAQ] MSP430F6779: Interfacing EMDC with another MCU over UART

Part Number: MSP430F6779
Other Parts Discussed in Thread: MSP-FET, EVM430-F6779

Hello, 

Is there any help available on interfacing EMDC with another MCU over UART.

  • Hi Bilal,

    could you please share more details about the application that you want to build?
    Is it that you want to use the EMDC GUI to configure the MSP430F6779 and then interface the MSP430F6779 with another MSP430? Or do you want to use the EMDC with a MSP430 different than MSP430F6779?
    Please let me know which of the scenarios you need help on.

    Thanks and best regards,
    Britta
  • Hello Bilal.m.Ahmad,

    The link www.ti.com/.../
    shows an UART to UART bridge with a flow diagram, project files, a source code and much more.

    If your EMDC is based on MSP430F6779 your options would depend on an MCU you are interfacing with.
  • Thanks for your reply.

    We are trying to achieve the following.

    Design energy measurement solution using ENERGY Measurement Design Center (EMDC) GUI.
    Generate code and deploy it as is (no code changes at all) using JTAG.
    Connect another MSP430( lets call it Host) via UART.
    Read meteorology values on host MCU.
    write calibration parameters to EMDC from Host MCU.

    Questions
    1) I have studied the documentation on EMDC - my understanding is that meteorology values and way to update calibration parameters are exposed on UART by default by EMDC. please confirm its correct.

    2) Id like some help on how to read and write data from EMDC on Host MCU. Code will be helpful. it does not have to be extremely detailed basic will do.

    Regards
    Bilal
  • Hello Bilal,

    Thanks for your interest in using EMDC. First, I would recommend that you update from the initial version v1.20.00 to the latest version v1.30.00. Here's some feedback.

    Bilal.m.Ahmad said:
    Design energy measurement solution using ENERGY Measurement Design Center (EMDC) GUI.

    Excellent! We provide several pre-configured EMDC example projects that match our supported EVMs. However, you can always use these as a starting point for your design by saving the project as your custom project and then making your changes rather than starting a new project from the ground up.

    Bilal.m.Ahmad said:
    Generate code and deploy it as is (no code changes at all) using JTAG.

    You can program the EVM430-F6779 using the provided example firmware images that match the EMDC example projects. There's no need to generate code as long as you use the matching EMDC project and don't need to change anything. If you'd like, you can use the EMDC example project to generate the code, import to CCS or IAR, and then program the EVM430-F6779 over JTAG using the MSP-FET.

    Bilal.m.Ahmad said:
    Connect another MSP430( lets call it Host) via UART.

    This is possible as long as the UART protocol and state machines match. Please keep in mind that the protocol packets change based on your project configuration - if results aren't needed, then they aren't included to keep the protocol transmission leaner.

    Bilal.m.Ahmad said:
    Read meteorology values on host MCU.

    Definitely possible. See comments above.

    Bilal.m.Ahmad said:
    write calibration parameters to EMDC from Host MCU.

    This is also possible if you follow the flow described in the EMDC Technology Guide.

    Now, onto your other questions.

    Bilal.m.Ahmad said:
    1) I have studied the documentation on EMDC - my understanding is that meteorology values and way to update calibration parameters are exposed on UART by default by EMDC. please confirm its correct.

    Yes, that's correct.

    Bilal.m.Ahmad said:
    2) Id like some help on how to read and write data from EMDC on Host MCU. Code will be helpful. it does not have to be extremely detailed basic will do.

    Have you had a chance to read through the "Communication Protocol Spec" chapter in the EMDC Technology Guide? More specifically, the "Protocol Overview" section shows how the EMDC GUI communicates with the target MSP430 device. As you can see in the diagram below (found here), the application code running on the target MSP430 device switches modes to start sending results (again, this depends on the results selected in the EMDC configuration before code generation) to the EMDC GUI. If your host MCU follows the same flow and uses the same protocol and baud rate, then you'll be able to read data from MSP430 using your host MCU.

    For more details about the packet structure, refer to the "MSP430 EM Design Center Packet Structure" section in the EMDC Technology Guide.

    I hope this helps!

    Regards,

    James

  • Thanks James, This is extremely helpful.

    I aim to deploy the code as it generated by EMDC on to MSP430F6779 EVM.


    What is the default baud rate?


    Thanks
  • Typically it is 9600 or 115200, 1 stop and no parity.
    It is always worth to check.
    Please, watch an example and flow form 25 cents (link in my first post).
  • Bilal.m.Ahmad said:
    I aim to deploy the code as it generated by EMDC on to MSP430F6779 EVM.

    Excellent!

    Bilal.m.Ahmad said:
    What is the default baud rate?

    The default baud rate is 250kbaud. I'm not sure how we missed adding that to the documentation. I'll get it added in the next release.

    Regards,

    James

  • Hello.
    I found out one thing: when I monitored serial port activity I observed 3 extra bytes before MSP design center ID byte, they are 0x55, 0xAA and 0x0A. These bytes are not described in the spec. How come that they appeared on the line? Also, is CRC checked in the evaluation board?

    Looking forward to your reply.
    Oleg
  • Hello Oleg,

    You're exactly right. This is the three-byte header that's used by both our CapTIvate and Energy Measurement Design Center's communication protocol between the GUI and MSP430. What you're observing is:

    • [Byte 0] Sync byte at position 0, equal to 0x55
    • [Byte 1] Blank byte at position 1, equal to NOT 0x55 (0xAA is typically used)
    • [Byte 2] Length byte at position 2, equal to the checksum of everything after this byte up to the two checksum bytes
    • [Byte 3] MSP Design Center ID byte, always 0x04 for EMDC, denoted as position [0] in EMDC packet structure below
    • [Byte 4] Command ID byte, specifies command type, denoted as position [1] in EMDC packet structure below
    • [Byte 5] Read/Write Command byte, specifies read or write operation, denoted as position [2] in EMDC packet structure below
    • [Byte 6] Payload byte 0, denoted as position [3] in EMDC packet structure below
    • ...
    • [Byte N+6] Payload byte N, denoted as position [N+1] in EMDC packet structure below
    • [Byte N+7] Checksum LSB byte, denoted as position [N+2] in EMDC packet structure below
    • [Byte N+8] Checksum MSB byte, denoted as position [N+3] in EMDC packet structure below

    More information about the packets can be found here in the CapTIvate Technology Guide. It does seem rather hidden in the documentation, so I'll add this feedback and request the overall packet structure gets updated in the EMDC Technology Guide.

    I hope this helps!

    Regards,

    James

  • Thanks for your response.

    We would like to change the default baud rate from 250K to 115200.

    if we change code that is generated by EMDC to change baud rate. Would the EMDC software work with 115200 baud rate. reason we what to do that is because the device we would like to use does not support 250K baud rate.

    Regards
    Bilal
  • You should be able to change the baud rate in the 'uart_defs.h' file located under your CCS project > DesignCenter > comm > drivers folder. However, please keep in mind that it's not possible to change the baud rate of the EMDC GUI running on the PC. Assuming you generate your EMDC code and you're planning to interface with another host MCU, you can always use a lower baud rate, protocol, or different type of interface (e.g. I2C, SPI, etc.). As I may have mentioned, one of the goals behind EMDC was to allow users to focus on the application side, which includes the communication, rather than trying to figure out all the metrology code.

    //*****************************************************************************
    //
    //! def UART__SAMPLING_MODE defines the eUSCI_A LF or HF mode.
    //
    //! def UART__PRESCALER defines the eUSCI_A pre-scaler.
    //
    //! def UART__FIRST_STAGE_MOD defines the eUSCI_A first stage modulation.
    //
    //! def UART__SECOND_STAGE_MOD defines the eUSCI_A second stage modulation.
    //
    //*****************************************************************************
    #define UART__SAMPLING_MODE	   (EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION)
    
    
    #if (EM_SMCLK_FREQ_IN_HZ == 25165824)
    
    //250K Baud Rate @ 25MHz	
    #define UART__PRESCALER                                                  (0x06)
    #define UART__FIRST_STAGE_MOD                                            (0x03)
    #define UART__SECOND_STAGE_MOD                                           (0x02)
    
    #elif (EM_SMCLK_FREQ_IN_HZ == 16777216)
    
    //250K Baud Rate @ 16MHz	
    #define UART__PRESCALER                                                  (0x04)
    #define UART__FIRST_STAGE_MOD                                            (0x03)
    #define UART__SECOND_STAGE_MOD                                           (0x00)
    	
    #elif (EM_SMCLK_FREQ_IN_HZ == 8388608)
    
    //250K Baud Rate @ 8MHz	
    #define UART__PRESCALER                                                  (0x02)
    #define UART__FIRST_STAGE_MOD                                            (0x01)
    #define UART__SECOND_STAGE_MOD                                           (0x02)
    	
    #else
    
    #error "SMCLK frequency not supported by the UART driver"
    
    #endif

    I hope this helps.

    Regards,

    James

**Attention** This is a public forum