Post Go back to editing

EE345v01 - rs232 flash upgrade - GUI works on Windows 7 64 bit?

I don't have the 21469 ez-kit lite but have a design using the same flash and serial port design as that board. I can build the code in the 21469_SSL_Parallel_FLASH.dpj project, and get these warnings:

----------------Configuration: 21469_SSL_Parallel_FLASH - Debug----------------
.\21469_SSL_Parallel_FLASH.c
.\214xx_hdr.asm
[Warning ea1121] ".\214xx_hdr.asm":68 ___lib_RSTI:
-g assembly with global function without ending label.
Use '___lib_RSTI.end' or '___lib_RSTI.END' to mark
the ending boundary of the function for debugging information for
automated statistical profiling of assembly functions.

Assembler totals: 0 error(s) and 1 warning(s)
.\boot_kernel.asm
[Warning ea1121] ".\boot_kernel.asm":28 _load_application:
-g assembly with global function without ending label.
Use '_load_application.end' or '_load_application.END' to mark
the ending boundary of the function for debugging information for
automated statistical profiling of assembly functions.

Assembler totals: 0 error(s) and 1 warning(s)
.\main.C
[Warning ea1092] "C:\DOCUME~1\KEITH~1.ALL\LOCALS~1\Temp\acc1700b7b5000\acc1700b7b5001.s":164 Symbol '_load_application' is undefined.
Check spelling. If '_load_application' is defined in a different file, use ".extern".

Assembler totals: 0 error(s) and 1 warning(s)
.\Parallel_FLASH.C
.\UART.C
Linking...
Creating loader file...
Build completed successfully.

I think that is ok. I removed the wait-for-button part of the code as my board does not have a button and I want to always enter the flash uploader for testing. When I run the code and start the GUI, then issue an Upgrade command, the GUI freezes and the title bar adds "not responding". This is on a PC running Windows 7 64 bit. The GUI never unfreezes and it has to be killed from Task Manager. The 3 .dll files in the GUI directory have been copied to c:\windows\system32. The dsp ICE shows the code is waiting for UART rx and not getting any.

Does the GUI run correctly on Windows 7 64 bit?

  • Hi,

    I agree that the current code shows some warnings at the build time because of bad programming practices.Sincere apologies. I shall try to correct this in the next update of the application note. For time being, please ignore them.

    Regarding debugging the DSP's communication with the GUI running on the PC  is concerned, I have following suggestions:

    1) With the existing connections and using any other simple RS-232 communication software, I would suggest you to transmit a single byte from the PC and probe the corresponding DPI pin on the DSP end. Please check if the data is seen on the scope as expected.

    2) Once the step 1 works, then I would suggest you to try to debug the initial communication between the DSP and the PC as mentioned in the code below step by step:

    //Signal the host that the slave is ready to communicate                
        Write_UART(START_LOADING);
       
        /*----Receive 'length' of the .ldr file ---*/

           
        //Read the first least significant byte of 'length'
        length_ldr=Read_UART();
        //Send acknowledgement to the host
        Write_UART(LENGTH_ACK);
       
        //Read the second least signnificant byte of 'length'
        temp=Read_UART();
        temp=temp<<8;
        length_ldr|=temp;
        //Send acknowledgement to the host
        Write_UART(LENGTH_ACK);
       
        //Read the third least signnificant byte of 'length'
        temp=Read_UART();
        temp=temp<<16;
        length_ldr|=temp;
        //Send acknowledgement to the host
        Write_UART(LENGTH_ACK);
       
        //Read the  most signnificant byte of 'length'
        temp=Read_UART();
        temp=temp<<24;
        length_ldr|=temp;
        //Send acknowledgement to the host
        Write_UART(LENGTH_ACK);
       
       
        /*----Receive 'FLASH Offset' ---*/
       
        //Read the first least  signnificant byte of 'offset'
        offset=Read_UART();
        //Send acknowledgement to the host
        Write_UART(OFFSET_ACK);

        //Read the second least  signnificant byte of 'offset'
        temp=Read_UART();
        temp=temp<<8;
        offset|=temp;
        //Send acknowledgement to the host
        Write_UART(OFFSET_ACK);
       
      
        //Read the third least  signnificant byte of 'offset'
        temp=Read_UART();
        temp=temp<<16;
        offset|=temp;
        //Send acknowledgement to the host
        Write_UART(OFFSET_ACK);
       
        //Read the most signnificant byte of 'offset'
        temp=Read_UART();
        temp=temp<<24;
        offset|=temp;
        Write_UART(OFFSET_ACK);

    E.g. with the help of a breakpoint, you can first run only the code on the DSP which sends the byte START_LOADING(0x01). Check if this byte is correctly received by the PC. If yes, you can run the DSP code further by putting a breakpoint at "Write_UART(LENGTH_ACK);". Then from the PC end, send a byte LENGTH_ACK(0x03) to the DSP. Check if the DSP receives this byte correctly and so on....As you see, these debugging steps are independent of the GUI. Once these steps work okay, then it means that the problem is with the GUI only and not with the DSP-PC interface.

    3) If it indeed turns out to a problem with the GUI, I can provide the VC++ source code of the GUI.

    Hope this helps.

    Thanks,

    Mitesh

  • I did previously try changing the SRU to loop DPI pin 10 to pin 9 and I get characters echo'd back to the PC using hyperterminal, so the serial port is definitely good in both directions. Thanks for the breakpoint suggestions and I will check that. It concerns me that the GUI immediately goes to "not responding" title bar as soon as Upgrade is clicked. That seems to suggest that it is broken in some way.

  • Looks like it is the GUI that is broken. I started the dsp and got a smiley face in the terminal window (START_LOADING = 1 and that is not a letter or number, it a non printable character). Then I write in a number 9 in hyperterm and in the dsp I saw 39 (ascii for 9) go into length_ldr, and I can continue stepping the dsp and see the correct data in the dsp variables.

    The dsp code is progressing as expected when the stimulus comes from hyperterm, but the GUI just freezes up immediately. (Windows 7 64 bit).

    EDIT - just a thought, but maybe the uploader can be implemented as a Procomm Plus 4.8 script?

  • Hi,

    I'll try to get hold of a machine with Windows 7 64 bit and test the GUI with the EZ-Kit. Meanwhile, attached is the source code of the GUI for debugging incase you already have VC++ installed on your machine.

    Reagrding: "just a thought, but maybe the uploader can be implemented as a Procomm Plus 4.8 script?":

    Yes, you could definitely use any other software or script with which you can operate the COM port in the way as expected by the DSP source code. The GUI provided with the application note is just for example and is not intended to be used by the customers as is in their application.

    Hope this helps.

    Thanks,

    Mitesh

  • Thanks for the GUI code but I am not too familiar with VC++ and don't have any way to compile it. I will be interested in your results on Windows 7 64 bit, or anyone else can report their results.

  • Using the rs232 library found here: http://www.teuniz.net/RS-232/ I wrote a text mode uploader to bypass the possibly broken GUI version. The c code for the uploader is in the attachment and repeated below. There are lots of printf's to confirm the uploader execution is progressing. Build and execute the code in a cygwin bash shell, it appears to work.

    //
    // ADSP-21469 RS232 Uploader
    //
    // 9/16/2011
    //

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

    #define DEF_PORT      0
    #define DEF_OFFSET    0x10000000
    #define BAUDRATE      115200

    #define START_LOADING 1
    #define BYTE_RECEIVED 2
    #define LENGTH_ACK    3
    #define OFFSET_ACK    4

    unsigned int          loop;
    unsigned int          length;
    unsigned int          offset;
    unsigned char         cbuff;
    unsigned int          ibuff;
    unsigned char       * pData;
    FILE                * ldr;
    int                   comport;

    int main(int argc, char *argv[])
    {
      printf("\nProgram to upload the contents of upload.ldr to the adsp-21469 flash.\n");
      printf("Usage: upload.exe [offset, default 0x10000000] [comport, default 1]\n");
      printf("Example:                   C:\\>  upload.exe 0x20000000 1\n\n");
      if(argc>1)
      {
        offset = atoi(argv[1]);
        for(loop=0; loop<strlen(argv[1]); loop++)
        {
          if(*(argv[1]+loop)=='x')
          {
            sscanf(argv[1]+loop+1,"%x",&offset);
            break;
          }
        }
      }
      else
      {
        offset = DEF_OFFSET;
      }
      printf("File offset = 0x%08x (decimal %d)\n",offset,offset);

      if(argc>2)
      {
        if(*argv[2]=='2') comport = 1;
        else comport = DEF_PORT;
      }
      printf("Using COM port %d.\n",comport+1);

      printf("Initialize the COM port.\n");
      if(OpenComport(comport, BAUDRATE))
      {
        printf("Program terminated.\n");
        exit(1);
      }

      printf("Open the ldr file.\n");
      if((ldr=fopen("upload.ldr","r"))==NULL)
      {
        printf("Unable to open file.\nProgram terminated.\n");
        exit(1);
      }

      printf("Determine the length in bytes of the ldr file.\n");
      /* (count the number of x's in the file) */
      length = 0;
      do
      {
        ibuff = fgetc(ldr);
        if(ibuff=='x') length++;
      } while(ibuff != EOF);
      rewind(ldr);
      if(length==0)
      {
        printf("Length is 0, nothing to upload.\nProgram terminated.\n");
        exit(1);
      }
      else
      {
        printf("Length in bytes = %d.\n",length);
      }

      printf("Allocate memory to load the ldr file data.\n");
      if((pData=(unsigned char *)malloc((length+1)*sizeof(*pData)))==0)
      {
        printf("Unable to allocate memory.\nProgram terminated.\n");
        exit(1);
      }

      printf("Copy the ldr file data to memory.\n");
      printf("Bytes read = ");
      for(loop=0; loop<length; loop++)
      {
        while(fgetc(ldr)!='x') {};
        fscanf(ldr,"%x",&pData[loop]);
        ibuff = printf("%d",loop+1);
        printf("\033[%dD",ibuff);
      }
      printf("\nClose the file.\n");
      fclose(ldr);

    printf("Wait for the dsp to initiate upload.\n");
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != START_LOADING);
      printf("Received upload command from the dsp.\n");

    printf("Send 'length' of the .ldr file to the dsp.\n");
      SendByte(comport, length&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != LENGTH_ACK);
      printf("1st byte acknowledged.\n");
      SendByte(comport, (length>>8)&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != LENGTH_ACK);
      printf("2nd byte acknowledged.\n");
      SendByte(comport, (length>>16)&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != LENGTH_ACK);
      printf("3rd byte acknowledged.\n");
      SendByte(comport, (length>>24)&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != LENGTH_ACK);
      printf("4th byte acknowledged.\n");

    printf("Send 'FLASH Offset' to the dsp.\n");
      SendByte(comport, offset&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != OFFSET_ACK);
      printf("1st byte acknowledged.\n");
      SendByte(comport, (offset>>8)&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != OFFSET_ACK);
      printf("2nd byte acknowledged.\n");
      SendByte(comport, (offset>>16)&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != OFFSET_ACK);
      printf("3rd byte acknowledged.\n");
      SendByte(comport, (offset>>24)&0xff);
      do
      {
        while(PollComport(comport, &cbuff, 1)<1) {};
      } while(cbuff != OFFSET_ACK);
      printf("4th byte acknowledged.\n");

      printf("Upload the ldr file data to the dsp.\n");
      printf("Bytes sent = ");
      for(loop=0; loop<length; loop++)
      {
        SendByte(comport, pData[loop]);
        do
        {
          while(PollComport(comport, &cbuff, 1)<1) {};
        } while(cbuff != BYTE_RECEIVED);
        ibuff = printf("%d.",loop+1);
        printf("\033[%dD",ibuff);
      }
      printf("\nData transfer completed.\n");

      printf("Deallocate the ldr file data memory.\n");
      free(pData);

      printf("Close the COM port.\n");
      CloseComport(comport);

      printf("Upload completed.\n");
      return(0);
    }

  • Hi,

    I tested the firmware upgrade application using a Windows 7 64 bit system on the ADSP-21469 EZ-Kit and it worked as expected. Please see the screenshot below:

    So, I guess the issue may be something very specific to your system and not because of using the Windows 7 64 bit operating system.

    BTW, could you please check if the FLASH programming portion of the code works fine at least? The GUI can hang even if the FLASH programming is not working as expected. For this, you can comment out the part of the code that receives the ldr file from UART. You can directly initialize a buffer in the memory with the ldr contents and then instead of receiveing the data from the UART, you can read it from this buffer.

    Thanks,

    Mitesh

  • This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin