developing drivers for custom boards
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
first question : what interface?
I see EPP parallel port or ethernet . EPP seems a lot easier, but network based I/O feels like it would be nice in the long run. So is a network based I/O even feasible? Developing the I/O card for EPP is really easy, so maybe that needs to be first even if I go for the net based solution later.
second question: Drivers?
I assume a file written in comp is necessary, something simular to the file Andy made for the ISA card in another thread. I don't really want to do stepgen in the card, I really just need to have about 52 I/O on a single port.
So is there any detailed info on creating the comp file? I have read the link Andy pointed to, and I understand the file for the ISA card. I guess I am just looking for somewhere to start.
Third : How to structure the data?
By this I mean send a single address byte to my card followed by some number of data bytes? or an address byte for each data byte? Same question for reading the inputs.
I could use an existing driver for another card, but don't know where to find them.
Thanks in advance for any feedback
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
Yes.I see EPP parallel port or ethernet . EPP seems a lot easier, but network based I/O feels like it would be nice in the long run. So is a network based I/O even feasible?
wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Etherlab
It is possible that comp might be too limiting, and that you need to use normal C.I assume a file written in comp is necessary,
Or set up an address translation table at driver load time. This is an option in the Hostmot2 driver. You need to balance the overhead with the speed. if you will always be sending exactly 5 bytes, then yu might as well auto-address. If you will be sending data to 5 of a possible 50, then address then data makes sense. The address translation approach says "I will send the byte for address 2 then the byte for address 45 then the byte for address 12..."By this I mean send a single address byte to my card followed by some number of data bytes? or an address byte for each data byte? Same question for reading the inputs.
I could use an existing driver for another card, but don't know where to find them.
Assuming you have the source: src/hal/drivers. look at ppmc and mesa_hostmot2.
git.linuxcnc.org/gitweb?p=emc2.git;a=blo...2d3b3d168576dd199aff
git.linuxcnc.org/gitweb?p=emc2.git;a=blo...2d3b3d168576dd199aff
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
I think it makes sense to send a fixed number of bytes and read a fixed number. The numbers are TBD, but I am feeling like 5 sent and 4 read. For a whopping 9 byte transfer, I can't see any real value in trying to do random byte access.
I will study on the files posted and see if I can make sense of it.
First question I have is this: I see where 4 bytes get assembled into a 32 bit variable. Is this to make it possible to send the 4 bytes without an adress?
example:
variable = r0 + (r1<<8) + (r2 << 16) + (r3 <<24)
and if I want 5 bytes, will I just need to add +(r4<<32) ?
I guess the same would be true for reading if 4 bytes are read, they will come in as a 32bit variable?
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
How many 8s in 32?variable = r0 + (r1<<8) + (r2 << 16) + (r3 <<24)
and if I want 5 bytes, will I just need to add +(r4<<32) ?
It rather depends on the protocol. The parallel port is only 8 bits wide. I imagine you get the data in bytes, but it is possible that the low-level EPP drivers assemble into wider types. I have never looked.I guess the same would be true for reading if 4 bytes are read, they will come in as a 32bit variable?
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
with this command
outb(R0, base_addr);
how does the p-port know to strobe the address strobe or the data strobe?
for a P-port I would assume R0 is data and base_addr is 0x0378? (or whatever the p-port is at)
how many 8's are in 32?
why 5 of course
R0 = d0-d7
R1= d8-d15 data <<8
R2 = d16 - d23 data <<16
R3 = d24 - d31 data <<24
R4 = d32 - d40 data << 32
Ok, so I know there is only 4 8's in 32, but the first 8 don't count as I understand it. PLEASE correct me if I am wrong.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
I might be misunderstanding the question, but you can only store 4 bytes in a 32-bit integer.Ok, so I know there is only 4 8's in 32, but the first 8 don't count as I understand it. PLEASE correct me if I am wrong.
If you want to, you can store 8 bytes in a 64-bit integer, but that isn't a supported HAL pin type. Not that that necessarily matters.
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
I assume when the time comes, there is a way to transfer a spindle speed? a value from 0-200.
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
- Posts: 17904
- Thank you received: 4774
www.beyondlogic.org/epp/epp.htm is a good reference on EPP port operation
Perhaps the simplest addressing scheme on a EPP slave device is to write or clear a byte address pointer with address writes and increment that pointer on every data read/write
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
Thanks PCW
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
To get this transition started, I am going to use my current cards set up on seperate ports. That way I don't have to create new hardware just yet. Once I am satisfied I understand what I am doing, I will convert to a single card for all my I/O needs.
Please Log in or Create an account to join the conversation.