This is probably not the right place to place this question, but maybe someone with knowledge of the old HC16 can share some light.
I got an old PCB with alot of relays and digital inputs i will like to reuse for a DIY project. I have managed to use an arduino to implement the BDM interface using the SPI port, I can also dump all the FLASH to a file and using a HEX viewer i can see the original program inside the MCU and even some text. My next step was to try to write to the MCU FLASH, i have 12V applied to the Vfpe1/2 pins to supply the EEPROM with the programming voltage. And i can send to the MCU the WPMEM command followed by the bank, address and 16 bit data to write. But when i read back the same address location the original value is returned. I'm sending the write command exactly was explained in the CPU16RM but so far i havent had any luck.
If i try to write something into the Data space i can read it back and the value is exactly the one i wrote previously.
Using RPMEM and WPMEM for Program space and RDMEM and WDMEM for Data space.
BDM interface CPU16RM - https://www.google.dk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwih2fWFg9DLA...