Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - thierrys

#1
LPC9xx/LPC9xxx / Re: help me for isp on lpc936
April 19, 2009, 11:39:11 PM
ALL MY PROGRAM

//-------------------------------------------
// Erase all
//-------------------------------------------
   for (c = 0 ; c < NBR_SECTOR ; c++)
    {
        memset(DataToSend,0,255);
        memset(data,0,255);
        UARTCount = 0;
        count_error = 0;
        sprintf(data,"0300000401%c%c%c%c",SectorTable_936[c][0],
                                          SectorTable_936[c][1],
                                          SectorTable_936[c][2],
                                          SectorTable_936[c][3]);
        checksum(data);
        sprintf(DataToSend,":%s%c%c%c%c",data,checksum_calc[0],checksum_calc[1],13,10);
        uart_isp_send_receive((unsigned char *) DataToSend);
        while (UARTBuffer[17] != '.')      // Ok
        {                                  // gestion erreur à faire
            UARTCount = 0;
            uart_isp_send_receive((unsigned char *) DataToSend);
           
            count_error++;
            if (count_error > ERROR_ISP)
                return ERROR_CRC_ERASE;
        }
    } 
     
    c = 0;                                             
    nbr_line_done = 0;
//-------------------------------------------
// PROGRAM
//-------------------------------------------   
    do
    {

        memset(DataToSend,0,255);
        memset(data,0,255);
        memset(UARTBuffer,0,255);
        UARTCount = 0;
        PtrData = data;     
        check_crc = 0;
        count_error = 0;
        do
        {
           *PtrData++ = DRIVER[c];
            c++;
            check_crc++;   
        }
        while ((DRIVER[c] != ':' && DRIVER[c] != 0x00) || check_crc > 64);           
        sprintf(DataToSend,"%s%c%c",data,13,10);
        if (check_crc > 64)
            return ERROR_HEX;
        do
        {
            memset(UARTBuffer,0,255);
            uart_isp_send_receive((unsigned char *) DataToSend);
            count_error++;
            if (count_error > ERROR_ISP)
                return ERROR_CRC_WRITE;           
        } while((UARTBuffer[check_crc-1] != '.') &&
                (UARTBuffer[check_crc] != '.')   &&
                (UARTBuffer[check_crc + 1] != '.'));
        nbr_line_done++;
    }
    while(nbr_line_done != DRIVER_LINE);


// misc write ---------------------------------------------------
    // status bit
   
    memset(DataToSend,0,255);
    memset(data,0,255);
    UARTCount = 0;
    count_error = 0;
    sprintf(data,"020000020300");
    checksum(data);
    sprintf(DataToSend,":%s%c%c%c%c",data,checksum_calc[0],checksum_calc[1],13,10);
    do
    {
      uart_isp_send_receive((unsigned char *) DataToSend);   
      count_error++;
      if (count_error > ERROR_ISP)
        return ERROR_CRC_STATUS; 
    } while(UARTBuffer[15] != '.');   


//RESET MCU ---------------------------------------------------
    memset(DataToSend,0,255);
    memset(data,0,255);
    sprintf(DataToSend,":00000008F8%c%c",13,10);
    uart_isp_send_receive((unsigned char *) DataToSend);


    //------------------------------
   
    delay (1000000);
    FIO0SET |= BIT18;
   
    delay (1000000);
    FIO0CLR |= BIT17;
   
    //------------------------------
     // VDD à l'état haut
        delay (10000000);         //some pcb asks more time before beginning upload
        FIO0SET |= BIT17;
       
        return SUCCESS_ISP;


hex file

:04FFF00023001E00CC
:08FFF8000003020000000007F5
:03000000020033C8
:0C00330078FFE4F6D8FD75810702000399
:040020007FA07E86B9
:0F002400EF1F70011E144E600563A00880F222CA
:10000300E4F5A475A5FFF5847585FFF5A0F5806378
:0D001300A0FF12002012002012002080F239
:00000001FE

I send on uart :04FFF00023001E00CC and after  :08FFF8000003020000000007F5 ,...
#2
LPC9xx/LPC9xxx / Re: help me for isp on lpc936
April 19, 2009, 10:57:02 PM
I try to program a LPC2148 with a LPC936.
I wrote a little program on the LPC2148.
I can program the LPC936 with a lpc2148.
the crc matches but when I manually add two lines int the hex file, the crc does more than block 1.
I wondered if after a number of data , I dont' must wait or send a command

thanks you
#3
LPC9xx/LPC9xxx / Re: help me for isp on lpc936
April 16, 2009, 11:27:00 PM
It don't match with the big program but the small it match.
the big program use 6 block and the the small 1 block
#4
LPC9xx/LPC9xxx / help me for isp on lpc936
April 16, 2009, 07:19:28 AM
hello

I can use by isp with small program of 256 bytes
but with a big program of 28813 bytes it don't work

my hex file is
:102657005387BF7598D353877F75BA01E4F5BD7566
......

and i send
0x2E 0x31 0x30 0x32

where is the problem and why with a small program, it's ok but not with a big?

thank
#5
LPC9xx/LPC9xxx / crc calculation on a hex file
April 16, 2009, 05:43:34 AM
hello,

I'd like know how flash magic calculs the crc for a lpc9xx on a hex file in cyclic redunbancy check
ex:
:03000000000000FC
:0C002C0078FFE4F6D8FD758107020003A0
:040019007FA07E86C0
:0F001D00EF1F70011E144E600563A00880F222D1
:10000300E4F5A475A5FFF5A063A0FF120019120083
:060013001912001980F231
:00000002FF

the crc for the block 0 : 6EBBF73F

thank you