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.

  • Answer Suggested

BSL launchpad for msp430f2232

HI

i used launchpad to build a BSL programmer for msp430f2232.

I downloaded firmware from ti slau319 , and used BSLDEMO2.exe to

program my board with msp430f2232.

The problem :

after launchpad-bsl download flash i noted that info memory was altered ,

all calibration value stored in info memory was erased.

So , to recover i have to rewrite this value ( similar from another micro) in info memory.

Is this a bug for firmware wich came with slau319 application ?

There is a solution to program bsl ( with launchpad ) without erase calibration value ?

Thanks a lot

Tommaso

  • HI

    after some experiments i belive this is the correct way to use bsl-launchpad + BSLDEMO2.exe

    A ) Produce your txt file with CC (or IAR) , call it Prog1.txt
    B) build the password file from this file in this way :
    read the Prog1.txt file with a txt editor and read byte value from
    position 0xFFE0 ; example :
    addr value
    0xFFE0 byte0
    0xFFE1 byte1
    ....... .....
    ....... .....
    0xFFFE byte30
    0xFFFF byte31

    if there is no value use FF for the byte value.
    So now you can write the passw1.txt file associate with Prog1.txt :
    byte0 byte1 ..........byte7
    byte8 byte9 ..........byte15
    byte16 ..................byte23
    byte24 ..................byte31

    The comand is : BSLDEMO2.exe -cCOMn -m1 -ppassw.txt +eapvrw Progr.txt

    If your msp430Fx is new the password.txt file is 32 FF byte.
    So the first time you program the command is

    BSLDEMO2.exe -cCOMn -m1 -pStdpassw.txt +eapvrw Progr1.txt

    where Stdpassw.txt is standard password , 32 byte with FF value.

    From now to on if we want to do other operations we have to use passw1.txt.
    Example we want to read the flash :

    BSLDEMO2.exe -cCOMn -ppasww1.txt -re000 1FF0 flash.txt

    If want to update the flash with a new Prog2.txt we have to use

    BSLDEMO2.exe -cCOMn -m1 -ppassw1.txt +eapvrw Progr2.txt
    [NOTE : use the precedent passw1.txt]

    and from now to on the new password file is passw2.txt which we will build from
    Prog2.txt like we see above.

    THATS ALL FOLKS.

    Tommaso
  • In reply to tommaso angelino103267:

    HI

    i developed a simple program to extract password bytes from file.txt

    to use it like password in BSLDEMO2.exe to program msp430fxxxx

    with bsl.

    I tested with some file.txt and it seem to go.

    If somone find bug please update it  and give back to forum the new version.

    The usage is simple  , on command line : bsl-password.exe yourfile.txt

    and it will produce a file named Pswyourfile.txt with password associate at yourfile,txt

    THE CODE : ( compile it with gcc)

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int iH,iL,jmp;
    int nbytes=0;
    char str[20];
    char strAddr[20];
    char nomefile[20];
    char NomeFilePssw[30];
    FILE *fp;
    char line[80];
    int trovata,n,len,i,pos;
    char sbyteH[48];
    char sbyteL[48];
    char straddr[32][6]={"@ffe0","@ffe1","@ffe2","@ffe3","@ffe4","@ffe5","@ffe6","@ffe7"
    ,"@ffe8","@ffe9","@ffea","@ffeb","@ffec","@ffed","@ffee","@ffef"
    ,"@fff0","@fff1","@fff2","@fff3","@fff4","@fff5","@fff6","@fff7"
    ,"@fff8","@fff9","@fffa","@fffb","@fffc","@fffd","@fffe","@ffff"};
    int CheckLine(void);

    // inserisci il nome del file.txt dopo il nome del programma

    int main(int argc, char *argv[])
    {
    int j,res;
    //for(i=0;i<32;i++)
    // printf("\n %s ",straddr[i]);

    strcpy(nomefile,argv[1]);
    //printf("= %s",nomefile);

    // Apro file
    fp=fopen(nomefile,"r");

    if(fp!=NULL)
    {
    // leggo prima linea
    trovata=0;
    while(fgets(line,80,fp)!=NULL && trovata==0)
    {
    //printf("%s",line);

    // cerco la stringa @ffe
    strncpy(str,line,4); // copio i primi 4 caratteri della linea
    str[4]='\0';
    //printf("\n%s\n",str); // per debug , OK

    // se ho trovato la stringa @ffe allora comincio ........
    if(!strcmp(str,"@ffe"))
    {
    trovata=1;
    //printf("\n TROVATA \n"); // debug
    }
    if(trovata)
    break;
    }

    // Algoritmo : ..............
    // @ffe0 ?

    j=0;
    strcpy(strAddr,straddr[j]);
    iH=iL=0;
    res=CheckLine();
    j=j+1+jmp;
    while(j<32)
    {
    //iH++;
    //iL++;
    if(res==1)
    {
    fgets(line,80,fp);
    strcpy(strAddr,straddr[j]);
    res=CheckLine();
    }
    else
    {
    strcpy(strAddr,straddr[j]);
    res=CheckLine();
    }
    j=j+1+jmp;
    }

    printf("\n\n\n Numbytes = %d iH %d iL %d",nbytes,iH,iL);
    for(j=0;j<32;j++)
    {
    printf("\n byte %d %c%c",j,sbyteH[j],sbyteL[j]);
    }

    fclose(fp);
    }
    else
    {
    printf("\n Errore in aperutra file \n ");
    }


    // ora scrivo il file password
    strcpy(NomeFilePssw,"Pssw");
    strcat(NomeFilePssw,nomefile);
    //printf("\n NomeFilePssw %s ",NomeFilePssw);
    fp=fopen(NomeFilePssw,"w");
    if(fp!=NULL)
    {
    for(j=1;j<33;j++)
    {
    fprintf(fp,"%c%c ",sbyteH[j-1],sbyteL[j-1]);
    if(j%8==0)
    fprintf(fp,"\n");
    }
    }
    else
    {
    printf("\n errore apertura file passw");
    }
    fclose(fp);

    getchar();
    return 0;
    }


    int CheckLine(void)
    {
    strncpy(str,line,5); // copio i primi 4 caratteri della linea
    str[5]='\0'; //printf("\n indirizzo = %s %s",str , strAddr); // DEBUG
    //i=0;
    pos=0;
    jmp=0;
    if(!strcmp(str,strAddr))
    {
    fgets(line,80,fp); // passo alla linea successiva
    len=strlen(line);
    pos=0;
    while(pos<(len-1))
    {
    sbyteH[iH++]=line[pos]; //printf("\n d01 %d %c",iH-1,sbyteH[iH-1]);
    sbyteL[iL++]=line[pos+1]; //printf("\n d02 %d %c",iL-1,sbyteL[iL-1]);
    pos=pos+3;
    jmp++;
    nbytes++;
    }
    jmp--;

    return 1;
    }
    else
    {
    sbyteH[iH++]='F'; //printf("\n d01 %d %c",iH-1,sbyteH[iH-1]);
    sbyteL[iL++]='F'; //printf("\n d02 %d %c",iL-1,sbyteL[iL-1]);
    nbytes++;
    return 0;
    }

    }

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.