OTP Programming - Page 1
Forum section: electronics / beginners

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: June 11, 2018, 12:21:47 pm
content: Hey everyone!So I recently ordered a few hundred micro controllers witch only cost me ~5$. I ordered them because they were dirt cheap and I wanted to learn something new!I’m quite familiar with flash based micros and I’ve worked a lot with AVR's and a bit with PIC's and am used to program in C.The micro controller that I got is OTP based and not Flash based so it’s a one-time only programming with an instruction based language with is nice so I can get out of my C comfort zoneThe problem is that I have no idea what compiler to use for this MCU or if there is a specific IDE that you have to use so I don’t waste a ton of micro's trying to get a program right.Any help to get started is much appreciated!Datasheet:https://datasheet.lcsc.com/szlcsc/Bojuxing-Industry-BJ8P509FNB_C83513.pdf

author: hexreader
author_rank: Frequent Contributor
timestamp: June 11, 2018, 12:33:47 pm
content: Looks like a PIC12C509 to me.or maybe just similar.I will leave you to do a careful compare of the two datasheets.If I am right, then Microchip tool-chain is the obvious choice.

author: tsman
author_rank: Frequent Contributor
timestamp: June 11, 2018, 12:50:18 pm
content: Looks very much like a PIC but not compatible. It has 13 bit instructions according to the datasheet but PICs don't have any that are 13 bit. Probably some variant ofthis clone. Same datasheet comes up with a search & replace if you look for FM8PS54.

author: Ian.M
author_rank: Super Contributor
timestamp: June 11, 2018, 01:05:43 pm
content: That's going to keep you busy. If you are feeling brave and are a competent C programmer, you could add a BJ8P509 target to theGPUTILSPIC assembler toolsuite.If you have less free time or aren't so strong a C programmer, the DOSTASM 3.1table driven assembler may be a better choice. You'll still have to create the instruction set definition table for the BJ8P509 and an include file for its register addresses and bits, but at least the road-map for adding a new processor is fairly well defined, and no C skills are needed.

author: james_s
author_rank: Super Contributor
timestamp: June 11, 2018, 05:03:28 pm
content: You're going to want to find at least one flash or UV erasable version to get started with. Otherwise you could burn through dozens of them just trying to get an LED to blink. OTP parts are normally used for production once your code has been finished and tested.

author: tsman
author_rank: Frequent Contributor
timestamp: June 11, 2018, 06:19:49 pm
content: A bigger problem is how are you going to program these? I don't see BJ8P509F or FM8PS54 in the TL866 supported device list.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 11, 2018, 06:53:12 pm
content: The number of OPT µC may not be large enough to get used to a completely new µC. So not sure if it is really worth finding / adapting a suitable compiler (there may not be one) or at least an assembler. Getting a suitable programmer is another point. Having OTP parts and no reliable programmer / IDE is kind of a nightmare to start with. Even with a well set up IDE it usually needs several tries to make an LED blink.Unless you desperately need 100 µCs with the same very simple program (e.g. frequency divider, blink, delay) it is likely not worth it. Chance are there are no µCs left before you know how to use them for more than a simple blinking LED.My first flash based µC got an flash count of over 200 before the first program beyond a simple blinking LED was ready. This was with a ready made assembler and simulator program - so quite some test where done with the simulator.

author: FL0WL0W
author_rank: Contributor
timestamp: June 11, 2018, 08:16:49 pm
content: This sounds like a nightmare. unless you can find a suitable flash or eeprom variant. Or figure out how to connect some outside flash/eeprom and execute code from it (even then you would probably burn through 100 just trying to get that to work). There are just better things you can do with your time other than banging your head against the wall.

author: Ian.M
author_rank: Super Contributor
timestamp: June 11, 2018, 09:24:31 pm
content: Check if the NOP instruction has all bits programmed. If so, you can reuse a chip by over-programming bad code with NOPs and relocating the start of your code to a higher memory address, until the remaining space is too small for your code.The chances of finding a non-OTP variant of this or similar ultra-cheap MCUs are absolutely minimal. Without a known good simulator, you just have to dry-run the code on paper, keeping track of every single register bit to verify it before burning rather than rushing to build and burn after every edit. Anyone who's experienced the old-skool EPROM based MCU development cycle where your build-burn-test cycle was slowed down by 20 minutes of UV erasure to wipe a chip for reuse, unless you were able to afford enough spare MCUs and UV erasers to always have one ready, will have no problems developing the necessary patience and thourough self-checking habits to develop effectively on OTP MCUs.OTOH unless you *LOVE* the pain, it just isn't worth it if you aren't getting paid good money to suffer. At the moment the O.P.'s in the hole for $5 - not even the price of a decent burger meal - IMHO write them off as a dumb impulse purchase mistake and either find another sucker to buy them or widlarize them. Heck, unless you got them direct from the manufacturer, you don't even know if they are blank - they may be from a cancelled production run and already burnt with someone else's code!

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: June 12, 2018, 06:56:52 am
content: Thanks for all the comments! What I’ve gathered from your posts is that its hell of a lot of work and probably not worth learning since I probably won’t get any use out of it.Ordinary flash based micros with proper documentation and toolchain are cheap enough so I probably won’t ever need to know this unless I work on a project with massive quantities.I bought a few tubes (Still have a lot at home) with the micros to work and tried to give them to the "old timers" and they refused to touch them with a 10 foot pole and that they never want to go back to the time of EPROM and UV erasing the chipsThey are currently in the break room with a note attached to them "Take at your own risk" and a QR-code to the datasheet, wonder who long it will be thereWell when I get more time in the future I’ll get into these a bit more, I’m still open for suggestions!

author: brucehoult
author_rank: Super Contributor
timestamp: June 12, 2018, 08:51:58 pm
content: Quote from: Ian.M on June 11, 2018, 09:24:31 pmOn our "HiFive1" RISC-V Arduino compatible we start the code in the OTP with 0x0000000F which is a fence instruction and thus something close to a NOP for practical purposes. It can later be patched to 0xnnnnnn06F, a relative branch with +/- 1 MB range to replacement code elsewhere in the OTP.The replacement code should also start with 0x0000000F so that it can itself be patched later.Actually, our OTP ships with the first 4 bytes being a branch to 12 bytes from the top of the OTP. At that location there are three instructions:0x0000000F fence0x200002b7 lui t0,0x20000 // loads 0x20000000 into register t00x00028057 jr t0The main bootloader is in flash at 0x20000000There is some other information about the hardware in the OTP, but as shipped 8156 bytes out of 8192 are unprogrammed.

author: westfw
author_rank: Super Contributor
timestamp: June 13, 2018, 07:19:32 am
content: I have some 4-bit Toshiba OTP microprocessors (TMP47P443) that seemed like a good idea at the time (cheap, and "4bit" was vaguely interesting.)They need some weird adapter to be programmed with an EPROM programmer, and there isn't even a vendor-provided assembler, so they're still sitting in storage :-(I don't even know for sure that they haven't already been programmed with some vendor's code...

author: soFPG
author_rank: Frequent Contributor
timestamp: November 16, 2019, 10:00:06 am
content: Any updates on the topic?There is an IDE available for download on their webpage:http://bjxmcu.com/index/mcu.htmlAnd there is also a "Writer" which writes programs to either OTP or "MTP" (as they call it on their website) controllers:http://bjxmcu.com/index/productkf.htmlUnfortunately neither TaoBao nor 1688.com have anything listed for "BJXDWTR" - so I am not sure if it is possible to program these chips at all!They have a few controllers listed here:http://bjxmcu.com/index/product/ptid/2.htmlbut most of them aren't available through TaoBao or 1688.com - which tells me this is a pretty niche company if even TaoBao doesn't list the majority.If I start "compiler.exe" (found in the IDE download package) I just get this error message in chinese (see attached images) - anyone able to translate this? "CompilerDLL.dll" is right next to "compiler.exe" in the same folder so that shouldn't be the problem.If I open "BjxMTPWriter.exe" there are only 3 chips available from the dropdown menu: "BJ8M601A, BJ8M602A, BJ8M603A". So this tool is missing a couple of chips. I am wondering if there also is a "BjxOTPWriter.exe" - at least not in the IDE.rar packageSeems like this is a dead end for nowEdit: Their last chip on the "New IC"-section:http://bjxmcu.com/index/product/ptid/1.htmlis from 2014.Edit_2: @westfw There is a chinese company selling multi device programmers, there are some which are able to program the "TMP47P422VF", although it is not the exact same chip if they are compatible enough it could work, full supported devices are listed here:http://www.weilei.com/VP998list.htm#TOSHIBA

author: TomS_
author_rank: Frequent Contributor
timestamp: November 16, 2019, 12:35:54 pm
content: Quote from: Sudo_apt-get_install_yum on June 11, 2018, 12:21:47 pmYou could do that with a low end PIC or ATMEL part, but without the headache.Or, if you want to learn/do somethingreallyinteresting (if I do say so myself), try and build yourself a Z80 or 6502 based computer.