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.

IAR uses low power, CCS uses 5mA

Other Parts Discussed in Thread: SIMPLICITI

Hi,

I also posted this thread in the MSP430 forum, but it seems like it's mostly a CCS problem.

Link: http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/p/122923/439259.aspx#439259

I'm trying to use the eZ430-RF2500 Module to communicate between the Cymbet CBC-Eval-09 Energy Harvesting Module and the Computer. The original Cymbet code which is compiled in IAR works fine, and it uses about 0.3uA most of the time. But if I compile the same code with CCS v4 I measure a current draw of 5mA. The problem is, that the energy harvesting kit is unable to supply this amount of power over long periods of time, and it crashes pretty quickly.

I tried making just about the lowest power code I could find:


#include "bsp.h"
#include "mrfi.h"
#include "bsp_leds.h"
#include "bsp_buttons.h"
#include "nwk_types.h"
#include "nwk_api.h"
#include "nwk_frame.h"
#include "nwk.h"

#include "msp430x22x4.h"
#include "vlo_rand.h"


  void main (void)
{
  WDTCTL = WDTPW + WDTHOLD; // Turn off Watchdog
  BSP_Init();
  SMPL_Init(0);
  SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, 0 ); //Turn off Radio
  while(1)
  {
      __bis_SR_register(LPM4_bits); //Clocks off
  }
}

 

 

Again, if I compile with IAR it works fine, if I compile with CCS it draws too much power.

I can't use the IAR for the whole project since it takes a bit longer than 30 days and uses a bit more code than the trial version allows so I'm pretty much stuck here.

 

Is there some setting on CCS I have to change to make it work properly? Do I have to go into the included files and change them? The files Cymbet used are a bit older and not compatible with CCS so I was not able to completely switch them out.

It seems to me the Low Power Mode 4 never really gets turned on in the CCS code, though if I go into debug mode(drawing power from the PC, so I can't measure the current there ) the code seems to stop when it gets to that point. Or if I try it with LMP3 and ACLK on a 10 second timer that ends LMP3 it stops for about 10 seconds, then jumps to the interrupt, turning off LMP3 then in the while loop back to LMP3 etc.

 

One person said it might not shut off the radio completely since I turn off the clocks right after, but I tried switching the commands and using a for loop and that didn't help.

Another user told me that CCS is 1GB big and I set something wrong.

 

By the way, I used the Wireless Sensor Monitor project given with the eZ430-RF2500 Module as the base of my project so maybe the problem is somewhere in there? Does it import some settings to CCS? I didn't change any other settings besides Build Steps: Create flash image: Intel-HEX.

  • Hi,

    Just making something clear: does the code you sent above draw less power in IAR than in CCS? If so, can you inspect if the registers are being correctly written in CCS?

    Unless the BIS operation is functionally incorrect, from a compiler standpoint I don't see any issues with the implementation. Since our compiler also has the intrinsic _low_power_mode_4(void), can you try using that instead of setting the bits manually? For reference check section 6.7 of the MSP430 Compiler User's Guide (link here).

    Another detail I would inspect is the assembly code generated - however I don't think it should matter as setting the LPM4 mode stops the CPU execution and therefore it becomes completely independent of the code generated by the compiler itself...

    At last, although I am not an expert in the modules you are using, I searched around on the forum and found an example code posted that has a routine that turns off the ez430-RF2500 - the source code mentions it is lowest possible power setting (LPM3). For the details on this you should ask in the device forum.

    Hope this helps,

    Rafael

  • Hi,

    another thing .... which examples are you trying and downloading?   SimpliciTI was ported to CCS, however typically the examples are in different folders for the two.

    Regards,
    Lisa

  • Thanks for the reply Rafael,

    Yes, the compiled code uses more power in CCS than in IAR. I don't know when debugging, but when using the battery module.

    The registers seem to be written correctly in debugging mode. LMP4 activates the bits SCG0, SCG1, OSCOFF and CPUOFF in the Status Register.

    I didn't see a difference using __bis_SR_register(LPM4_bits); vs low_power_mode_4();

    I couldn't read your example code cause it said that the group wasn't found.

    And I'm not sure how to find the assembler code in IAR...

     

    Hi Lisa,

    I'm using the code on the CD that came with the eZ430-RF2500 Development Tool under:

    Software\eZ430-RF2500 Wireless Sensor Monitor.zip\eZ430-RF2500 Wireless Sensor Monitor\eZ430-RF2500 Wireless Sensor Monitor\CCS_Source\Projects\Examples\peer_applications\eZ430RF\eZ430-RF2500_WSM

    which I believe is the same as can be found in slac139f

     

  • Hi Samuel,

    please give the latest version a try ... the one from the web and let us know. 

    http://www.ti.com/litv/zip/slac139f

    Sometimes the versions on the CDs are outdated, yours for sure as the web version is from a couple months ago, and therefore may be without certain bug fixes.

    Have you been following the instructions on importing the project into CCS?  Ie with the DEV_ROOT etc ...  

    Best Regards,
    Lisa

  • Hi Samuel,

    I just wanted to check whether you have been abke to sort things out with our tips.

    Best Regards,

    Lisa

  • Hi Lisa,

    Sorry I haven't written in a while. I'm a student so I only work on this project a few days a week.

    I tried replacing the files with the new version, but it didn't make a difference. The new version doesn't require you to define the root either. But yes, I followed the README on the old version.

    Regards,

    Samuel

     

     

  • Hi Samuel,

    Have you tried the code as provided for IAR?  Have you made progress checking some of the CCS settings? 

    Have you checked non-SimpliciTI/Cymbit code or examples?

    Cheers,
    Lisa

  • Hi Lisa,

     

    I looked at the settings and checked the manual but I couldn't find anything that is the likely cause. I don't know enough about CCS.

     

    I have tried other examples, but they are usually just the main file and the rest of the include files are the same. I have not tried importing a whole new project designed for the ez430.

     

    Sincerely,

    I tried the IAR code, with some changes since CCS didn't accept, for example, variable declarations after the first function. Just the changes necessary to compile. However, it didn't make a difference with CCS. Or do you mean the .s43 or .d43 codes? I don't know if I can import those to CCS somehow.

    Samuel

  • Hi Samuel,

    well I do have a couple remaining thoughts.

    Have you been trying to measure the current consumption when debugging/attached to the PC?   If so this is not the best practice.

    Also if so then the problem could be that CCS will not automatically release the JTAG connection for you.   Please be sure you use 'Release JTAG on Go'.

    In CCS, this option is found under the Run icon; use the drop-down menu by clicking the arrow
    next to the Run icon and select the 'Run Free' option.

     

    Please give that a try.

    Best Regards,
    Lisa

  • Hi Lisa,

    No, I used the battery unit.

    I also tried Project -> Properties -> C/C++ Build -> Build Steps

    Create flash image: Intel-HEX

    I then loaded that program using FET-Pro430 Lite.

    Is there some possibility that it would then try something via the JTAG?

  • Hi Samuel,

    no if you have been measuring disconnected from the debugger/PC then it will not be the JTAG being held or something like that.

    Is the same board you load with a IAR hex and a CCS hex and notice this difference?  Because if so then we will have to see if we can determine why it seems CCS is not putting the chip into the LPM correctly.

    Best Regards,
    Lisa

  • Hi Lisa,

    Yes, it was the same module. IAR uses a .d43 HEX and CCS produces Intel HEX, (.hex) that's the only difference I saw.

    Thanks for the help,

    Samuel

  • Hi Samuel,

    I am at a bit of a loss as the code seems to be ok.  A silly thing but what if you change the CCS version to _BIS_SR(LPM4_bits); ?

    Please let me know and in the mean time I will keep trying to determine if I can think of what might be happening.

    Best Regards,
    Lisa

  • Hi Samuel,

    has there been any update to your enquiry?

    Best Regards,
    Lisa