I see, thank you for your reply,
Now i found the pluto-p .comp and .h source code and i modified it to test the
simple EPP write command. I set the parallel port Wait (11) line to LOW and
monitor the Write line using oscilloscope. Nothing happened. The pin value
stayed still. I am using the D525MW and i tested the communication on the
motherboard parrnell port and also on the additional pci parallel port card.
The result was the same - nothing happed. I also tried to change the epp_wide
mode - same result. Any idea what could be wrong or how can i test the hardware
is fine?
--------------------- HAL file ----------------
loadrt threads name1=base-thread period1=2000000 name2=servo-thread
period2=20000000 # ns
loadrt eppfpga
addf
eppfpga.write base-thread
--------------------- eppfpga.com -------------------------
component eppfpga;
description """some discription""";
pin in bit testin[2];
pin out bit testout[2];
option singleton;
option extra_setup;
option extra_cleanup;
option data internal;
function write; // "Write all the outputs
modparam dummy ioaddr = 0x1030;// 0x0378
modparam dummy ioaddr_hi = 0; //Used to set EPP mode. 0: ioaddr + 0x400. -1: no
secondary address.
modparam
dummy epp_wide = 1; //Set to zero to disable the "wide EPP mode".
"Wide" mode allows a 16- and 32-bit EPP transfers, which can reduce the
time spent in the read and write functions. However, this may not work
on all EPP parallel ports.
modparam dummy watchdog = 1; // hardware watchdog
enable. 6ms
modparam int test_encoder = 0;
license "GPL";
include "pluto_common.h";
;;
typedef struct {
int64_t last_index[4];
int64_t last_count[4];
int64_t reset_count[4];
} internal;
FUNCTION(write) {
if(communication_error) return;
EPP_ADDR(0);
write32( 0x00110011);
write32( 0x11001100);
}
EXTRA_SETUP() { return 0; }
EXTRA_CLEANUP() {}
------------ pluto_common.h-------------------
#ifdef SIM
#include <sys/io.h>
#include <errno.h>
#else
#include <asm/io.h>
#endif
#include "hal_parport.h"
int ioaddr = 0x378;
int ioaddr_hi = 0;
int epp_wide = 0;
int watchdog = 1;
struct hal_parport_t portdata;
RTAPI_MP_INT(ioaddr, "Address of parallel port where pluto-p is attached");
RTAPI_MP_INT(ioaddr_hi,"Secondary address of parallel port (0 to use
ioaddr+0x400)");
RTAPI_MP_INT(epp_wide, "Use 16- and 32-bit EPP transfers with hardware
EPP");
RTAPI_MP_INT(watchdog,"Enable hardware watchdog to tristate outputs if EMC
crashes");
#ifndef llabs // linux/kernel.h may provide labs for realtime systems
static int64_t llabs(int64_t l) { if(l < 0) return -l; return l; }
#endif
static inline int64_t extend(int64_t old, int newlow, int nbits) {
int64_t mask = (1<<nbits) - 1;
int64_t maxdelta = mask / 2;
int64_t oldhigh = old & ~mask;
int64_t oldlow = old & mask;
int64_t candidate1, candidate2;
candidate1 = oldhigh | newlow;
if(oldlow < newlow) candidate2 = candidate1 - (1<<nbits);
else candidate2 = candidate1 + (1<<nbits);
if (llabs(old-candidate1)
> maxdelta)
return candidate2;
else
return candidate1;
}
static inline void EPP_DIR_WRITE(void) { }
static inline void EPP_DIR_READ(void) { }
static inline void EPP_ADDR(int w) {
outb(w, ioaddr+3);
}
static inline void EPP_WRITE(int w) {
outb(w, ioaddr+4);
}
static inline int EPP_READ(void) {
return inb(ioaddr+4);
}
static inline __u32 read32(void) {
unsigned char a, b, c, d;
if(epp_wide)
return inl(ioaddr+4);
a = EPP_READ();
b = EPP_READ();
c = EPP_READ();
d = EPP_READ();
return a + (b<<8) + (c<<16) + (d<<24);
}
static inline void write32(long w)
{
if(epp_wide) {
outl(w, ioaddr+4);
return;
}
EPP_WRITE(w);
EPP_WRITE(w >> 8);
EPP_WRITE(w >> 16);
EPP_WRITE(w >> 24);
}
________________________________
From: Jon Elson <[email protected]>
To: Klemen Dovrtel <[email protected]>; Enhanced Machine Controller
(EMC) <[email protected]>
Sent: Tuesday, January 29, 2013 6:45 PM
Subject: Re: [Emc-users] EPP data transfers
Klemen Dovrtel wrote:
> Hello everybody,
>
> I am studying EPP data transfers via parallel port and i could not find the
> answer to my simple question: Is it possible to transfer several bytes of
> data in single base-period? How many bytes can be transferred?
>
>
Umm, you question is not very specific. If you are inquiring about the
hal_parport
driver, it doesn't use EPP. I use EPP mode in the driver for my
parallel port
connected devices, and they transfer many bytes, often 20-75 per board,
every servo period. I don't see why it couldn't alos be done in the
base thread, but if that is running at a fast rate, you have to be very
concerned with the complete thread time. With a fast PCI parallel port
plug-in card, a complete EPP transfer can be done in as little as about
600 ns, with an on-motherboard ISA-interfaced multi-IO chip, it may
take as long as 1.2 us. More than a few transfers might be too slow
for your thread.
How many has to be determined by your thread dispatch rate, the speed
of the parallel port, and the realtime jitter, to give enough margin so
you never overrun the period.
Jon
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users