EmbeddedRelated.com
Forums

Thanks much for ethernet download manager help

Started by Bene Tam March 23, 2004
Robert, thanks much for ur valuable experience of rabbit ethernet update source code.
 
My name is Bene and I am a rabbit programmer in HK.
 
I have just a few questions about the code.
 
I am using RCM2250 and 7.32P and my application currently :
 
- use SNMP functions
- one of the costates is for ONLY http_handler()
- one of the costates has ONLY the HandleDLPReset() and tcp_tick(NULL);
- user can change IP, gateway, netmask.... in the application
- use 2nd flash for code
- dataorg at 0x6000 due to root code size problem
 
I have :
- leave everything default in rabbitdownloader3.c and then Options -> Compiler -> Code and BIOS in RAM ->Compile to .bin file -> Compile with defined target config.
- added #use "rundlm.lib", call HandleDLPReset() regularly in my application A.c
- compile another program B.c (in flash, included #use "rundlm.lib")
- put the rabbitdownloader3.bin and b.bin in the same folder as the VB application
- run the VB application, it identifies the board, then try to download
 
my problem encountered is:
 
- during downloading of the .bin file(new program code) using VB application, it timeouts.
 
my question is :
- does it use ONLY UDP? or it uses both TCP and UDP?
- where should i place the download manager .bin file? seems it hasnt been loaded into my compiled application? i dont have to use the #ximport coz it's new version, rite?
- is it correct for me to use the download manager for 2200 on my RCM2250?
- should i run the HandleDLPReset() inside the same costate as the http_handler()?? or I should create another costate and calling HandleDLPReset() and tcp_tick(NULL) in this single costate? 
- what value should i use for #define of MAX_SOCKETS, MAX_UDP_SOCKET_BUFFERS, MAX_TCP_SOCKET_BUFFERS?? 3 for MAX_SOCKETS(1 for http server, 1 for UDP download manager, 1 for UDP SNMP)?
- what should be define for MyIpAddresses2.... in the rabbitdownloader3.c in such a case, coz it's "dynamic"?
 
 
 
Thanks for help



Excuse the formatting issues; my e-mail program didn't like this format too well.

----------
From: Bene Tam <b...@dctechnologies.com>
To: rabbit developer <r...@yahoogroups.com>
Subject: [rabbit-semi] Thanks much for ethernet download manager help
Date: Tuesday, March 23, 2004 1:10 AM

Robert, thanks much for ur valuable experience of rabbit ethernet update source code.

My name is Bene and I am a rabbit programmer in HK.

I have just a few questions about the code.

I am using RCM2250 and 7.32P and my application currently :

- use SNMP functions
- one of the costates is for ONLY http_handler()
- one of the costates has ONLY the HandleDLPReset() and tcp_tick(NULL);
- user can change IP, gateway, netmask.... in the application
- use 2nd flash for code

Be careful here--the binary image for the DLM must be compiled with the same settings for user block size as your main program is so that it will know where to not write data to.

- dataorg at 0x6000 due to root code size problem

I have :
- leave everything default in rabbitdownloader3.c and then Options -> Compiler -> Code and BIOS in RAM ->Compile to .bin file -> Compile with defined target config.
- added #use "rundlm.lib", call HandleDLPReset() regularly in my application A.c
- compile another program B.c (in flash, included #use "rundlm.lib")
- put the rabbitdownloader3.bin and b.bin in the same folder as the VB application
- run the VB application, it identifies the board, then try to download

my problem encountered is:

- during downloading of the .bin file(new program code) using VB application, it timeouts.

How far does it get?  There is a status window telling what is happening.  If it doesn't even get far enough to send the DLM, then the problem is likely because HandleDLPReset isn't getting called (which is likely because it is in the same costate as some other stuff).

If it sends the DLM, the checksum agrees, and then it acts up, this is likely because the binary image is bad.  If you modified the IP of rabbitdownloader3.c, then the Visual Basic program will not be able to search out the strings and modify the binary image to the proper IP.  If you have the wrong board type and it sends the wrong binary image, that may also be a problem.  I need a report of what the progress window tells you.

my question is :
- does it use ONLY UDP? or it uses both TCP and UDP?
It uses one UDP socket and one TCP socket.   The UDP socket was an add-on; if I were to start over, I would only do UDP, but for compatibility with what I did before, it has to tie up two sockets; one TCP, and one UDP.

- where should i place the download manager .bin file? seems it hasnt been loaded into my compiled application? i dont have to use the #ximport coz it's new version, rite?

Look in RUNDLM.LIB.  It asks for the filename based on the controller.  Visual Basic then loads the corresponding binary file.  If you have a RCM2250, compile the rabbitdownloader3.c to the binary image as you have done.  Then rename the binary file and go into the library and add an entry for if your board type is a RCM2250.
There is a bunch of code like this

#if _BOARD_TYPE_ == RTDK
  #define DLMBoardFound
  #define DLMFilename "DLM__RTDK__.bin"
#endif

Add:

#if _BOARD_TYPE_ == RCM2250
   #define DLMBoardFound
  #define DLMFilename "DLM__RCM2250__.bin
#endif

Also, make sure that after Rabbitdownloader3.c is compiled, copy the binary image to DLM__RCM2250__.bin
 - is it correct for me to use the download manager for 2200 on my RCM2250?

The binary images are quite forgiving when used on the wrong controller, but I wouldn't recommend it.- should i run the HandleDLPReset() inside the same costate as the http_handler()?? or I should create another costate and calling HandleDLPReset() and tcp_tick(NULL) in this single costate?


Don't put HandleDLPReset inside another costate, or it will never get called because the costate is spending its time running http_handler.  Don't call it from within any costate.  Don't call tcp_tick from within a costate.


- what value should i use for #define of MAX_SOCKETS, MAX_UDP_SOCKET_BUFFERS, MAX_TCP_SOCKET_BUFFERS?? 3 for MAX_SOCKETS(1 for http server, 1 for UDP download manager, 1 for UDP SNMP)?

Set MAX_UDP_SOCKETs and MAX_UDP_SOCKET_BUFFERS to one higher than they were before trying to add a download manager.  Don't forget to set a size of UDP_BUF_SIZE.  If you are going to try to preserve RAM contents, set UDP_BUF_SIZE to 512; otherwise, it can be something small like 32.


- what should be define for MyIpAddresses2.... in the rabbitdownloader3.c in such a case, coz it's "dynamic"?

Leave these values alone in rabbitdownloader3.c.  The reason for this is because the Visual Basic program searches out an exact string.  Notice that the IP address has extra zeroes in it.  This exact string is replaced with whatever IP address was used to activate the download.  So if your main program uses DHCP and gets an IP address, the binary rabbitdownloader3.bin file is modified by Visual Basic before being downloaded to have a static IP of the same value as the IP you were assigned.  If you have modified the source, repair the file with the original values.
Thanks for help