Using an x86 pc as an obese microcontroller? - Page 1
Forum section: electronics / general

author: botcrusher
author_rank: Regular Contributor
timestamp: March 04, 2016, 02:36:24 pm
content: Straightforward enough, let's say i have an army of Pentium 4 boards that still work, is there any way i could interface with it and use it as a realllly fast controller?Short of some kind of pci /pcie card, i wonder if i could cheat and hijack the audio lines for dialup-esque data transmission.

author: Simon
author_rank: Unknown
timestamp: March 04, 2016, 02:59:52 pm
content: nothing stopping you. providing you can code it and interface you can do as you like. I'm guessing it will be much harder to write low level code for but have no experience to go by.

author: Ian.M
author_rank: Super Contributor
timestamp: March 04, 2016, 03:09:34 pm
content: Back in the days of MSDOS and the ISA bus, this was fairly common, and one could get various PIO cards for the purpose. However it is extremely difficult to write fully deterministic code for Pentium class or higher processors, + you have a very restricted choice of OSes if you need guaranteed realtime control.

author: dom0
author_rank: Super Contributor
timestamp: March 04, 2016, 10:13:33 pm
content: Not to mention that the P4 is some of the worst performance / Watt ever shipped by Intel. Modern hardware might cost a few bucks now (but it's so cheap nowadays, who cares?), and will definitely save money via lower power consumption, probably already after a few months of 24/7 operation.

author: Simon
author_rank: Unknown
timestamp: March 04, 2016, 10:18:26 pm
content: I'd be interested to know why so much processing power is required for a micro controller job.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: March 05, 2016, 12:06:37 am
content: Or electrical power, or weight, or space, or noise. The VIC-20 is a far better controller IMO.

author: nctnico
author_rank: Super Contributor
timestamp: March 05, 2016, 12:21:56 am
content: Quote from: Ian.M on March 04, 2016, 03:09:34 pmYou have to define realtime first because there is no use in overspecifying a constraint. If you need milli-second resolution then even Windows will do just fine otherwise it would be useless for playing audio & video. Still you'd need I/O cards, drivers and such to do something sensible with a PC platform.

author: MK14
author_rank: Super Contributor
timestamp: March 05, 2016, 12:25:43 am
content: Quote from: botcrusher on March 04, 2016, 02:36:24 pmThere are many advantages, that the Pentium 4 solution has, over modern alternatives, such as the raspberry PI 3.The P4 is massively more powerful. It produces probably 50x as much heat POWER, as the RPI3.It calculates things in a really heavy weight way. Perhaps weighing well over 50x as much.If you use them, It will produce at least 50x the laughter, from me when I hear about it.It can do millions of things, the RPI3 CAN'T do. Such as the P4 won't use USB, HDMI, modern PCI cards, modern power supplies, DDR4 (or DDR3 or DDR2 for that matter).Actually on a more serious note. Many PCs are apparently used in things like bank cash machines, travel money exchange machines, shop tills (some), etc etc.You can actually get proper Pentium 3 embedded boards. From what I have seen, they are just like massive PCI expansion cards. Which allow VGA and other stuff to be plugged in to them. They are used in applications, such as embedded machine (very large) controllers.Seriously, why not get a Raspberry PI 3, or something. It will be considerably more useful and accessible (I/O) + relatively future proof.

author: Rasz
author_rank: Super Contributor
timestamp: March 05, 2016, 05:04:22 pm
content: Quote from: botcrusher on March 04, 2016, 02:36:24 pmwell, if you are up in the north you can use them for heating

author: NivagSwerdna
author_rank: Super Contributor
timestamp: March 05, 2016, 06:19:43 pm
content: Historically there has been a large market for embedded PCs presumably since the software environment was well established leading to all sorts of devices like ATMs, information kiosks, photo booths etc. so it's not an outrageous solution.Which solution you take might be determined by factors like size, power consumption etc, in which case you will get more bang for your buck with more modern hardware.The non-PC segment has evolved hugely over the last few decades with the ascendance of things like ARM, Linux etc,. but as with all technology the goal posts continue to move.

author: eugenenine
author_rank: Frequent Contributor
timestamp: March 05, 2016, 06:34:36 pm
content: While you can use those old boards, its not really worth it anymore. They take up a lot of space, produce a lot more heat and use a lot more power then a raspberry pi or beaglebone. I cleaned out most of my old PC's and replaced them with Pi's and used some old cell phone changers and microsd cards lying around from upgrading those.

author: botcrusher
author_rank: Regular Contributor
timestamp: March 05, 2016, 07:15:49 pm
content: Quote from: dom0 on March 04, 2016, 10:13:33 pmI know, i know. I have to deal with explaining why my school board's "free" government hand me downs are a terrible solution.You haven't seen slow until you witness 25 pentium 4s trying to log into windows 7.well, at least it's got hyper threading?Quote from: blueskull on March 05, 2016, 12:11:26 amWasn't there a big issue with the intel boards actually being incredibly slow when used as an arduino?Quote from: eugenenine on March 05, 2016, 06:34:36 pmBut the advantage to using a P4 is that i have avirtually endless supply!They decommissioned a bunch of the really old Pentium 4 towers (beige, built when p4s were actually considered "fast")I'm aware the heat to perfomance is beyond terrible, but would you rather i used pentiumDboards?for those who don't know, a pentium D is two pentium 4 chips forced onto the same die, the thermal output is terrifying.

author: dannyf
author_rank: Super Contributor
timestamp: March 05, 2016, 09:42:54 pm
content: QuoteRunning DOS on them.

author: Wilksey
author_rank: Super Contributor
timestamp: March 05, 2016, 10:24:20 pm
content: Install Linux on them, but it depends on what you want to do with it? I doubt it has things like SP / I2C and probably only 1 serial port, you can buy expansion cards, but, why would you?You could use them for processing heavier stuff that a small micro can't like data logging or something perhaps?

author: Hypernova
author_rank: Unknown
timestamp: March 06, 2016, 01:37:37 am
content: Quote from: botcrusher on March 05, 2016, 07:15:49 pmI remember Tom's Hardware overclocking Celeron Ds, gave great performance per CPU $ but the wattage was surreal.As far as OS platform goes from what I've heard from the gray beards here DOS is the way to go. As for I/O you probably have to try make your own PCI expansion boards.

author: amyk
author_rank: Super Contributor
timestamp: March 06, 2016, 05:41:43 am
content: Quote from: MK14 on March 05, 2016, 12:25:43 amIt's also considerably less open or documented. Good luck getting anything useful from Broadcom.On the other hand, the PC has been around long enough that all the warts and quirks are well-documented, you can find datasheets for most of the critical components easily. Older ones will be better if you want to play around, especially those before the introduction of "secure" boot and the whole (U)EFI mess.

author: MK14
author_rank: Super Contributor
timestamp: March 06, 2016, 07:43:28 am
content: Quote from: amyk on March 06, 2016, 05:41:43 amI agree that the Raspberry PI 3 is NOT fully open sourced. BUT I use it myself (version 2, currently), because I have enough information to do what I want with it, and DON'T need to know how everything about it works.But if that worries you and/or the OP, then there are plenty of open sourced, similar microcontroller based, boards available, many of which are very reasonably priced. Or even buy a microcontroller and build it yourself.But an old Pentium 4 system has so much wrong with it, as regards physical size, power consumption, lack of availability of brand new stuff for it (e.g. the capacitors on the motherboard will now be, how many years do you say ?).I don't really agree with your implication that a Pentium 4 PC, is hugely open sourced and known about, in minute detail. (Fully, PUBLICLY).I.e. If you used Dos or later (original), have Microsoft released the source code etc for it ?Have Intel released the full factory documentation with all the (in all likelihood), hundreds of minute errata with the Pentium 4 cpu ? (to the general public).Does it really matter if you can get the raspberry PI 3 to do what you want, that it is NOT fully open sourced ?tl;drI still think that it is NOT a good idea to go for the Pentium 4's.Allowable exceptions (in my opinion), would be a third world country, where even low cost microcontrollers, are unavailable and/or out of reach, or doing it purely for fun, obsession with intel Pentium 4's or just as a big learning exercise, would NOT sound too unreasonable.If people are really that concerned about the open sourced nature of things, then go for a fully open sourced cpu.

author: Mechanical Menace
author_rank: Super Contributor
timestamp: March 06, 2016, 12:06:29 pm
content: http://wiki.osdev.org/Main_PageHas some decent introductions to barebones x86 development.

author: MK14
author_rank: Super Contributor
timestamp: March 06, 2016, 12:24:21 pm
content: Quote from: blueskull on March 06, 2016, 12:15:03 pmActually, some time ago, I was reading about this very thing, I can probably link to it if you want.Basically it was a number of enthusiasts, similar to us/EEVblog members. But who were living in one of the poorest countries in the world (by the sound of it).Sooooooooooo ....How do they manage to get their (Intel I7) 4790K (or Skylake, or Socket 2011 etc), souped up PC, bought and made, when they have to search through rubbish tips (LITERALLY!), each day, to get by ? (I might be remembering it wrong, maybe it was NOT that bad. It was some time since I read the article).The answer was that they (if I recall correctly) collected old bits of old computers, from those tips. Then invented techniques, whereby they swapped out the "bad/cheap capacitors", in cheap power supplies. Also they upgraded other components, with other scrap ones. Ending up with a somewhat decent power supply. Which cost them $0.tl;drI imagine I would be doing similar, if I lived there.But you could well be right.Microcontrollers are so cheap now, what from about $0.10, I think even less in China, maybe less elsewhere. They can probably be bought just about everywhere.Except perhaps North Korea.EDIT: On reflection, I think I am probably recalling the article BADLY. I've tried to find it, but can't. I think it came from the badcaps site, or similar.The following is a vaguely similar type of thread:http://www.badcaps.net/forum/showthread.php?t=23128

author: Rick Law
author_rank: Super Contributor
timestamp: March 07, 2016, 02:17:07 am
content: Quote from: blueskull on March 06, 2016, 12:15:03 pmFirst, Second, and Third word are jargon developed during the cold war to describe allegiance...First world = USA and allies (or counties operating within there sphere of influence)Second world = USSR and allies (or counties operating within there sphere of influence)Third word = the rest.So, China during cold war was "second world" when the term was used for its original meaning. USSR is kaput, I suppose we can replace it with Russia. So, China could still be 2nd or 3rd depending on its relationship with Russia.

author: Rick Law
author_rank: Super Contributor
timestamp: March 07, 2016, 06:36:44 am
content: Quote from: blueskull on March 07, 2016, 02:26:33 amI know the feeling. When I first saw the term "2nd world nations..." in news magazines, I had no idea what they were talking about. I thought may be they mean some other geographical locale! One day, I got so confused by the news I just had to research at the library what the hack that means.These days, 3rd world is used mainly to describe poor countries. Third world was typically poor even during the cold war. Third world by definition isn't aligned with USA or USSR so it doesn't have a big brother to help.

author: westfw
author_rank: Super Contributor
timestamp: March 07, 2016, 09:35:36 am
content: QuoteI think you'll find this not to be the case, if you actually try to do low-level bare-metal programming of a modern x86 CPU or chipset. Intel Documentation comes in several levels of "proprietaryness", for example, and something like a "BIOS Writers guide" is a "red" document that had a bunch of requirements including time limits and such. I had (briefly) access to some "yellow" level manuals; they had to be returned to Intel "when you're done."Now, in terms of using a PC as a microcontroller, the PC will generally come with a BIOS installed that will, if properly configured, leave the board in a pretty good state to do bare metal programming ... thereafter (using something like grub as a bootloader.) We did have one mysterious performance anomaly that turned out to be due to the BIOS periodically doing USB stuff so that it could make USB keyboards appear at BIOS level...

author: Rick Law
author_rank: Super Contributor
timestamp: March 07, 2016, 06:36:43 pm
content: Quote from: westfw on March 07, 2016, 09:35:36 amBut once you start using the BIOS, it adds to the issue of "difficult to make it deterministic" as Ian.M's reply (quote below) pointed out.386 is probably a lot easier if it must be deterministic. If I recall: single decoder queue, no predictive jump/speculative execution, no CPU memory cache; and surely you wont have USB on an old 386 motherboard!But once you get down to 386, why not just select an MCU which would be designed as an MCU.Quote from: Ian.M on March 04, 2016, 03:09:34 pm

author: Porch
author_rank: Contributor
timestamp: March 07, 2016, 09:17:48 pm
content: http://www.amazon.com/Controlling-The-World-Your-PC/dp/1878707159Had this book back in the day.

author: R_Gtx
author_rank: Regular Contributor
timestamp: March 07, 2016, 11:48:19 pm
content: Quote from: Rick Law on March 07, 2016, 06:36:43 pmFor heavy-duty embedded applications there are a number of manufacturers of VME SBCs using intel i7s. Modern boards will use, say,corebootwithIntel® Firmware Support Package.

author: westfw
author_rank: Super Contributor
timestamp: March 08, 2016, 01:15:15 am
content: QuoteIdeally, you don't use the BIOS *except* to set up the cpu and chipset. The trick is finding the settings (and/or things you can do programatically) that get it completely out-of-the-way after your "bare metal" code starts.(As a would-be bare-metal PC programmer, I have about zero interest in reading the EEPROMs on the memory DIMMS and setting up the chipset for the correct timings/etc. As one example.)

author: Rasz
author_rank: Super Contributor
timestamp: March 08, 2016, 01:31:12 am
content: Quote from: westfw on March 08, 2016, 01:15:15 amexcept you cant because this is pcinterrupts, exceptions, bios takes over a lot of stuff and runs in the background constantly

author: timb
author_rank: Super Contributor
timestamp: March 08, 2016, 02:10:49 am
content: Quote from: Rasz on March 08, 2016, 01:31:12 amNot true. You can hook into all that stuff in your own code. Do you think Windows really relies on the BIOS to handle I/O, keyboard input, interrupt management, etc.?! Hell no! Once your PC boots, that's pretty much it for the BIOS these days. No reason you couldn't do the same in your own code.

author: Rasz
author_rank: Super Contributor
timestamp: March 08, 2016, 04:52:24 am
content: Quote from: timb on March 08, 2016, 02:10:49 amare you suggesting someone should use windows as a software base for his "pc microcontroller"?)) or write his own os from scratch? with exceptions, scheduling, memory management and hookers?

author: Rick Law
author_rank: Super Contributor
timestamp: March 08, 2016, 07:40:53 am
content: Quote from: Rasz on March 08, 2016, 04:52:24 amThat brings us back to the question earlier - why use the PC as MCU at all.Without Linux or Windows or some such, the PC is rather useless. You have to rewrite every damn driver and software - down to a UART driver, keyboard driver, and a VGA/CGA driver of some sort. The convenience that came with the PC, like plugging in a USB Cam and it works, just wont be there. All you get with the PC-MCU is just a larger hunk of iron.If one "gives up" and just load Windows to run the PC as a giant MCU, you better hope that the "fire detection" routine isn't the one running when Windows decides it needs an auto-update.Future news story: "The investigation of the rocket explosion found: when the rocket was about to do the 0.3 second burn to slow down for re-entry, Windows decides to phone home via the satellite link for the latest auto update... The rocket did burn up due to delays, but investigation also shows the update was successful and Windows was absolutely up to date with the latest patches before the rocket hits ground."

author: botcrusher
author_rank: Regular Contributor
timestamp: March 08, 2016, 10:38:09 pm
content: Quote from: Rick Law on March 08, 2016, 07:40:53 amJust lol.I'd probably run linux on it, make a python script to communicate via the sound interface. maybe use some other interface, don't say serial, that's justtooeasy.If i don't find a better use for it, i have a mini-ITX rig with a modern pentium (G3258) that i could use.

author: westfw
author_rank: Super Contributor
timestamp: March 09, 2016, 12:28:00 am
content: Quotea PC makes for a wonderfully inexpensive development environment for any x86 bare-metal product you might have been planning (which is not quite the same thing.)For every complication that the BIOS causes, it also provides some nice little features (like: initializing video hardware so that you have a "debug display" that can be used just by poking bytes off into a known memory location.) (A lot of x86 bare-metal products will end up buying a BIOS from someone anyway, for that low level initialization that you can't find out how to do without heavy legal agreements with intel.)

author: rolycat
author_rank: Super Contributor
timestamp: March 09, 2016, 12:46:57 am
content: Quote from: westfw on March 09, 2016, 12:28:00 amUnless you need x86 compatibility for hysterical raisins, why would anyone plan such a product today?

author: ivan747
author_rank: Super Contributor
timestamp: March 09, 2016, 01:49:09 pm
content: Quote from: botcrusher on March 05, 2016, 07:15:49 pmWindows 10 is actually faster then 7 if you're willing to switch.

author: westfw
author_rank: Super Contributor
timestamp: March 09, 2016, 08:13:43 pm
content: QuoteWell, x86 cpus are about the fastest OTS general purpose CPUs you can get. Probably several of the fastest. Sure, a multicore 2GHz ARM has much better total MIPS/Watt, but sometimes you'd rather have a single-core 4GHz blazing away at more than one operation/cycle.(or did you mean "why bare metal, when you could run linux or whatever and implement your product code as a device driver or something, and get all that support infrastructure for free?" That's a tougher question.)(also, the resources put into x86 compilers are quite substantial.)

author: botcrusher
author_rank: Regular Contributor
timestamp: March 09, 2016, 11:26:21 pm
content: Quote from: blueskull on March 09, 2016, 02:03:05 pmYes sorry my bad, package not die.Thermal output is still really bad though at a blistering 130WStill has nothing on amd's 5Ghz 8 core...

author: ahayes
author_rank: Newbie
timestamp: March 16, 2016, 08:45:05 am
content: If they have a parallel port you can use it as a crappy GPIO header. If you have soundblaster cards at your disposal you can use the game/midi port as a crappy A2D input. You might even get semi-deterministic behavior with FreeDOS and whatever C compiler you can find for it.You'd probably spend more money powering the thing over the course of its use than you would on an arduino clone so keep that in mind.

author: cio74
author_rank: Regular Contributor
timestamp: March 18, 2016, 07:27:21 pm
content: If you want real time data processing you can run DOS on it and write your own code to deal with ISA/PCI cards, parallel port, serial port and whatever else you've got in there.I would rule out both Linux and Windows since both are not real time operating systems. That only if you care about precise timing otherwise they are fine.On the benefits of running a Pentium over a MCU, lots of free compilers, excellent debuggers with no requirement to buy expensive trace probes, tons of documentation, easily expandable and upgradable to faster machines, if you feel so.So yes, I would definitely consider them, just power it up, deploy a DOS version and a free C, Pascal, ASM compiler and you're good to go.