On Wed, Jan 22, 2003 at 10:48:47AM -0600, Daniel Martin wrote: > First, a moderate amount of background: > > I'm trying to design my own programmer(and software) for the PIC that will > be useable on most Linux systems without requiring root. Not to dampen your enthusiam, but are you sure that you want to reinvent the wheel? While the root issue is slightly annoying, it certainly isn't insurmountable. First off is that root is really only required long enough for the programmer to get I/O permissions to the parallel port. While most software (including the current version of Brian Lane's original picprg which I'm maintaining) does happen to execute as root in its entirety, it certainly doesn't have to be the case. From a programmer access issue, some slight configuration of sudo is sufficient to limit the users that can access the programming software. Finally if there is actual issue of gaining root, the vast majority of PC's have no physical security. So if you can gain physical access to the machine (which I believe is a requirement because you have to physically connect the programmer hardware to it) then booting the machine with a Knoppix CD should be sufficent to gain temporary root access long enough to do programming. Just some thoughts. Care to explain why the lack of root requirement is critical? > > Because of that restriction, it's natural to try to use the serial port; > in fact, I've run across programmer designs that manage to power the > entire thing off a capacitor charged by bouncing TX back and forth, all > the while bit-banging the programming protocol with the RTS and DTR lines. But these tend to be somewhat flakey because there's no guarantee that the PC serial port is going to conform to precise RS232 standards. Many of these types of programmers simply don't work from laptop serial ports because the port issues only +5/-5 or +5/0 for its serial output. > (the software I've found still uses direct ioport calls to bit-bang the > control lines, but presumably that could be rewritten to use the TIOCMBIS > and related ioctl calls, which can be done without root priveleges and > are portable beyoind x86 machines) True. Be aware though that those calls can be asyncronous. Just because you've returned from the ioctl doesn't guarantee that the control line has changed to the requested state. > > I like the idea of powering the programmer off the supplied serial > voltage, but bit-banging via the control lines just seems wrong when > there's already a line (TX) that's dedicated to sending data anyway. > > So my plan is to have a programmer that can detect the start bit coming > down the TX line, use that (positive-going) transition to trigger a > monostable that will supply the clock transition downward at the > appropriate time in the middle of the byte; then I'd send a series of 0xff > and 0x00 bytes to the programmer, with each byte getting to the pic as one > bit. The RTS/DTR control lines could then be used to power the > programmer; holding them at opposite levels should give at least a 20 volt > potential difference. It's going to be real slow because each byte you send out will only transmit a single bit. How are you going to get feedback from the PIC? And again you can't be sure about the output voltages on any serial pin. > > (end background) Well that's all I'll comment on. If you change your mind about nonroot and serial be sure to checkout my trivial programmer: http://www.finitesite.com/d3jsys Also Wouter's Wisp628 seems to be the right way to do a serial programmer. Use a PIC to talk to PC on a serial port and program the parts. Simple to build, fast, and not nearly as unstable as the sample the TX line bit using a oneshot that needs to be tuned. http://www.voti.nl/wisp628 Also be sure to check out my normal Linux development environment of Wouter's WLoader bootloader and Woj's linwload which give me not only ICSP programming via the serial port, but also a nice serial debug port to work from. This is at the cost of a single I/O pin and a small slice of program memory on a 16F87X chip. Hope this helps you in your quest. BAJ -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads