• AVR Freaks

MCC bootloader Write EEPROM issue

Author
ssh19
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2019/12/21 09:15:33
  • Location: 0
  • Status: offline
2020/05/27 06:32:00 (permalink)
0

MCC bootloader Write EEPROM issue

I noticed that writing EE Data is going to the wrong address.
// *****************************************************************************
// Write_EE_Data
//
// Cmd Length----- Address--------------- Data ---------
// In: [<0x05> <0x00><0x00><0x55><0xAA> <0x00><0x00><0x00><0x00> <Data>..<data>]
// OUT: [<0x05> <0x00><0x00><0x00><0x00> <0x00><0x00><0x00><0x00> <0x01>]
// *****************************************************************************
uint8_t Write_EE_Data()
{
    EEADR = frame.address_L;
 EECON1 = 0x04; // b'00000100'; // Setup for EEData
    for (uint8_t i = 0; i < frame.data_length; i++)
    {
        while (EECON1bits.WR == 1); // wait until previous write complete
      ++ EEADR; - Why address increment before writing??
        EEDATA = frame.data[i];
          
        StartWrite ();
    }
    frame.data[0] = COMMAND_SUCCESS;
    return 10;
}

is this bug or intentional?
#1

2 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18779
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: MCC bootloader Write EEPROM issue 2020/05/27 06:38:31 (permalink)
    0
    Is “wrong” Off by one?
    Did moving it may it work?
    Did you check if you have the latest MCC?
    #2
    ssh19
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/12/21 09:15:33
    • Location: 0
    • Status: offline
    Re: MCC bootloader Write EEPROM issue 2020/05/27 07:42:37 (permalink)
    0
    Thanks, version 2.3.1 fixed this issue, replacing increment with:
    NVMADR = frame.address_L + i; 
    I had version 2.2.37
     
    #3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5