Convet SPT file to Hex file

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable
        I have SPT file for some specific device, it uses cypress's usb controller. I have SPT file on Windows however, We need to download firmware on Android platform so we need .hex files, can we convert spt files into hex files or can we use directly the spt file?   
0 Likes
1 Solution
Anonymous
Not applicable

You can download the python script below and gicve your spt file as input.

   

https://ftp.dlitz.net/pub/dlitz/cyusb-fw-extract/0.1/cyusb-fw-extract.py

          Though, I don't know why, the script puts one byte too many on each line.     
So just delete that extra byte on every line, and you're good to go.    

If you get 2 files as output, you have to merge them after having corrected them          (remove last byte on each line)    

   

 

   

EDIT:

   

 

   

I have figured out why the .py script that I posted above puts one byte too many on each line. It's the Checksum !

   

See: https://en.wikipedia.org/wiki/Intel_HEX

   

So, you just have to merge the two files together, but don't delete the checksum !. The reason why there are two files is because in the spt files, between the loading of the first file and second file, it puts the chip out of reset, and back to reset to load the second part. I have no idea why it does that, but I've managed to make it wok by just putting the two files one after the other in a new file (of course, you have to remove the end-of-file line on the first file).

View solution in original post

0 Likes
8 Replies
Anonymous
Not applicable

 The SPT file is just a recording of all that you do in Control Center. So, if it downloads firmware, it will have a bunch of vendor commands that load specific data to the device.

   

 

   

The file format is not documented though. You can therefore take a look at our Control Center's source code (follow the code bound with the bRecording flag) to understand how data is stored in the file. From this, the data needs to be extracted and then converted to a hex file.

It is likely much easier if you can get the source code and compile it to a hex file.

0 Likes
Anonymous
Not applicable

  Can we use Usblyzer program in order to see those vendor commands and specific datas while installing driver on windows?

0 Likes
Anonymous
Not applicable

 Yes, you can. You still have to decode the commands though.

0 Likes
Anonymous
Not applicable

Aren't they the exact hex codes? Why is it still required to decode them?

0 Likes
Anonymous
Not applicable

 They are. What I meant by decoding was to extract the destination address from the transfers and construct a hex file based on that.

0 Likes
Anonymous
Not applicable

There are many coloumns in that program, raw data is what we are looking for, am I right ? Do you know usbylzer program?

0 Likes
Anonymous
Not applicable

You can download the python script below and gicve your spt file as input.

   

https://ftp.dlitz.net/pub/dlitz/cyusb-fw-extract/0.1/cyusb-fw-extract.py

          Though, I don't know why, the script puts one byte too many on each line.     
So just delete that extra byte on every line, and you're good to go.    

If you get 2 files as output, you have to merge them after having corrected them          (remove last byte on each line)    

   

 

   

EDIT:

   

 

   

I have figured out why the .py script that I posted above puts one byte too many on each line. It's the Checksum !

   

See: https://en.wikipedia.org/wiki/Intel_HEX

   

So, you just have to merge the two files together, but don't delete the checksum !. The reason why there are two files is because in the spt files, between the loading of the first file and second file, it puts the chip out of reset, and back to reset to load the second part. I have no idea why it does that, but I've managed to make it wok by just putting the two files one after the other in a new file (of course, you have to remove the end-of-file line on the first file).

0 Likes
Anonymous
Not applicable

 We have two .ihx files. When we merge them without deleting last byte and put it onto edsim 8051 simulator program, it verifies every line. Name the lines as jump, move, etc. However, when we delete last byte of everyline, it doesnt recognize lines as jump, move etc. 

0 Likes