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.

MSP430i2040: Interfacing EMDC with another MCU over UART

Part Number: MSP430I2040
Other Parts Discussed in Thread: EVM430-I2040S, MSP-FET, , MSP430I2041, MSP-ISO

Tool/software: Code Composer Studio

Hi TI Team,

The EVM ships IAR sample code only.

Please help to convert to CCS.

Regards,

Walter

  • Hi Walter,

    did you also try out loading one of the examples included in the Energy Measurement Design Center? You could have a look if that's a good starting point by just starting the EMDC GUI, click "open project" in the File menu and open one of the EVM430-I2040S examples.

    Please let me know if that would cover your request.

    Best regards,

    Britta

  • Hi Britta,

    I tried the EMDC by generating CCS code particularly the EVM430-i2040S_SH_1V_1C_60Hz.
    The generated code, no need to change?

    I only have the MSP-FET430UIF not the MSP-FET. I've heard, I cannot load the code using the MSP-FET430UIF also.

    Regards,
    Walter
  • Hi Britta,

    Please confirm if I cannot use the MSP-FET430UIF for Spy-Bi-Wire, only the MSP-FET.

    Regards,
    Walter
  • Hi Britta,

    I can now load the firmware using the MSP-FET.

    Our requirement is to configure MSP430i2040 UART for Pin-19(RXD)and UART for Pin-20(TXD) for outside interfacing just like the EVM. We measure only upon request from outside CPU.

    I use EVM430-i2040S_SH_1V_1C_60Hz sample code which has 1 voltage, 1 current. We need 2 voltage, 2 current. Looks like need to add 1 each more in EMDC then regenerate CCS.

    My question, is how to add UART interfacing? I believe EMDC do not have means to configure this.

    Regards,
    Walter
  • Hi Walter,

    Walter Macamos said:
    I can now load the firmware using the MSP-FET.

    That's great. Nice work!

    Walter Macamos said:
    Our requirement is to configure MSP430i2040 UART for Pin-19(RXD)and UART for Pin-20(TXD) for outside interfacing just like the EVM. We measure only upon request from outside CPU.

    I'm assuming that you're talking about moving from the EVM430-i2040S to your own i2040-based board?

    Walter Macamos said:
    I use EVM430-i2040S_SH_1V_1C_60Hz sample code which has 1 voltage, 1 current. We need 2 voltage, 2 current. Looks like need to add 1 each more in EMDC then regenerate CCS.

    Basically, yes. The EMDC GUI allows you to open the example EMDC projects, modify them to match your design, generate the code, and save them as your own project. Also, you can start a new, blank EMDC project. The example EMDC projects are good references and come pre-configured and pre-calibrated for quick and easy evaluation. For example, the voltage and current sensor parameters can be configured using your expected max voltage and currents and the passives in your schematic (e.g. shunt resistance, burden resistor, etc.).

    Please reference the latest EMDC Technology Guide for guidance.

    Walter Macamos said:
    My question, is how to add UART interfacing? I believe EMDC do not have means to configure this.

    EMDC code gets generated with some default application code that leverages the EMDC APIs and configures and implements the UART communication. Besides supporting CCS, one of the other main reasonse behind developing EMDC was to allow users to implement their application code (e.g. changing communication protocol or type) rather than implementing all the complex metrology code.

    Regarding the UART interface, it's baud rate is 250kbaud. You can find the packet structure in the thread below. Also, you can find a diagram in the API section of the EMDC Technology Guide illustrating how the communication between the PC GUI and MSP430 works, which allows you to use a host MCU to query results from the MSP430i2041.

    Regards,

    James

  • Hi James,

    So, default baud rate is 250,000 baud? Please confirm.

    Regards,
    Walter
  • Correct.

    Regards,

    James

  • HI James,
    According to here:
    e2e.ti.com/.../725083

    There are 3 bytes included in packet, which is not part of spec. Is this both for TX and RX?
    How do you compute the checksum in this case?

    Sample(App Version):
    char cmdAppVersion[7] ={0x04, 0X02, 0X00, 0X05, 0X00, Checksum(LSB), Checksum(MSB)};

    Checksum(LSB) = 0X0B?
    Checksum(MSB) =0X00?

    Regards,
    Walter
  • Walter Macamos said:
    According to here:
    e2e.ti.com/.../725083

    I'm glad you found this thread, since it contains a lot of good information about the communication protocol.

    Walter Macamos said:
    There are 3 bytes included in packet, which is not part of spec. Is this both for TX and RX?
    How do you compute the checksum in this case?

    Those 3 bytes are the protocol header, which don't change and are used for both TX and RX. The checksum is the lower 16 bits of the summation of the payload section (everything but the 3 byte header). EMDC uses the same communication protocol as our CapTIvate Design Center, so there's some additional information about the packets found here.

    Walter Macamos said:

    Sample(App Version):
    char cmdAppVersion[7] ={0x04, 0X02, 0X00, 0X05, 0X00, Checksum(LSB), Checksum(MSB)};

    Checksum(LSB) = 0X0B?
    Checksum(MSB) =0X00?

    That's correct!

    Regards,

    James

  • Hi James,

    Here is a simple uart test of reading firmware version:

    uartParams.baudRate = 250000;

    char cmdAppVersion[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X05, 0X00, 0X0B, 0X00};
    char cmdAppVersionResp[10] ={0x00, 0X00, 0X00, 0x00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00};

    UART_write(Uhandle, &cmdAppVersion, length);

    retVal = UART_read(Uhandle, &cmdAppVersionResp, length);

    For, RX same byte length (10).

    Regards,
    Walter
  • Hi James,

    After generating the code for EVM430-i2040S_SH_1V_1C_60Hz (no change), I was trying to debug the serial port RX if I can get response if I send a test packet, firmware version as mentioned above.

    In comm.c, there is a function called "Comm_uartReceiveHandler(uint8_t ui8Data)" which I assume is this the received uart packet. Planning to put breakpoint while we send a test packet from host mcu.

    Regards,
    Walter
  • Hi James,


    I notice in your sample EVM430-i2040S_SH_1V_1C_60Hz and EVM430-i2040S_SH_1V_1C_50Hz are two different things. But generated code almost same except some configs in 3 files in EM_ config. As must as possible, we want touse same firmware for 60/50Hz.

    Regards,
    Walter
  • Hi James,

    Do you have any response?

    We have loaded the generated CCS code from EVM430-i2040S_SH_1V_1C_60Hz, but my msp430i2040 chip not responding when I send a simple 250kbaud uart TX command of getting firmware application as mentioned above. Basically, I am not getting any response from my uart RX pin.

    This is critical on our side...

    Thanks,
    Walter
  • Walter Macamos said:
    I notice in your sample EVM430-i2040S_SH_1V_1C_60Hz and EVM430-i2040S_SH_1V_1C_50Hz are two different things. But generated code almost same except some configs in 3 files in EM_ config. As must as possible, we want touse same firmware for 60/50Hz.

    Yes, these projects are very similar. You'll want to make a custom project based on one of these example EMDC projects (you can just use "Save As" option in EMDC GUI) where you increase the min and max frequencies to cover both 50Hz and 60Hz and then regenerate the code. The EMDC Technology Guide shows how you can change the nominal frequency (described here) and then change the min/max values (found here). I'd recommend using either 50Hz or 60Hz as the nominal and then increasing the limits to 45Hz and 65Hz. Since you're trying to cover a wider range of AC input frequencies, you'll need to increase the number of IIR step sizes for the IIR filter coefficients to maintain accuracy (described here) across more frequencies.

    Also, you may need to re-calibrate the EVM430-i2040S after programming it with the newly-generated EMDC code.

    Regards,

    James

  • Hi James,

    Thank you for giving us heads up about how to use same formware for 50Hz/60Hz. We can deal with it later once we have a basic operation working.

    Our problem:
    We have loaded the generated CCS code from EVM430-i2040S_SH_1V_1C_60Hz, but my host mcu send a simple 250kbaud TX packet command, but receive data seems to be is "echoed" only.

    Example:

    1. //Read application version
    char cmdAppVersion[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X05, 0X00, 0X0B, 0X00};
    char cmdAppVersionResponse[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X05, 0X00, 0X0B, 0X00};

    2. //Command 0x03 (Request Calibration Values)
    char cmdAppVersion[9] ={0x55, 0XAA, 0X06, 0x04, 0X03, 0X01, 0x00, 0X08, 0X00};
    char cmdAppVersionResponse[9] ={0x55, 0XAA, 0X06, 0x04, 0X03, 0X01, 0x00, 0X08, 0X00};

    3. //Command 0x01 (Configure Mode)
    char cmdAppVersion[9] ={0x55, 0XAA, 0X06, 0x04, 0X01, 0X01, 0x02, 0X08, 0X00};
    char cmdAppVersionResp[9] ={0x55, 0XAA, 0X06, 0x04, 0X01, 0X01, 0x02, 0X08, 0X00};

    What seems to be be the problem? My uart setting is this...

    #define MSEC_TO_TICKS(x) (x * 1000 / Clock_tickPeriod)
    UART_init();
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readTimeout = MSEC_TO_TICKS(10000);
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 250000;
    Uhandle = UART_open(Board_UART0, &uartParams);

    Regards,
    Walter
  • Hi Walter,

    Have you gone through the complete Out-of-Box experience and been able to view results in the EMDC GUI with the EVM430-i2040S hooked up to high voltage AC? This would be a good first step. Then, you can take a logic analyzer and see exactly what's getting sent and received between the EMDC GUI (PC) and the EVM430-i2040S as another reference for implementing the commands on your host MCU. The Communication Protocol Spec section in the EMDC Technology Guide describes the communication handling performed by the default application code generated by EMDC.

    Then, when you move to connecting the EVM430-i2040S to your host MCU, you can modify the application code (e.g. change the communication protocol and state machine) after it's generated by EMDC. If you do, it won't work with the EMDC GUI anymore but would work with your host MCU.

    Walter Macamos said:
    Our problem:
    We have loaded the generated CCS code from EVM430-i2040S_SH_1V_1C_60Hz, but my host mcu send a simple 250kbaud TX packet command, but receive data seems to be is "echoed" only.

    Example:

    1. //Read application version
    char cmdAppVersion[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X05, 0X00, 0X0B, 0X00};
    char cmdAppVersionResponse[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X05, 0X00, 0X0B, 0X00};

    2. //Command 0x03 (Request Calibration Values)
    char cmdAppVersion[9] ={0x55, 0XAA, 0X06, 0x04, 0X03, 0X01, 0x00, 0X08, 0X00};
    char cmdAppVersionResponse[9] ={0x55, 0XAA, 0X06, 0x04, 0X03, 0X01, 0x00, 0X08, 0X00};

    3. //Command 0x01 (Configure Mode)
    char cmdAppVersion[9] ={0x55, 0XAA, 0X06, 0x04, 0X01, 0X01, 0x02, 0X08, 0X00};
    char cmdAppVersionResp[9] ={0x55, 0XAA, 0X06, 0x04, 0X01, 0X01, 0x02, 0X08, 0X00};

    I'm not sure why you're getting an echo. For #1, you should see that the EVM430-i2040S sends back the packet with a Write byte (0x01) after the command byte (0x02). Make sure your host MCU isn't somehow receiving what you're sending. An easy check would be to do the following:

    • Remove the EVM430-i2040S from the high voltage AC.
    • Power the EVM430-i2040S using a 3.3V bench supply or switch the jumpers to power it using the MSP-FET.
    • Bypass the MSP-ISO by connecting the F5529 HID bridge (or host MCU) directly to the EVM430-i2040S using jumper wires connecting the UART TX, RX, and GND pins correctly (not VCC).

    Walter Macamos said:
    What seems to be be the problem? My uart setting is this...

    #define MSEC_TO_TICKS(x) (x * 1000 / Clock_tickPeriod)
    UART_init();
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readTimeout = MSEC_TO_TICKS(10000);
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 250000;
    Uhandle = UART_open(Board_UART0, &uartParams);

    Is this code from your host MCU? What is the host MCU? For your development, you may want to use a terminal program on your PC to send over the EMDC protocol commands to see how the data is received and processed by the EVM430-i2040S. I hope this helps!

    Regards,

    James

  • Hi James,

    Just to make things clear I'm not using the EVM430-i2040S evaluation board already but our own hardware board based on your EVM (only difference is (2Voltages, 2Currents) measurements. We are not using your development board ate the moment.

    We can program the generated CCS code from EVM430-i2040S_SH_1V_1C_60Hz to new board already. No change in generated code.

    "Then, when you move to connecting the EVM430-i2040S to your host MCU, you can modify the application code (e.g. change the communication protocol and state machine) after it's generated by EMDC. If you do, it won't work with the EMDC GUI anymore but would work with your host MCU."
    - you mean to say, we need to change something in the generated code in order to work? Please elaborate.

    Our host MCU is your cc2652 chip, The UART seems to be working when sending basic RX/TX to a test terminal in PC. No echoed data in the host MCU in this case. So meaning no uart echo issue by my host mcu as stand alone.

    Regards,
  • Hi Walter,

    Walter Macamos said:
    Just to make things clear I'm not using the EVM430-i2040S evaluation board already but our own hardware board based on your EVM (only difference is (2Voltages, 2Currents) measurements. We are not using your development board ate the moment.

    That's great to hear! It definitely helps clear things up.

    Walter Macamos said:
    We can program the generated CCS code from EVM430-i2040S_SH_1V_1C_60Hz to new board already. No change in generated code.

    I'm assuming that you've modified this example project to fit your system configuration which is fine.

    Walter Macamos said:
    "Then, when you move to connecting the EVM430-i2040S to your host MCU, you can modify the application code (e.g. change the communication protocol and state machine) after it's generated by EMDC. If you do, it won't work with the EMDC GUI anymore but would work with your host MCU."
    - you mean to say, we need to change something in the generated code in order to work? Please elaborate.

    I mean that we created application code that handles the communication state machine to support interaction with the EMDC GUI functionality. The UART interface was selected, so it could be used for the same protocol from our CapTIvate Design Center (EMDC shares the same framework). The EMDC GUI generates this application code for all supported devices, so that users can utilize the EMDC GUI functionality without writing a single line of code for evaluation.

    Now, when you move from the GUI and our development EVMs to your host MCU and system, you may need to modify the application code accordingly. If you plan to use UART and the same protocol, then you may need to make minor changes - such as slowing down the baud rate to 9600. However, some users may need to implement a different communication interface and/or protocol. This can be done while still leveraging the EMDC APIs! I hope that makes more sense.

    Walter Macamos said:
    Our host MCU is your cc2652 chip, The UART seems to be working when sending basic RX/TX to a test terminal in PC. No echoed data in the host MCU in this case. So meaning no uart echo issue by my host mcu as stand alone.

    That's good to hear. Thanks for sharing more details about the host MCU.

    To help get you started with the communication between your host MCU and your MSP430i2041-based system, I spent some time communicating with my MSP430i2041 device (programmed with EMDC-generated code) over a TTL-to-serial adapter using a terminal called Serial Port Utility.

    After some testing using first the EMDC GUI (with F5529 LaunchPad) and then the terminal (with serial adapter), I realized that the EMDC GUI operates at 250kbaud but there's a 1ms delay between each byte in the packet as shown in the logic analyzer screenshot below. Channel 0 monitors the i2041's RX pin, and Channel 1 monitors the i2041's TX pin.

    Zoomed-out


    Zoomed-in


    When using the Serial Port Utility terminal to send the same packet, there's minimal delay between each byte sent to the i2041 (as shown below), and our communication state machine doesn't seem able to process the data that fast. Using the terminal, if I sent each byte sequentially, I get the expected response from the device as shown below. Again, Channel 0 monitors the i2041's RX pin, and Channel 1 monitors the i2041's TX pin.

    So, you should be able to communicate with the MSP430i2041 using your CC2652 host MCU by delaying each TX byte by 1ms. I hope this helps!

    Regards,

    James

  • Walter Macamos said:
    Example:

    1. //Read application version
    char cmdAppVersion[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X05, 0X00, 0X0B, 0X00};
    char cmdAppVersionResponse[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X05, 0X00, 0X0B, 0X00};

    For my testing, here's what I would expect for the first command.

    1. //Read application version
    char cmdAppVersion[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X00, 0X00, 0X00, 0X06, 0X00}; // Sent by the host MCU with 1ms delays between bytes to i2041
    char cmdAppVersionResponse[10] ={0x55, 0XAA, 0X07, 0x04, 0X02, 0X01, 0X05, 0X00, 0X0C, 0X00}; // Reply sent back to host MCU from i2041

    Regards,

    James

  • Hi James,

    I checked with TI, it seems that the SDK do not have an inter byte delay.

    e2e.ti.com/.../743961

    Do you think sending 1 byte at a time then put delay in between is feasible as suggested by YK Chen ?
    Or we need to write a new uart driver?

    Regards,
    Walter
  • Hi James,

    Please advise me quickly on this.
    This is very critical for us because we need to make sure the tandem of cc2652 host mcu can work with msp430i2041 energy monitoring via uart.

    If possible, please let us know a quick solution for this because we do not have time.
    Can you provide us a uart driver for this purpose?

    Thanks &Regards,
    Walter
  • Walter Macamos said:
    I checked with TI, it seems that the SDK do not have an inter byte delay.

    Looking at the CC2652 thread, they mentioned that it's possible to do but not supported natively by their SDK.

    Walter Macamos said:
    Do you think sending 1 byte at a time then put delay in between is feasible as suggested by YK Chen ?
    Or we need to write a new uart driver?

    Before doing this, try following my instructions in the thread below to change the UART settings from 250kbaud to 9600 baud in the EMDC-generated code for the i20xx. Keep in mind that this will prevent the generated code from working with the EMDC GUI, but you can always jump back and forth between these baud rates during your development and testing with the GUI and your host MCU. You may need to refer to the i20xx datasheet and user's guide for the correct baud rate settings.

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

    This may save you time trying to rewrite the CC2652 SDK's UART driver.

    Regards,

    James

  • Walter Macamos said:
    his is very critical for us because we need to make sure the tandem of cc2652 host mcu can work with msp430i2041 energy monitoring via uart.

    I have no doubts that these MCUs can work well together, but it will take you some time to get everything integrated. I'm confident that you can do it.

    Walter Macamos said:
    If possible, please let us know a quick solution for this because we do not have time.
    Can you provide us a uart driver for this purpose?

    While I can't provide you with a UART driver, we will do our best to support your development here through E2E.

    Regards,

    James

  • Hi James,

    This is the data I receive after changing baudrate to 9600.

    Written data (COM1)
    55 aa 07 04 02 00 05 00 0b 00
    Read data (COM1)
    55 aa 07 04 02 01 05 00 0c 00
    Written data (COM1)
    55 aa 06 04 03 01 01 09 00
    Read data (COM1)
    55 aa 14 04 b0 01 01 8c 09 b9 17 b0 dd 43 10 06
    a7 b1 18 72 00 e3 05 55 aa 06 04 03 01 02 0a 00
    Written data (COM1)
    55 aa 07 04 04 00 00 00 08 00
    Read data (COM1)
    55 aa 07 04 04 01 04 04 11 00
    Written data (COM1)
    55 aa 06 04 01 01 01 07 00
    Read data (COM1)
    55 aa 0a 04 80 01 01 00 00 00 00 86 00 55 aa 0a
    04 81 01 01 0c 31 00 00 c4 00 55 aa 0a 04 82 01
    01 00 00 00 00 88 00 55 aa 0a 04 83 01 01 5c 45
    00 00 2a 01 55 aa 0a 04 84 01 01 00 00 00 00 8a
    00 55 aa 08 04 85 01 01 00 00 8b 00 55 aa 0e 04
    86 01 01 00 00 00 00 00 00 00 00 8c 00 55 aa 0e
    04 87 01 01 eb ff ff ff ff ff ff ff 71 08 55 aa
    0e 04 88 01 01 15 00 00 00 00 00 00 00 a3 00 55
    aa 0e 04 89 01 01 dd 00 00 00 00 00 00 00 6c 01
    55 aa 0e 04 8a 01 01 c4 00 00 00 00 00 00 00 54
    01 55 aa 0e 04 8b 01 01 29 01 00 00 00 00 00 00
    bb 00

    Can write/read but it is so slow using 9600. ( I will try to optimize the highest possible baudrate)

    During initiatialization, we can do the to save time:

    -Read Application Version (0x02)
    -Write Request Calibration Values (0x03)
    -Read ADC Buffer Size (0x04

    I'm planning to issue only Set Configuration to Active only when user request power monitoring result. Then set Set Configuration to Idle immediately to off result.

    In this case, when is best time to do calibration? How do we know we need to perform calibration?

    Regards,
    Walter
  • Walter Macamos said:
    This is the data I receive after changing baudrate to 9600.

    Sounds like a good start!

    Walter Macamos said:
    Can write/read but it is so slow using 9600. ( I will try to optimize the highest possible baudrate)

    I'm not sure what you're asking here. You may want to keep the 9600 baud rate to continue focusing on the interactions between the target and the Host MCU before increasing the baud rate on the Host MCU.

    Walter Macamos said:
    During initiatialization, we can do the to save time:

    -Read Application Version (0x02)
    -Write Request Calibration Values (0x03)
    -Read ADC Buffer Size (0x04

    That should be fine assuming you're going to keep the EMDC-generated unchanged. As I mentioned before, you can always modify the application code to set up your own communication state machine to handle certain or different commands. Keep in mind that our goal was that this code work with the EMDC GUI.

    When the initial commands between the EMDC GUI and the target are exchanged, the application version and the calibration values are queried by the GUI in order to display those things in the GUI. Assuming you don't want to use the EMDC GUI, you can remove everything in the communication state machine to just switch the target into ACTIVE mode to save you time.

    Walter Macamos said:
    I'm planning to issue only Set Configuration to Active only when user request power monitoring result. Then set Set Configuration to Idle immediately to off result.

    This should be possible if you modify the default communication state machine. After the target switches to ACTIVE mode, it will send results to the host MCU approximately every 1 second. The number of results depends on what results were selected in EMDC before generating the code.

    Walter Macamos said:
    In this case, when is best time to do calibration? How do we know we need to perform calibration?

    For calibration, you'll need accurate test equipment to provide a known good source. Calibration is typically done only once per system. Now, the calibration process has several parts to it, specifically Gain calibration and Phase calibration for each phase. If you keep the communication state machine unchanged, you could use the EMDC GUI to calibrate your system and then change your baud rate to 9600 for use with the host MCU. Otherwise, you'll have to get familiar with how the EMDC GUI calibrates the system. If you're using a custom board, you'll need to calibrated it for best performance and accuracy. If you're using a supported EVM, then you could use the pre-configured EMDC projects and copy over the calibration factors to get started.

    Regards,

    James

  • Hi James,

    For calibration, you'll need accurate test equipment to provide a known good source. Calibration is typically done only once per system.
    - In factory, we want to perform 1 time calibration of our hardware. Is there a case where performance measurement will degrade and will be needing recalibration?

    Now, the calibration process has several parts to it, specifically Gain calibration and Phase calibration for each phase. If you keep the communication state machine unchanged, you could use the EMDC GUI to calibrate your system and then change your baud rate to 9600 for use with the host MCU. Otherwise, you'll have to get familiar with how the EMDC GUI calibrates the system.
    - I think, in this case 2 firmware needs to be loaded (1 for calibration, 1 for 9600 baud rate firmware). Do we need to calibrate hardware in production one by one, or re use calib values for others?

    If you're using a custom board, you'll need to calibrated it for best performance and accuracy. If you're using a supported EVM, then you could use the pre-configured EMDC projects and copy over the calibration factors to get started.

    - Our board is not an EVM, so calibration needs to be done for better accuracy.


    Regards,
    Walter
  • Walter Macamos said:
    - In factory, we want to perform 1 time calibration of our hardware. Is there a case where performance measurement will degrade and will be needing recalibration?

    Typically not.

    Walter Macamos said:
    - I think, in this case 2 firmware needs to be loaded (1 for calibration, 1 for 9600 baud rate firmware). Do we need to calibrate hardware in production one by one, or re use calib values for others?

    You could do it that way. Using the GUI for calibration should save you time over implementing the calibration process and algorithm on the MCUs. You could do this using a single EMDC project. First, you'd take this project and generate the EMDC code, which you'd use to program all devices to get started. To calibrate the system, you'd just connect to the EMDC GUI, perform the calibration (gain and phase) using accurate test equipment and GUI, and then choose to save those calibration factors to the INFO memory of the device. Then, assuming your 9600 baud rate firmware hasn't been changed (outside of the baud rate), the calibration factors shouldn't get overwritten when this firmware is programmed. Then, it can load the new calibration factors and use those.

    Walter Macamos said:
    - Our board is not an EVM, so calibration needs to be done for better accuracy.

    Sure, that's understandable. If you have accurate test equipment, the EMDC GUI can be used to calibrate your board. If you have any questions about the calibration process, refer to the EMDC Technology Guide or start a new post when that time comes.

    Regards,

    James

  • Hi James,

    No change in generated code except the UART baud rate from 250kbaud to 9600. So, agree with you to use the TI  EMDC GUI for calibration process.

    I was trying to expand the MSP430i2040S_1V_1C_60Hz to 2 channels (2V_2C_60Hz).

    Planning to measure only Vrms, Irms, Frequency, Active Power and Active Energy.

    I have problem setting Pulses tab.

    What is the correct value to set in Pulses tab in this case?

    http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/EnergyMeasurementDesignCenter/1_30_00_00/release/EnergyMeasurementDesignCenter_1_30_00_00/docs/users_guide/html/Energy_Measurement_Technology_Guide_html/markdown/ch_designcenter.html#advanced-parameters

  • Hi Walter,

    From the shared screenshots, I see you're making good progress!

    Walter Macamos said:
    Planning to measure only Vrms, Irms, Frequency, Active Power and Active Energy.

    That's fine. If phase angle is something you're interested in measuring, you may want to enable the Power Factor and Reactive Power/Energy. Then, your host could use these values to calculate the phase angle (between the voltage and current). If it's not required, then don't worry about it.

    Walter Macamos said:
    I have problem setting Pulses tab.

    Looking at the "Pulses" window, you'll need to check "Enable" to use the pulses. If you don't need individual pulses for each phase, then you just need to enable the Total and select the port/pin for the Active Energy pulse output.

    Walter Macamos said:
    What is the correct value to set in Pulses tab in this case?

    Well, you can change the "Pulses Per kWH" in the "Advanced Parameters" tab if you'd like. We actually use the SD ADC ISRs to generate the pulse so there are some limitations if you increase this number too high. Basically, this is the constant that gets used by the accurate test equipment for calibration and perhaps in the field by the host MCU or other device that counts the pulses to determine the Active Energy consumption. We use 6400 pulses as the default but other values like 1600 could also be used. Just make sure both the i2041 and your test equipment match, and you should be fine.

    Please let me know if you have any other questions!

    Regards,

    James

  • As a follow-up, you can see where I calculated the number of pulses per ADC sample in the thread below. You don't have to do these calculations for your configuration if you use 6400. I just wanted to shed some light on the relationship between the pulse constant (pulses/kWH), the ADC sampling rate, and the maximum expected power/energy.

    MSP430F67641: The error of large current

    Regards,

    James

  • Hi James,

    Just clarification, I am not only interested to measure reactive power. I am interested to measure the following(Phase A and Phase B):
    -Vrms
    - Irms
    -Frequency
    -Active Power
    -Active Energy

    Looking at the "Pulses" window, you'll need to check "Enable" to use the pulses. If you don't need individual pulses for each phase, then you just need to enable the Total and select the port/pin for the Active Energy pulse output.
    - I am only interested to measure Active power/ energy not reactive power/energy, so is this means I need to put only the active port/pin?
    What is difference of individual pulses for each phase and same pulse for all phases? How does it impact the calibration?


    Regards,
    Walter
  • Walter Macamos said:
    Just clarification, I am not only interested to measure reactive power. I am interested to measure the following(Phase A and Phase B):
    -Vrms
    - Irms
    -Frequency
    -Active Power
    -Active Energy

    That's fine.

    Walter Macamos said:
    - I am only interested to measure Active power/ energy not reactive power/energy, so is this means I need to put only the active port/pin?

    Correct. If you just select Active Energy in the "Results" tab, the Reactive Energy port/pin won't be enabled when you check "Enable" as shown below. Select the port/pin that you'd like to use for Active Energy.

    Walter Macamos said:
    What is difference of individual pulses for each phase and same pulse for all phases? How does it impact the calibration?

    Typically, we just use the total pulse output, not the individual phase pulses. On our larger EVMs, these pulse outputs drive LEDs, so you can see the Active energy consumption for each phase by looking at the LEDs. Assuming you'll need to have a single output for your application (let's say the pulses feed into a pulse counter), then just use Total.

    If you don't require a single output, you could use individual pulse outputs per phase. During calibration, you'd connect the pulse reader from your accurate test equipment to Phase A's pulse output and apply voltage and current to Phase A's sensors. For Phase B, you'd need to move the pulse reader to Phase B's pulse output and apply the voltage and current to Phase B's sensors.

    If you choose to use Total's pulse output, then you won't have to change the test equipment pulse reader since there's only one pulse output. Instead, you'd just apply the voltage and current ONLY to the phase you'd like to calibrate and then switch to the other phase's sensors when completed. The EMDC GUI allows you to calibrate each phase individually. I hope this helps!

    Regards,

    James

  • Hi James,

    Based from calculations, in our requirement maximum of V=250V, I=10A = P 2.5KW, what is the recommended :

    Impulses per KW, Pulse Duration ( # of ADC sample)?

    Regards,
    Walter
  •  Hi James,

    Here is our final settings, please let me know if this is OK.

    By the way, I also changed the nominal freq = 60Hz,  min freq =45 and max freq to 65 Hz.

    Regards,

  • Walter Macamos said:
    Based from calculations, in our requirement maximum of V=250V, I=10A = P 2.5KW, what is the recommended :

    Impulses per KW, Pulse Duration ( # of ADC sample)?

    I'd recommend using the default values, no need to change them (6400 impulses per kWH, 20 ADC samples). Just make sure your test equipment matches this constant.

    Regards,

    James

  • Walter Macamos said:

    Here is our final settings, please let me know if this is OK.

    By the way, I also changed the nominal freq = 60Hz,  min freq =45 and max freq to 65 Hz.

    Since you don't need to measure Reactive Energy, you don't need the Reactive pulse, but that's minor. You could choose a different port/pin than P2.0 for Active energy pulses if necessary. We just picked that I/O because it's tied to an LED on the EVM430-i2040S.

    More importantly, you increased the range of frequencies by 10 (from 2 to 20 Hz), which is fine. However, you'll have less resolution across that range by keeping the same IIR step size at 101. This may reduce performance, so I'd recommend increasing the step size from 101 to 201.

    Other than that, everything seems to be fine. Nice work!

    Regards,

    James

  • Hi James,

    Since you don't need to measure Reactive Energy, you don't need the Reactive pulse, but that's minor. You could choose a different port/pin than P2.0 for Active energy pulses if necessary. We just picked that I/O because it's tied to an LED on the EVM430-i2040S.

    - I understand, I checked our schematic and the p2.0 is available for active energy measurement. In case, I will need later the P1.0 is free also for rerative energy.

    More importantly, you increased the range of frequencies by 10 (from 2 to 20 Hz), which is fine. However, you'll have less resolution across that range by keeping the same IIR step size at 101. This may reduce performance, so I'd recommend increasing the step size from 101 to 201.

    - Please confirm.

    Previous setting:

    nominal frequency: 60Hz

    min 58, max= 62

    IIR 101

    Now:
    nominal frequency: 60Hz
    min 45, max= 65

    IIR 101 change to 201?

    Regards,

    Walter

  • Walter Macamos said:
    - I understand, I checked our schematic and the p2.0 is available for active energy measurement. In case, I will need later the P1.0 is free also for rerative energy.

    Excellent.

    Walter Macamos said:

    - Please confirm.

    Previous setting:

    nominal frequency: 60Hz

    min 58, max= 62

    IIR 101

    Now:
    nominal frequency: 60Hz
    min 45, max= 65

    IIR 101 change to 201?

    Confirmed. Basically, 201 will give you a nice rounded step size between frequencies. For the default configuration, the range is 4 Hz divided by (101-1) steps which equals 0.04 Hz per step. For your configuration, the range is now much wider at 20 Hz so we increased the step sizes to gain back some resolution. I recommend 201 instead of 249 or 250 (since we can't use 251 because it's above the upper limit) to keep the step size "cleaner" at 0.1 Hz per step (rather than a long decimal value like 0.080321285 Hz per step).

    Regards,

    James

  • Hi James,

    Ok, thanks for the confirmation.

    Regards,
    Walter

**Attention** This is a public forum