I have experience with AVRs, by programming them through the SPI port, but right now I'm looking at a Holtek HT46R22 and I can't find anything about how to program this Microprocessor. My question is not about the Holtek, but in general.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
I assume you're talking about how to physically write to the program memory, and not how to write programs using an assembler or compiler for a given micro.
Often this information is not in the datasheet or in the data that covers the instruction set, but in a separate document.
In some cases, unfortunately, that information may be tightly controlled and you may have to sign an NDA (Non-Disclosure Agreement) and/or prove that you are a real company and have a legitimate need for the information.
The assumption is that an ordinary moderate to high-volume user will merely buy a programmer (or get a supplier to pre-program the parts), and has no need to know the protocols involved. Many Asian suppliers really are not interested in providing support for a customer who only wants a few thousand pieces- their ratio of engineers to production workers won't allow for it.
If the manufacturer does not provide programming documentation, but you have a working programmer, then you may simply have to reverse-engineer the programming protocol.
The first steps I would take are: determine if a special programming voltage must be present on some pin (like PICs and AVRs in some programming modes); and determine which pins are involved in the programming process (anywhere from 1 to 8+ pins might be involved—concentrate on pins that are common to devices of all pin-counts).
Having done that, use a logic probe to capture some traces of the programming activity by the real programmer, and start making educated guesses about what's going on.
Remember that if you have a working toolchain for this thing, you can prepare special images like "all zeros", "all ones", "all zeroes except for one byte", and so on.
Unless the programming process is obfuscated at the hardware level, it is likely that the programming traces will be pretty easy to interpret.
Finally, since you did specifically mention the Holtek HT46R22, I notice from googling that this is either a mask-rom product or an otp product, so you won't be able to reprogram a device you already have.
Always start with the compiler's getting started manual. Most of the time you can get useful informations like hello world, things that are not in standard compilers like their implementations of #pragma directives, placing constants to rom/ram, linker modifications if needed, etc. Also try browsing through the installation directory - sometimes there are useful gems there like other pdf documents for reusing provided libraries and some other utility programs.
If there are no useful documents, go to forums or contact directly the manufacturer's support.