cromiumlake 2 Posted May 12, 2013 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 Quote Share this post Link to post Share on other sites
spirilis 1,264 Posted May 12, 2013 I know in mspgcc we have LPM0, LPM1, LPM2, LPM3, LPM4 macros, so instead of __low_power_mode_0(); just type LPM0; 1 cromiumlake reacted to this Quote Share this post Link to post Share on other sites
cromiumlake 2 Posted May 12, 2013 Thanks Spirilis, it worked...I also changed TIMERA0_VECTOR for TIMER0_A0_VECTOR as mentioned on the header file. But the errors: blink3.c: In function Quote Share this post Link to post Share on other sites
spirilis 1,264 Posted May 12, 2013 Sounds like odd characters ended up in the file when you copied & pasted. Maybe re-type the contents of the ISR by hand. Quote Share this post Link to post Share on other sites
cromiumlake 2 Posted May 12, 2013 I already did, the thing is TA0_ISR does not appear on msp430g2553.h under any #define or otherwise Quote Share this post Link to post Share on other sites
spirilis 1,264 Posted May 12, 2013 Huh, weird. Don't know, but I always include <msp430.h> and make sure mspgcc has the "-mmcu=msp430g2553" option instead. Quote Share this post Link to post Share on other sites
jpnorair 340 Posted May 12, 2013 Something is wrong with your text formatting. Use UTF-8, that should work. 1 cromiumlake reacted to this Quote Share this post Link to post Share on other sites
cromiumlake 2 Posted May 12, 2013 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? Quote Share this post Link to post Share on other sites
cde 334 Posted May 12, 2013 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) Quote Share this post Link to post Share on other sites
cromiumlake 2 Posted May 12, 2013 My 2553.h does not mentioned anything with ISR (ctrl+f ISR) msp430g2553.txt Quote Share this post Link to post Share on other sites
simpleavr 399 Posted May 12, 2013 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. Quote Share this post Link to post Share on other sites
cromiumlake 2 Posted May 12, 2013 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. Quote Share this post Link to post Share on other sites