| ??? 09/11/03 09:03 Read: times |
#54530 - RE: AT89C51CC01 update Responding to: ???'s previous message |
I wrote a simple update/loader program that works through CAN. It is linked somewhere in the upper part of the flash and calls functions of the boot flash that is on chip. I have the UA type, but CA types would work the same. You don't need external RAM.
I use the Flip Program to first program this loader SW. Then I program the normal program (without erase of course). Out of the normal program, with CAN initialized but without any interrupts, I jump to the loader. After the flashing of the updated SW is done, I jump again to the normal program. Here is a sample (sorry, about the looks, I don't know how to make it look nicer) that shows how to invoke the api calls. You have to read the manuals for these. Use the flash_api.c and flash_lib.a51 of ATMEL if(CanProgramMode()) { answer=255; switch(abCANbuf[0]) { case 0: answer=__api_rd_bootloader_version();add_flash=0; break; case 6: ((int (code *)(void)) 0x0000) (); break; // point of no return case 10: AdrL=0; xtab[AdrL++]=abCANbuf[1]; xtab[AdrL++]=abCANbuf[2]; answer=10; break; // load next 2x8 !! bytes (not 64 as mentioned in manual) case 11:xtab[AdrL++]=abCANbuf[1]; xtab[AdrL++]=abCANbuf[2]; xtab[AdrL++]=abCANbuf[3]; xtab[AdrL++]=abCANbuf[4]; xtab[AdrL++]=abCANbuf[5]; xtab[AdrL++]=abCANbuf[6]; xtab[AdrL++]=abCANbuf[7]; answer=AdrL; AdrL &=0xf; break; // program next 16 bytes case 12: __api_wr_code_page(add_flash,(Uint16)xtab,16); add_flash+=16; answer=12; break; } SendOK(answer); } Werner |
| Topic | Author | Date |
| AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update | 01/01/70 00:00 | |
| RE: AT89C51CC01 update TO ALL | 01/01/70 00:00 | |
RE: AT89C51CC01 update TO ALL | 01/01/70 00:00 |



