Hi.
I'm trying to use the parallel port to get the IDCODE from a Xilinx prom via the
JTAG interface.
I'm using D0 for data-in (putting data to the PROM), D1 for the clock, and D2
for TMS (input for a state machine). I'm also using SELECT (Pin 13) for TDO
(data out, but that would be data in from the PC's point of view). The choices
were made by Xilinx when they designed the downloader cable, so there's nothing
I can do about them.
All of the output to the PROM seems to work fine. I've used a scope and checked
the levels on the lines. Input from the PROM is not working at all though. No
matter what I do, the status port has a value of 207 (0xCF). That places SELECT
as low. I've even bypassed the PROM and just connected pin 13 to a known high
source (see code below). Status is still 0xCF. Using the scope I can see that
the level on both pins is high at the same time.
I have the feeling I'm missing something simple but important. If anyone has
any ideas I'd really love to hear them.
Thanks,
Adam Read
CODE
=====
/******************************
* test.c
* 2003.05.08
* Adam Read
*
* Simple program to see if we can get data back on the SELECT line of
* the parallel port.
* Data1 (pin 2) is connected directly to SELECT (pin 13).
*****************************/
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include <sys/io.h>
int main(void){
struct timespec delay = {0, 1000};
int i;
int setted;
setted = ioperm(0x378, 10, 1);
if(setted<0){
printf("ioperm() failed with error %d: %s¸\n", errno,
strerror(errno));
return 1;
}
outb(0x0, 0x378);
for(i=0; i<10; i++){
outb(0x02, 0x378);
nanosleep(&delay, NULL);
setted = (inb(0x379)) & 0x10;
printf("SELECT should be high. We think it's %s.\n",
setted?"high":"low");
nanosleep(&delay, NULL);
outb(0x0, 0x378);
nanosleep(&delay, NULL);
setted = (inb(0x379)) & 0x10;
printf("SELECT should be low. We think it's %s.\n\n",
setted?"high":"low");
nanosleep(&delay, NULL);
}
return 0;
}
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Thu May 08 2003 - 09:03:24 EDT