Jump to content
Sign in to follow this  
cromiumlake

__low_power_mode_0()

Recommended Posts

Hello there,

 

 

I'm reading  the Davies Msp430 book once again, this time trying to follow the examples on the book. I noticed that some assembly ported syntax that resides in intrinsics.h, but it happens that many of his examples do not have an equivalent on my version of intrinsics. I'm guessing that  is because I'm using msp430-gcc tool chain. For example if I try to use something like:

 

 

----------------

 

#include <msp430g2553.h>
#include <intrinsics.h>
 
int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;  
  P1DIR |= BIT0;                            // Set P1.0 to output direction
  P1OUT |= BIT0;                           // Clear P1.0 LED on
 
__enable_interrupt();
for (;;) {
__low_power_mode_0();
}
}
 
#pragma vector = TIMERA0_VECTOR
__interrupt void TA0_ISR (void)
{
P2OUT

Share this post


Link to post
Share on other sites
Yeah, I'm using a batch file with that on my setup:
 
#!/bin/bash
 
echo "------------------------------------------------"
msp430-gcc -g -Wall -Os -mmcu=msp430g2553 -o blink3.elf blink3.c
msp430-objcopy -O ihex blink3.elf blink3.hex
sudo mspdebug rf2500 "prog blink3.hex"
 

==========

If I run from shell:
file blink3.c
blink3.c: C source, UTF-8 Unicode text
 
I found in stackoverflow that file verifies only fewlines to determine encoding.

So a friend of mine came to the rescue, using:

hexdump -C filename

 

That helped to find the guilty character '^', it looked the same! but behind the scene was a different encoding.....grrrrrrrrrrr

 

Anyway, those errors now are gone...yeah you guess well...now I have different ones Yeah! (that's the spirit).

 

To start, the Led does not toggle and I get the error:

fet: FET returned error code 4 (Could not find device or device not supported)

 

fet: command C_IDENT1 failed
fet: identify failed
 
 
Any ideas?

 

 

 

Share this post


Link to post
Share on other sites

Doesn't the 2553 have multiple timers? Timer 0 and Timer 1, both with an A0 and A1?

 

I looked at a 2553.h and saw TIMERX_AY_ISR (x for the timer, Y for the A0 or A1)

Share this post


Link to post
Share on other sites
To start, the Led does not toggle and I get the error:
fet: FET returned error code 4 (Could not find device or device not supported)

fet: command C_IDENT1 failed
fet: identify failed

it is what it tells u, mspdebug could not find the chip.

that's what i get when i pull out the mcu device from the LP.

 

/EDIT i.e. your firmware did not got flashed into the device.

 

OTOH, if u have problem w/ the LP "programmer side" comm. i.e. LP not connected to PC, u get.

 

usbutil: unable to find a device matching 0451:f432

 

u should check your h/w connections

 

. the 5x2 jumper block, u need RST and TEST pin connected.

. pull out and insert back your MCU device.

. replace w/ another device, if swapping 2452 for 2553, need to re-compile as the start address is not the same.

 

* i hope u did not have a fried chip. these things are very tolerating though, i only managed to fried 2 io pins over 3 years.

Share this post


Link to post
Share on other sites

Thanks, I noticed that the message came from mspdebug and that seems like a misleading error. If I load any other working code that message disappear.

 

I found the problem, I notice in a flow chart that part of the troubleshooting was a possible clock misconfiguration. So I had to add:

TACCR0 = 49999; // Upper limit of count for TAR

TACCTL0 = CCIE; // Enable interrupts on Compare 0
TACTL = MC_1|ID_3|TASSEL_2|TACLR; // Set up and start Timer A

 

My fault for copying and pasting only from the book. Btw, the file is called timintC2.c, and is one of the many files that can be downloaded from Davie's website.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...