Ford PHF to/from BIN Converter

Post Reply
DGAlexandru
Pro
Posts: 310
Joined: 04 Aug 2019, 22:47

Ford PHF to/from BIN Converter

Post by DGAlexandru »

Hi all,

using ELMConfig you can transform PHF PCM files to BIN, but as you don't have a tool to go back to PHF from BIN, I decided to build one :roll:
Until now (Focus2/C-Max 1.6/2.0 Petrol or 1.6/1.8/2.0 Diesel) I saw that the Block Size is 0x010000 bytes (ELMConfig combines them in a bigger block if they occupy a continuous address range) and the checksum is calculated every 0x10 bytes (Read Size). These values can be changed and are going to be taken into consideration after opening the BIN file.

Upon opening of a BIN file you'll get a table with the entire address range divided in blocks of the defined size. You then have the possibility to choose what blocks are going to be written in the generated PHF file and also their size. All of the other table cells are not taken into consideration (at least not yet).
After you select the needed blocks all you have to do is to Generate Buffer and then Save File.
BIN2PHF.jpg
Sharing it with you, maybe you also find it useful. (7z archive, no pass :))
BIN2PHF_1.0.0.7z

When I'll have time I'll also implement functions for a PHF to BIN converter to it, to have everything in one program and also to be able to generate the template from original PHF file (no need for ELMConfig and/or HEX editing tools).

Why do we need this tool?
When converting PHF to BIN with ELMConfig, for address spaces (blocks) that aren't present in PHF file you'll have FF bytes.
If you write this BIN to a PCM you'll have some data overwritten with FF so PCM will refuse to boot or won't work as expected (it looses some of it's calibrations that are done automatically right after normal PHF flashing).

If you read the PCM FirmWare with ELMConfig to a BIN file you'll see that the above mentioned "FF filled blocks" contain data. If you write this BIN to other PCM for the same engine type (cloning) you'll probably find out that the engine won't start or it will perform bad.. usually with lots of DTCs.

In order to successfully clone a modified PCM FirmWare you need to read it to BIN then replace some blocks of memory with blocks from destination PCM FirmWare ... or the better way: write only the blocks that an original PHF flash procedure writes - and here it comes in handy to have a BIN to PHF converter :)


The tool is in its early stages of development so in order to use it you must know some things from the original PHF - these can be found out using ELMConfig with "Show all PHF/HEX data": blocks that are present in PHF file and their size (usually only the last one is smaller).
ELMConfig PHF usefull information.jpg
Also, in order to have a fully working PHF file you need to HEX-copy the header of the original PHF file to the generated PHF file. Usually this header ends with human-readable text that states the number of sectors to be erased (or erasing type; need to find out). The next 4 bytes are: 00 24 00 3A.
You need to HEX-copy everything from beginning until this 4 bytes.
HEX edit to add the header.jpg
You do not have the required permissions to view the files attached to this post.
Post Reply