developing drivers for custom boards
- btvpimill
- Offline
- Elite Member
-
Less
More
- Posts: 213
- Thank you received: 3
23 May 2013 04:59 #34568
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
I have yet to convince the NetMos to read from the port. I have the DDR set in DCR as described in the datasheet and here by Jon.
Thanks for all the help, but this is now a dead end for me and am exploring new avenues
Thanks for all the help, but this is now a dead end for me and am exploring new avenues
Please Log in or Create an account to join the conversation.
- jmelson
- Offline
- Moderator
-
Less
More
- Posts: 817
- Thank you received: 157
23 May 2013 08:21 - 23 May 2013 08:23 #34573
by jmelson
/* set port direction to output */
rtapi_outb(0x04,CONTROLPORT(port_addr));
And this sets it to read mode :
/* set port direction to input */
rtapi_outb(0x24,CONTROLPORT(port_addr));
CONTROLPORT is the I/O port address 2 higher than the data port,
so standard would be 0x37A.
And, of course, the NETMOS may JUST NOT WORK! If the handshaking is not
working, the CPU may just blaze ahead and totally ignore that it needs to stop
and wait for the input operation to receive the data.
Jon
Replied by jmelson on topic developing drivers for custom boards
Here's the code I use in the hal_ppmc.c driver to set the port to write:I have yet to convince the NetMos to read from the port. I have the DDR set in DCR as described in the datasheet and here by Jon.
Thanks for all the help, but this is now a dead end for me and am exploring new avenues
/* set port direction to output */
rtapi_outb(0x04,CONTROLPORT(port_addr));
And this sets it to read mode :
/* set port direction to input */
rtapi_outb(0x24,CONTROLPORT(port_addr));
CONTROLPORT is the I/O port address 2 higher than the data port,
so standard would be 0x37A.
And, of course, the NETMOS may JUST NOT WORK! If the handshaking is not
working, the CPU may just blaze ahead and totally ignore that it needs to stop
and wait for the input operation to receive the data.
Jon
Last edit: 23 May 2013 08:23 by jmelson.
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
-
Less
More
- Posts: 213
- Thank you received: 3
29 May 2013 22:39 #34917
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
Now I have a question about
motion.spindle-speed-out
This is a float, so I assume my "pin" in my driver must also be a float. (since it yelled at me when I tried to net a float to a u32)
I don't need or want a float, so I need to do something to the number to prepare it for sending to my hardware. I am sending 2 bytes to convey spindle speed (this will give me 0-20000 rpm)
Does someone know off the top of their head what the format for the float is? or can I just cast it as an INT and it will become correct?
motion.spindle-speed-out
This is a float, so I assume my "pin" in my driver must also be a float. (since it yelled at me when I tried to net a float to a u32)
I don't need or want a float, so I need to do something to the number to prepare it for sending to my hardware. I am sending 2 bytes to convey spindle speed (this will give me 0-20000 rpm)
Does someone know off the top of their head what the format for the float is? or can I just cast it as an INT and it will become correct?
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23279
- Thank you received: 4933
29 May 2013 22:48 #34919
by andypugh
In HAL you can use conf_float_u32 www.linuxcnc.org/docs/html/man/man9/conv_float_u32.9.html
In the code you can probably just use an implicit cast, as long as you are careful with limits.
Replied by andypugh on topic developing drivers for custom boards
This is a float, so I assume my "pin" in my driver must also be a float. (since it yelled at me when I tried to net a float to a u32)
or can I just cast it as an INT and it will become correct?
In HAL you can use conf_float_u32 www.linuxcnc.org/docs/html/man/man9/conv_float_u32.9.html
In the code you can probably just use an implicit cast, as long as you are careful with limits.
The following user(s) said Thank You: btvpimill
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
-
Less
More
- Posts: 213
- Thank you received: 3
29 May 2013 22:52 #34920
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
the HAL component looks pretty cool, think I will give that a go. Thanks again Andy
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
-
Less
More
- Posts: 213
- Thank you received: 3
27 Jun 2013 07:21 - 27 Jun 2013 07:32 #36115
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
Andy, that component does the trick.
I learned the hard way that even built in parallel ports are not all the same. I was pulling my hair out over the last 2 days trying to figure out what was wrong with my hardware. I was losing steps, but could not figure out why. Turns out it was the motherboard/parallel port. I swapped that board (about 3 years old) with one that was only 1-2 years old, and everything works perfect.
Now the problem is that is a discontinued model. So then I tried it with a 2 month old computer that I bought to try since I can't by the other - it won't even do EPP, even when set in BIOS and doing all the bit setting in my driver.
Oh well, off to look for another computer to use until I can get this to work with my 5i25.
If anyone knows of an mini ITX with built in LPT, and can confirm it will work in EPP mode, I would love to hear.
I learned the hard way that even built in parallel ports are not all the same. I was pulling my hair out over the last 2 days trying to figure out what was wrong with my hardware. I was losing steps, but could not figure out why. Turns out it was the motherboard/parallel port. I swapped that board (about 3 years old) with one that was only 1-2 years old, and everything works perfect.
Now the problem is that is a discontinued model. So then I tried it with a 2 month old computer that I bought to try since I can't by the other - it won't even do EPP, even when set in BIOS and doing all the bit setting in my driver.
Oh well, off to look for another computer to use until I can get this to work with my 5i25.
If anyone knows of an mini ITX with built in LPT, and can confirm it will work in EPP mode, I would love to hear.
Last edit: 27 Jun 2013 07:32 by btvpimill. Reason: typo ( at least 1)
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
-
Less
More
- Posts: 213
- Thank you received: 3
21 Aug 2013 06:43 #37911
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
A little back on topic here, easy question:
How the heck do I send a message from my driver to Axis? I mean something like what we see when we hit a limit switch?
How the heck do I send a message from my driver to Axis? I mean something like what we see when we hit a limit switch?
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23279
- Thank you received: 4933
21 Aug 2013 16:26 #37915
by andypugh
Axis communicates via NML messages, a limited number of HAL pins, and possibly the emc.stat structure.
Typically you send messages to Motion and Axis sees them.
What message do you want to send?
Replied by andypugh on topic developing drivers for custom boards
How the heck do I send a message from my driver to Axis?
Axis communicates via NML messages, a limited number of HAL pins, and possibly the emc.stat structure.
Typically you send messages to Motion and Axis sees them.
What message do you want to send?
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
-
Less
More
- Posts: 213
- Thank you received: 3
21 Aug 2013 16:51 #37917
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
I can detect communication errors between LinuxCNC and my board. Right now I RTAPI_PRINT a message with the error. The problem is this is not seen. what I really want to do is have an Estop ( prolly I can manage that), and a custom message like we we get for limits and such. Otherwise we will scratch our heads as to why we just got the Estop
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23279
- Thank you received: 4933
21 Aug 2013 17:56 #37921
by andypugh
rtapi_print_msg(RTAPI_MSG_ERR..... ) should print an error message in Axis:
www.linuxcnc.org/docs/html/man/man3/rtapi_print.3rtapi.html
Replied by andypugh on topic developing drivers for custom boards
Right now I RTAPI_PRINT a message with the error. The problem is this is not seen
rtapi_print_msg(RTAPI_MSG_ERR..... ) should print an error message in Axis:
www.linuxcnc.org/docs/html/man/man3/rtapi_print.3rtapi.html
Please Log in or Create an account to join the conversation.
Moderators: PCW, jmelson
Time to create page: 0.079 seconds