Skip to content

Some bugs for uploading code to MSP430G2553 #1

@weihsiangteng

Description

@weihsiangteng

I found some bugs in protocol 1xx, 2xx and 4xx families using your console program. This will fail password checking also uploading code to msp430g2553. After I modified some codes then it worked.
Following are my modifications:

Main_priv.cs:
1.

case Command.Password:  // address: -   data: D1 ... D20
    {
        BSL_frame.Add(Const.BSL_CMD124__RX_PASSWORD);  // typo?
        BSL_frame.AddRange(Enumerable.Repeat(Const.BSL_DATA124__PW_L1_L2, 2).ToArray());
        BSL_frame.AddRange(Enumerable.Repeat(Const.BSL_DATA124__DUMMY, 4).ToArray());

        if ((data == null || data.Length != Const.BSL_SIZE124__PASSWORD))
        {
            message.status = Utils.StatusCreate(801);
            return message;
        }
        BSL_frame.AddRange(data);
    }
    break;
  1. RX data block BSL command should take n-4 bytes:
case Command.Upload:  // address: AL, AH   data: D1 ... Dn-4
    {
        BSL_frame.Add(Const.BSL_CMD124__RX_DATA_BLOCK);
        BSL_frame.AddRange(Enumerable.Repeat((byte)(data.Length + 4), 2).ToArray());

        if ((address == null) || (data == null || data.Length < 1))
        {
            message.status = Utils.StatusCreate(801);
            return message;
        }
        BSL_frame.AddRange(_address.ToArray());
        BSL_frame.Add((byte)(data.Length));
        BSL_frame.Add(0);
        BSL_frame.AddRange(data);
    }
    break;
case Command.Upload:
    {
        Debug.Assert(typeof(T) == typeof(Data_Void));
        //throw new BSL430Exception(460, "Result<Data_Void> res = msg(Command.*)");
        result.data = (T)(object)new Data_Void();
        ok = (answer.data.Length == 1 && answer.data[0] == Const.BSL_GENERAL124__ACK);   // another typo?
    }
    break;
  1. In ParseFirmware function, the variable fill_FF should be true for TI text format?

Constants.cs

// BSL RX SIZE - PROTOCOL 1xx 2xx 4xx
public const byte BSL_SIZE124__PASSWORD = 32;

Thank you for providing this awesome software so that I can flash my msp430g2553!

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