Reply by gmalser August 12, 20132013-08-12
Thank you!
Really appreciated.

Beginning Microcontrollers with the MSP430

Reply by old_cow_yellow August 10, 20132013-08-10
--- In m..., "Redd, Emmett R" wrote:
> ... but all the plusses (+)you use in your code is poor programming technique...

I agree with you. But the real tragic is: There are lots of people "learn by examples" without understanding what they are doing, and there are lots of bad examples.

I once called them "monkey see monkey do engineers". I need to apologize to the monkeys. They actually understand what they learned.

Reply by old_cow_yellow August 10, 20132013-08-10
--- In m..., Giorgio Malservisi wrote:
>...
> Question: How can I erase the Flash of my device? Is it possible to take control of the device in some way?
>...

Answer: Use BSL. Yes, it is possible.

To invoke BSL, one needs to do the following under the control of the PC:

1. Power down the target so that it is not running your code.
2. Hold nRST low before power up the target so that it cannot start to run your code.
3. Follow what TI said about invoking BSL.

What TI missed is step 1. and 2.

Reply by "Redd, Emmett R" August 7, 20132013-08-07
I do not know if this is the cause of your error, but all the plusses (+)you use in your code is poor programming technique. In most of those cases where you are trying to set bits in registers, etc., you should use the Inclusive-OR operator, the vertical bar (|).

Emmett Redd Ph.D. mailto:E...@missouristate.edu
Professor (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University Fax (417)836-6226
901 SOUTH NATIONAL Lab (417)836-3770
SPRINGFIELD, MO 65897 USA Dept (417)836-5131

In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
________________________________________
From: m... [m...] On Behalf Of gmalser [g...@yahoo.com]
Sent: Wednesday, August 07, 2013 1:37 AM
To: m...
Subject: [msp430] Re: Interrupt - BSL - Synchronization Error

Some relevant information went lost in the post:

* Link to schematic: http://www.mastercopy.eu/img/PCB_MSP430.png
* Link to "python-msp430-tools documentation":
http://pythonhosted.org/python-msp430-tools/commandline_tools.html
* Link to MSP430 Datasheet:
http://www.ti.com/lit/ds/symlink/msp430f149.pdf
Code cleaned up:

==============================#include
unsigned int dc;
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

P5DIR = 0XFF; // P5 OUTPUT : LEDs
P5OUT = 0XFF; // LEDs off (Active Low)
P1DIR |= BIT6; // Output
P1SEL |= BIT6; // P1.6 output of Module PWM

TACCR0 = 6000; // Count limit (16 bit)
TACCR1 = 3000; // PWM Duty Cycle

TACCTL0 = 0x10; // Enable counter interrupts, bit 4=1
TACCTL1 |= CCIE + CAP + CM_1; // enable capture and interrupt on rising
and falling edge

TACTL = TASSEL_1 + MC_1 + TACLR; // Timer A 0 with ACLK @ 12KHz + count
UP + Clear

_BIS_SR(LPM0_bits + GIE); // LPM0 (low power mode) with interrupts
enabled
}

#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void) { // Timer0 A0 interrupt service routine
// nothing here
}

#pragma vector=TIMERA1_VECTOR
__interrupt void CCR1_interrupt(void){
if (dc==1) dc=0;
else dc=1;
P5OUT ^= dc; // cause LED 1 to blink
}
==============================
Giorgio

[Non-text portions of this message have been removed]



Reply by gmalser August 7, 20132013-08-07
Some relevant information went lost in the post:

* Link to schematic: http://www.mastercopy.eu/img/PCB_MSP430.png
* Link to "python-msp430-tools documentation":
http://pythonhosted.org/python-msp430-tools/commandline_tools.html
* Link to MSP430 Datasheet:
http://www.ti.com/lit/ds/symlink/msp430f149.pdf
Code cleaned up:

==============================#include
unsigned int dc;
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

P5DIR = 0XFF; // P5 OUTPUT : LEDs
P5OUT = 0XFF; // LEDs off (Active Low)
P1DIR |= BIT6; // Output
P1SEL |= BIT6; // P1.6 output of Module PWM

TACCR0 = 6000; // Count limit (16 bit)
TACCR1 = 3000; // PWM Duty Cycle

TACCTL0 = 0x10; // Enable counter interrupts, bit 4=1
TACCTL1 |= CCIE + CAP + CM_1; // enable capture and interrupt on rising
and falling edge

TACTL = TASSEL_1 + MC_1 + TACLR; // Timer A 0 with ACLK @ 12KHz + count
UP + Clear

_BIS_SR(LPM0_bits + GIE); // LPM0 (low power mode) with interrupts
enabled
}

#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void) { // Timer0 A0 interrupt service routine
// nothing here
}

#pragma vector=TIMERA1_VECTOR
__interrupt void CCR1_interrupt(void){
if (dc==1) dc=0;
else dc=1;
P5OUT ^= dc; // cause LED 1 to blink
}
==============================
Giorgio

[Non-text portions of this message have been removed]

Reply by Giorgio Malservisi August 6, 20132013-08-06
Hello,

I am using a development kit for MSP430F149.
I do not have a JTAG programming tool, therefore I program it through the BSL via a USB COM Port.

The system worked well until I flashed the code here below which is very basic: my intention was just to play with PWM.
Since that moment I cannot reprogram the MSP430F149: The MSPFET — MSP430 flash programming utility and the Python library both output a "synchronization error", which according to the python-msp430-tools documentation it "is typical when the BSL could not be started at all."

I see that while SW tool tries to erase the flash, my program is still running (the LED is blinking), which means that the interrupts are still enabled. I believe that this could disturb the transmission of data via P1.1/TA0 (see schematic in attachment).

Nevertheless I also observe is that if I connect the Hyper-Terminal, the LED stops blinking, which means that the program is not running anymore. Unfortunately I do not see the "?" in the console to send commands to the chip (like erase all...).

Question: How can I erase the Flash of my device? Is it possible to take control of the device in some way?
I see that this "Synchronization Error" is quite common, but I have not found in the community a post that explains how to solve it.

Thank you in advance.
Here is my code: