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.

CCS/MSP430F67641: MSP430F67641 Three-Phase Energy Measurement source code for CCS

Part Number: MSP430F67641

Tool/software: Code Composer Studio

For MSP430F67641 application,  Three-Phase Energy Measurement system, I down load this source code from the web, but it is IAR. But I use IDE is CCS. My question: where can I get the the source code of CCS.

Thanks and best regard

Lucy zhou

  • Hello Lucy,

    Thank you for your post. Unfortunately, the existing Energy Library source code features support for IAR but not CCS. However, we're actively monitoring requests for CCS support and if anything changes, I'll be sure to update you.

    For now, I would recommend using IAR as your IDE. Porting the IAR projects to CCS is extremely challenging. For example, the toolkit (mathematical) functions have been implemented in assembly and must be ported. There's some discussion about this in the following thread.

    CCS/MSP430F6736: SLAA517e - MSP low-power microcontroller forum - MSP low-power microcontrollers - TI...

    e2e.ti.com
    Part Number: MSP430F6736 Tool/software: Code Composer Studio I'm trying to use a MSP430 as a emeter and for beggining I want to start using the SLAA517e example

    Regards,

    James

    MSP Customer Applications

  • James,
    Thanks.
    1. But I have not IDE of IAR, I don't kown where can get this IDE?

    2. Use MSP430 headers (*.h files) to simplify code development.
    CCS is supplied with files for each device that define the device registers and the bit names.
    TI recommends using these files, which and can greatly simplify the task of developing a
    program. To include the .h file corresponding to the target device, add the line #include
    <msp430xyyy.h> for C and .cdecls C,LIST,"msp430xyyy.h" for assembly code, where
    xyyy specifies the MSP430 part number.
    I use chip is MSP430F67641IPN, but I do not find this file MSP430F67641.h in driverlib, should I use which one file to replace MSP430F67641.h?

    Thanks and best regards
    Lucy zhou
  • Hello,

    You can download IAR from the following link.

    http://supp.iar.com/Updates/?product=EW430&amp;version=ALL

    The DriverLib project should include (under the "inc" folder) a header file called 'hw_memmap.h'. This file (shown below) includes a call to the 'msp430.h' header file. Using the device chosen when creating the project, it will automatically select the correct header file such as 'MSP430F67641.h'.

    /* --COPYRIGHT--,BSD
     * Copyright (c) 2017, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    #ifndef __HW_MEMMAP__
    #define __HW_MEMMAP__
    
    #define __DRIVERLIB_MSP430F5XX_6XX_FAMILY__
    //*****************************************************************************
    //
    // Include device specific header file
    //
    //*****************************************************************************
    #include <msp430.h>
    
    #include "msp430f5xx_6xxgeneric.h"
    
    #include "stdint.h"
    #include "stdbool.h"
    
    //*****************************************************************************
    //
    // SUCCESS and FAILURE for API return value
    //
    //*****************************************************************************
    #define STATUS_SUCCESS  0x01
    #define STATUS_FAIL     0x00
    
    //*****************************************************************************
    //
    // Macro for enabling assert statements for debugging
    //
    //*****************************************************************************
    #define NDEBUG
    
    //*****************************************************************************
    //
    // Macros for hardware access
    //
    //*****************************************************************************
    #define HWREG32(x)                                                              \
            (*((volatile uint32_t *)((uint16_t)x)))
    #define HWREG16(x)                                                             \
            (*((volatile uint16_t *)((uint16_t)x)))
    #define HWREG8(x)                                                             \
            (*((volatile uint8_t *)((uint16_t)x)))
    
    
    #endif // #ifndef __HW_MEMMAP__

    Regards,

    James

    MSP Customer Applications

  • James,
    Thanks.
    1. But I cannot download IAR IDE,because I haven't the licence.
    2. For the source code of three-Phase Energy Measurement system, whether can provide use notes? so that I can use these code to my application.
    Thanks and best regards
    Lucy zhou
  • For the source code of three-Phase Energy Measurement system (slaa621c), whether can provide its use notes and some Flow chart? so that I can use these code to my application.
    Thanks and best regards
    Lucy zhou
  • Hello Lucy,

    I apologize for the delayed response due to the holidays.

    Regarding the IAR license, please refer to the following IAR website.

    https://www.iar.com/buy/licensing-information/

    Also, you can find information about the source code and flowcharts in the Implementation of a Low-Cost Three-Phase Electronic Watt-Hour Meter Using the MSP430F67641 app note.

    Regards,

    James

    MSP Customer Applications

  • James,
    Thanks.
    But still some issue for use UART_2. UART_A2 cannot enter interrupt function.
    For P2.2 and P2.3 as a UART_2, I use same configure and interrupt ISR code same as UART_1, but cannot enter this interrupt funtion ( ISR(USCI_A2, USCI_A2_isr)).Refer below.UART_2 interrupt is not response. but UART_1 is normal. I modied these use slaa621c source. Pls help.

    ISR(USCI_A2, USCI_A2_isr)
    {
    uint16_t tx; //Lucy can enter router

    switch (__even_in_range(UCA2IV, USCI_UART_UCTXCPTIFG))
    {
    case USCI_NONE:
    break;
    case USCI_UART_UCRXIFG:
    uart_rx_core(2, UCA2RXBUF);
    break;
    case USCI_UART_UCTXIFG:
    tx = uart_tx_core(2);
    UCA2TXBUF = tx & 0xFF;
    if (tx & 0x8000)
    UCA2IE &= ~UCTXIE;
    break;
    case USCI_UART_UCSTTIFG:
    break;
    case USCI_UART_UCTXCPTIFG:
    break;
    }
    }
  • Hello Lucy,

    You'll probably need to add the #defines related to the UART_2 interface in the 'emeter-template.h' file (put the code snippet below after Line 71). I see that they exist for the UART_0 and UART_1 but not UART_2. Adding "UART_2_SUPPORT" will increase "MAX_UART_PORT" from 2 to 3 in 'emeter-communication.h' file (see Lines 36 to 49), which should allow UART_2 to be configured (I suspect that your issue is caused by disabled UART_2 interrupts). Remember to rebuild all the projects in this order after making changes to any files: emeter-toolkit-67641 -> emeter-metrology-67641 -> emeter-app-67641.

    /*! This defines the speed of eUSCI 2 */
    #define UART_2_SUPPORT
    #define UART_2_BAUD_RATE                            9600
    #define UART_2_DLT645_SUPPORT

    Regards,

    James

    MSP Customer Applications

  • James,

    Thanks.

    I done some modifications for use Uart_2 (See attached), after I modify the code, I rebuild all the projects in this order after making changes to any files: emeter-toolkit-67641 -> emeter-metrology-67641 -> emeter-app-67641,but still don’t enter the break point, see the attached.

    Use IC: MSP430F67641IPN (80pins)

    Thanks and best regards

    Lucy

     

    UART1 and UART2 break point.docx

     

  • James,

    Any update?

    This is urgent for me.

    In our application, need use these two functions,UART_A2(p2.2,p2.3) and B0_SPI (P1.7,P2.0,P2.1),but cannot right working,I use TI provide UART and SPI example of code add to slaa621c source , Cannot enter their interrupt entrance.When I only buld UART and SPI example code ,they are right.How do I add these two function to slaa621c source? pls advise.

    Thanks and best regards

    Lucy zhou

  • Hello Lucy,

    I would encourage you to use the original source code (unmodified) as a reference for your code. First, try to understand how the UART_1 is being initialized, configured, and used before moving to UART_2. Focus on the UART interface before moving onto the SPI interface.

    Have you been able to debug the UART_2 configuration code in 'emeter-communication.c'? This code configures the UART_2 interface. If you can't halt on Line 270, then you'll need to figure out why the "UART_2_SUPPORT" define isn't configured properly. After this code is executed, the interrupts should be enabled. Personally, I've found that it helps to use the search feature in IAR (Ctrl + Shift + F) to go from defines to functions, etc. to understand the code better.

    One more thing, if you're debugging, please be sure to turn off the compiler optimizations (both size and speed). I've found where this causes problems when debugging if not done.

    Regards,

    James

    MSP Customer Applications
  • Also, be careful which UART ISR you're trying to debug (there are several that depend on the type of module). Here, the MSP430F67641 has EUSCI_A2, so this module's ISR code starts on Line 664.

    Regards,

    James

    MSP Customer Applications
  • James,

    ThanksUART1 and UART2 register.xlsx

    I use original code and build it,URAT_1 is working.Then I add define UART_2 same as UART_1 below,
    #define UART_2_SUPPORT
    #define UART_2_BAUD_RATE                            9600
    #define UART_2_DLT645_SUPPORT
    UART_2 can right configure and can enter line 270 break point,But UART_2 still cannot working.I check and compare their registers,find out UCA2IE=0,its value has been modify,UART_2 cannot interrupt,refer the attached. Where can I restore its interrupt enable?
    (One more thing, if you're debugging, please be sure to turn off the compiler optimizations (both size and speed). I've found where this causes problems when debugging if not done.) I don't find out where can turn off?
     
    Thanks and best regards
    Lucy zhou

  • James,

    Whether any update?

    Thanks and best regards

    Lucy zhou

  • lucy zhou said:
    (One more thing, if you're debugging, please be sure to turn off the compiler optimizations (both size and speed). I've found where this causes problems when debugging if not done.) I don't find out where can turn off?

    In IAR, right-click the project, go to Properties > C/C++ Compiler > Optimizations, select "None" for Level, click "OK" and then rebuild the project. You'll need to do this for each project.

    lucy zhou said:
    I use original code and build it,URAT_1 is working.Then I add define UART_2 same as UART_1 below,
    #define UART_2_SUPPORT
    #define UART_2_BAUD_RATE                            9600
    #define UART_2_DLT645_SUPPORT
    UART_2 can right configure and can enter line 270 break point,But UART_2 still cannot working.I check and compare their registers,find out UCA2IE=0,its value has been modify,UART_2 cannot interrupt,refer the attached. Where can I restore its interrupt enable?

    I'd try tracking down exactly where the interrupt gets disabled.

    Regards,

    James

    MSP Customer Applications

  • James,

    Thanks for your help.

**Attention** This is a public forum