![]() |
|
#1
|
|||
|
|||
Making a Program to ProgramCan any of you guys lend a helping hand on what specific fields of C++ I need to learn in order to program a flash ROM chip through parallel port or serial port? (Preferably parallel)
Thanks! |
|
#2
|
|||
|
|||
Re: Making a Program to ProgramQuote:
I'm not sure what you mean by "what specific fields of C++," but I'll give it a try anyway, as I've written a good number of device programmers. There are several standards in PC parallel port. Jan Axelson wrote a book called www.amazon.com It will be very helpful if you do not already know a lot about the PC parallel port and/or the types of parallel ports that you'll be using. Searching the 'net should find several examples of PC parallel port code for programming various devices. It is a good place to start so that you can better understand the necessary steps. Basically, you need a way to manage the various control logic and data pins on the device. Some devices may need tri-state capabilities in order for you to program them. Once the electrical requirements are implemented, you basically read the device for its descriptive information (most have some bytes or byte patterns that can be read to return device ID and/or other related information), then you put the device into programming mode and you assert the data lines of the PC port and latch it in using the particular command set and timing requirements for the given device. You loop through until your program completes the bytes to be written (most ROMs are byte-wide access) and then you read back the bytes to verify that they were written correctly. There are usually numerous stateful requirements necessary in order to properly implement the timing requirements for the device. Depending on the type of device, they can be very simple to quite complex. Most are not terribly difficult after your first one! As for the C++ you need to know, it depends somewhat on your PC operating system. Basically, you need to open a file that you will write and verify to the device. You'll need access to your PC parallel port. It is very easy under Linux and DOS and somewhat more involved under Windows. A very simple thing to do is to wire up an LED to a pin and ground and toggle that bit. Once you can turn the LED on and off, you're ready to start writing the "real" program. I usually wire my logic analyzer up to the port before ever touching a device so that I can get the timing worked out based on the published spec...which isn't always correct, but at least a good starting point. Short of using an LA, you can o-scope your way to success, but a multi-channel scope is about the minimum requirement if preserving your sanity is an issue. Once you are able to control your control pins and assert your data in a verifiable way, you can wire in a device and try to read its device information byte(s). This is usually a reasonably "non-destructive" test that you can do to see that the device is working properly and that you've got most of your connections "happy" ...to steal a term from Food Network's Emril. Then what you want to do is write a couple of bytes out. Usually AAs and 55s are a good place to start. If you can read them back, you're well on your way to being done. Each device family and device technology type have their own little nuances that must be addressed. I'd strongly recommend implementing your code in a finite state machine (FSM). Check out the sourceforge.net project called smc, (State Machine Compiler) as it is probably the slickest way to implement C++ FSMs. There are probably 9 million other things that will come to mind later, but for now, that should help get you pointed in the right direction. Implementing a serial port-based device programmer usually requires custom hardware and a protocol between your PC serial port and the "programmer board." It is not difficult to do, but is certainly a layer of indirection that you don't need if implementing a parallel port programmer. One easy thing though is that under Windows, gaining access to a serial port is trivial. If you use Win9x, the old inp/outp "DOS" functions work. There are also third party libraries that provide easy access to parallel ports under later versions of Windows. Search the 'net because there are plenty of "home grown" device programmers out there. Is is almost always easier to start from a working example than tackling it without that benefit. :davis: |
Recent GIDBlog
US Elections and the ?Voter?s Responsibility? by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| creating a file in [c] | i hate c | C Programming Language | 15 | 21-Nov-2005 13:52 |
| Type casts ? | kai85 | C++ Forum | 12 | 23-Jun-2005 13:04 |
| fltk-2.0 cvs | Plumb | FLTK Forum | 20 | 13-Nov-2004 08:10 |
| Need help making a program | teh0ni0n | C++ Forum | 5 | 08-Jul-2004 22:04 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The