Author Topic: help me for isp on lpc936  (Read 8099 times)

thierrys

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
help me for isp on lpc936
« on: 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

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: help me for isp on lpc936
« Reply #1 on: April 16, 2009, 09:26:57 am »
If you go to ISP->CRC do the CRCs match for the device and your hex file? If so it programmed OK and the problem must be with your code somehow.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

thierrys

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: help me for isp on lpc936
« Reply #2 on: 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

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: help me for isp on lpc936
« Reply #3 on: April 17, 2009, 09:05:45 am »
If you try a different LPC936 do you get the same result?

If Flash Magic didn't report an error during programming then the device likely accepted all the commands sent to it.

Do you have the checksums option turned on in the main window? If so turn that off.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

thierrys

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: help me for isp on lpc936
« Reply #4 on: 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

thierrys

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: help me for isp on lpc936
« Reply #5 on: 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 ,...

Werner

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: help me for isp on lpc936
« Reply #6 on: April 28, 2009, 08:32:50 am »
I do not understand much of your program, but it looks like you want to send ISP commands with another microcontroller.

You must not send
  :04FFF00023001E00CC
  :08FFF8000003020000000007F5
because these records are outside the 16k code region of the LPC936.

FlashMagic translates this part of the hex file (0xFFF0...0xFFFF) into misc-write-commands for UCFG1, Security Bytes, etc.

Werner