Skip to content

Change of EEPROM address for update check #19

@aviatorhh

Description

@aviatorhh

I have changed the CS pin in asmfunc.S to get it running on the Ethernet Shield 2 where the CS pin for the SD access is 4 (PG5). I am happy about your work and the update process is functioning.
The EEPROM address seems to be hardcoded in stk500boot.c:1147.

    if(boot_state == 2){
        if(eeprom_read_byte(0x1FF) == 0xF0){
           pf_mount(&Fatfs);	/* Initialize file system */
           if(pf_open("firmware.bin") == FR_OK){
               DWORD fa;	/* Flash address */
               WORD br;	/* Bytes read */
               uint8_t i = 0;
               sendchar(0x0d);
               sendchar(0x0a);
               for (fa = 0; fa < 0x3E000; fa += SPM_PAGESIZE) {	/* Update all application pages */
                   PROGLED_PORT	^=	(1<<PROGLED_PIN);	// turn LED ON
                   delay_ms(50);
                   flash_erase(fa);					/* Erase a page */
                   memset(Buff, 0xFF, SPM_PAGESIZE);	/* Clear buffer */
                   pf_read(Buff, SPM_PAGESIZE, &br);	/* Load a page data */
                   if(br) flash_write(fa, Buff);		/* Write it if the data is available */
                }
               sendchar(0x0d);
               sendchar(0x0a);
               check = 0;
               eeprom_write_byte (0x1FF, 0xFF);

Suggest to use a #define for better control. Or is the EEPROM erased anyway?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions