Swapping of bytes
HussainMughal1 opened this issue · 2 comments
Hello,
Your library has been very helpful for reading .hex files.
Context: I'm using the IntelHex library to read from a .hex file, which I then use to flash a microcontroller.
As you can appreciate, there are thousands of bytes contained in the .hex, and so I'm attempting to read and send the maximum number of bytes in one message at a time, which is 4095.
My code looks something like this:
startAddress = 0x00840000
maxFrameSize = 4095
data = []
""" Send 100 blocks of data from hex file """
for blocks in range(100):
""" Increment sequence number for every data block sent """
for sequenceNumber in range(0x01, 0xFF):
""" Read data from .hex and append to array """
for i in range(maxFrameSize):
data.append(int(IH[startAddress + I]))
""" Send """
client.transfer_data(sequence_number= sequenceNumber, data= bytes(data))
""" Clear array """
data.clear()
""" Update Start address for next block """
startAddress += maxFrameSize
The issue I've encountered is that some bytes are swapped according to my trace, preventing me from finishing the data transfer.
The image is a diff containing my trace on the left, and a trace generated from another vendor-supplied microcontroller flashing tool, with the differences highlighted.
I hope I've provided enough information.
Any help would be appreciated!
The maximum frame size of 4095 is given by CAN.
The issue originated from another library. Closed.