Author Topic: OTP Programming  (Read 5743 times)

0 Members and 1 Guest are viewing this topic.

Offline Sudo_apt-get_install_yumTopic starter

  • Regular Contributor
  • *
  • Posts: 166
  • Country: se
OTP Programming
« on: June 11, 2018, 12:21:47 pm »
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 zone :)

The 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
 

Online hexreader

  • Frequent Contributor
  • **
  • Posts: 272
  • Country: england
Re: OTP Programming
« Reply #1 on: June 11, 2018, 12:33:47 pm »
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.
« Last Edit: June 11, 2018, 12:43:13 pm by hexreader »
 

Offline tsman

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: gb
Re: OTP Programming
« Reply #2 on: June 11, 2018, 12:50:18 pm »
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 of this clone. Same datasheet comes up with a search & replace if you look for FM8PS54.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13218
Re: OTP Programming
« Reply #3 on: June 11, 2018, 01:05:43 pm »
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 the GPUTILS PIC assembler toolsuite.

If you have less free time or aren't so strong a C programmer, the DOS TASM 3.1 table 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.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: OTP Programming
« Reply #4 on: June 11, 2018, 05:03:28 pm »
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.
 

Offline tsman

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: gb
Re: OTP Programming
« Reply #5 on: June 11, 2018, 06:19:49 pm »
A bigger problem is how are you going to program these? I don't see BJ8P509F or FM8PS54 in the TL866 supported device list.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 15157
  • Country: de
Re: OTP Programming
« Reply #6 on: June 11, 2018, 06:53:12 pm »
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.
 

Offline FL0WL0W

  • Contributor
  • Posts: 23
  • Country: us
Re: OTP Programming
« Reply #7 on: June 11, 2018, 08:16:49 pm »
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.  |O
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13218
Re: OTP Programming
« Reply #8 on: June 11, 2018, 09:24:31 pm »
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!
« Last Edit: June 12, 2018, 07:01:10 am by Ian.M »
 

Offline Sudo_apt-get_install_yumTopic starter

  • Regular Contributor
  • *
  • Posts: 166
  • Country: se
Re: OTP Programming
« Reply #9 on: June 12, 2018, 06:56:52 am »
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 chips  :-DD

They 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 there  ;D

Well when I get more time in the future I’ll get into these a bit more, I’m still open for suggestions!
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4768
  • Country: nz
Re: OTP Programming
« Reply #10 on: June 12, 2018, 08:51:58 pm »
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.   

On 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 fence
0x200002b7 lui t0,0x20000 // loads 0x20000000 into register t0
0x00028057 jr t0

The main bootloader is in flash at 0x20000000

There is some other information about the hardware in the OTP, but as shipped 8156 bytes out of 8192 are unprogrammed.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4349
  • Country: us
Re: OTP Programming
« Reply #11 on: June 13, 2018, 07:19:32 am »
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...

 

Offline soFPG

  • Frequent Contributor
  • **
  • Posts: 283
  • Country: de
Re: OTP Programming
« Reply #12 on: November 16, 2019, 10:00:06 am »
Any updates on the topic?
There is an IDE available for download on their webpage: http://bjxmcu.com/index/mcu.html
And 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.html

Unfortunately 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.html but 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 package :(

Seems like this is a dead end for now

Edit: Their last chip on the "New IC"-section: http://bjxmcu.com/index/product/ptid/1.html is 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
« Last Edit: November 16, 2019, 11:01:31 am by soFPG »
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: gb
Re: OTP Programming
« Reply #13 on: November 16, 2019, 12:35:54 pm »
an instruction based language with is nice so I can get out of my C comfort zone :)

You could do that with a low end PIC or ATMEL part, but without the headache. ^-^

Or, if you want to learn/do something really interesting (if I do say so myself), try and build yourself a Z80 or 6502 based computer. :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf