developing drivers for custom boards
- btvpimill
- Offline
- Elite Member
Less
More
- Posts: 229
- Thank you received: 3
25 Mar 2013 07:04 - 25 Mar 2013 07:35 #31815
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
Well here is a blast from the past. I am finally back to this project.
So of course the first thing I try is to install my comp file, but seems no matter where I try from, using "sudo comp --install path/FC_epp.comp" gets me:
sudo: comp: command not found
I have not tried ' install the emc2-dev (sudo apt-get install emc2-dev) and build-essential packages (sudo apt-get install build-essential)' from section 1.3 here . I don't remember doing that before when this was all emc2. Do I need to now?
Went ahead and did both those steps, now I get this:
rev3@rev3:~/linuxcnc$ sudo comp --install FC_epp.comp
Traceback (most recent call last):
File "/usr/bin/comp", line 1335, in <module>
main()
File "/usr/bin/comp", line 1304, in main
process(f, mode, outfile)
File "/usr/bin/comp", line 1178, in process
a, b = parse(filename)
File "/usr/bin/comp", line 411, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
rev3@rev3:~/linuxcnc$
Guess I am lost. I am sure it is something dumb, but maybe someone will see it.
Oh Dear, I see this is the same issue I was having on page 3 of this thread. Well off to find the magic I ran across on page 4.
So of course the first thing I try is to install my comp file, but seems no matter where I try from, using "sudo comp --install path/FC_epp.comp" gets me:
sudo: comp: command not found
I have not tried ' install the emc2-dev (sudo apt-get install emc2-dev) and build-essential packages (sudo apt-get install build-essential)' from section 1.3 here . I don't remember doing that before when this was all emc2. Do I need to now?
Went ahead and did both those steps, now I get this:
rev3@rev3:~/linuxcnc$ sudo comp --install FC_epp.comp
Traceback (most recent call last):
File "/usr/bin/comp", line 1335, in <module>
main()
File "/usr/bin/comp", line 1304, in main
process(f, mode, outfile)
File "/usr/bin/comp", line 1178, in process
a, b = parse(filename)
File "/usr/bin/comp", line 411, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
rev3@rev3:~/linuxcnc$
Guess I am lost. I am sure it is something dumb, but maybe someone will see it.
Oh Dear, I see this is the same issue I was having on page 3 of this thread. Well off to find the magic I ran across on page 4.
Last edit: 25 Mar 2013 07:35 by btvpimill.
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
Less
More
- Posts: 229
- Thank you received: 3
25 Mar 2013 10:53 #31822
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
The magic has been solved. I never noticed gedit has a dropdown box to pick the line endings when it saves a file. As I had been opening the file as a txt to start with, that defaulted to windows style.
Save as and pick the unix/linux and it compiles now
I guess I will start trying to get it to work tomorrow
Save as and pick the unix/linux and it compiles now
I guess I will start trying to get it to work tomorrow
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
Less
More
- Posts: 229
- Thank you received: 3
25 Mar 2013 11:55 #31824
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
well before going to bed, I tried to load my driver and see if that much worked, failed.
after I did the comp -- install FC_epp.comp
everything seemed to work - I guess. no errors
then I tried halrun
halrun : loadrt FC_epp ioaddr=0x378
I get an error saying too many parameters or something. checked dmesg, I see that at least it got to EXTRA_SETUP, in djesg I see the output:
"loading epp at base address 378"
But that is all. done for the night. Thanks for any insight anyone can provide for this.
after I did the comp -- install FC_epp.comp
everything seemed to work - I guess. no errors
then I tried halrun
halrun : loadrt FC_epp ioaddr=0x378
I get an error saying too many parameters or something. checked dmesg, I see that at least it got to EXTRA_SETUP, in djesg I see the output:
"loading epp at base address 378"
But that is all. done for the night. Thanks for any insight anyone can provide for this.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23559
- Thank you received: 4858
25 Mar 2013 19:57 #31841
by andypugh
That might just be EXTRA_SETUP returning a non-zero value.
Replied by andypugh on topic developing drivers for custom boards
I get an error saying too many parameters or something.
That might just be EXTRA_SETUP returning a non-zero value.
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
Less
More
- Posts: 229
- Thank you received: 3
25 Mar 2013 20:05 - 25 Mar 2013 20:09 #31842
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
here is my EXTRA_SETUP
EXTRA_SETUP(){
if (ioaddr[extra_arg] > 0) {
base_addr = ioaddr[extra_arg];
rtapi_print("Loading EPP custom board driver at base addr %X\n", base_addr);
return 0;
}
return -EINVAL;
}
int get_count(void){
int i;
for (i=0; ioaddr > 0 && i < MAX_CHAN; i++){}
return i;
}
Not sure what would be wrong here. Also have no idea how the last 4 lines get called to return i
BTW, I am running the code found on page 4 of this thread
EXTRA_SETUP(){
if (ioaddr[extra_arg] > 0) {
base_addr = ioaddr[extra_arg];
rtapi_print("Loading EPP custom board driver at base addr %X\n", base_addr);
return 0;
}
return -EINVAL;
}
int get_count(void){
int i;
for (i=0; ioaddr > 0 && i < MAX_CHAN; i++){}
return i;
}
Not sure what would be wrong here. Also have no idea how the last 4 lines get called to return i
BTW, I am running the code found on page 4 of this thread
Last edit: 25 Mar 2013 20:09 by btvpimill. Reason: Added where the code is
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23559
- Thank you received: 4858
25 Mar 2013 20:28 #31845
by andypugh
But it looks to be in danger of always returning MAX_CHAN as ioaddr is likely to be a non-zero pointer to the ioaddr array.
You might want ioaddr > 0 instead.
Always returning MAX_CHAN for the channel counts will explain why the EXTRA_SETUP fails.
Replied by andypugh on topic developing drivers for custom boards
I would suspect that this is dropping through to the "return -EINVAL". Inserting an rtapi_print will make that clear.here is my EXTRA_SETUP
EXTRA_SETUP(){ if (ioaddr[extra_arg] > 0) { base_addr = ioaddr[extra_arg]; rtapi_print("Loading EPP custom board driver at base addr %X\n", base_addr); return 0; } return -EINVAL; }
get_count is called if you have option count_function yes set.
Not sure what would be wrong here. Also have no idea how the last 4 lines get called to return iint get_count(void){ int i; for (i=0; ioaddr > 0 && i < MAX_CHAN; i++){} return i; }
But it looks to be in danger of always returning MAX_CHAN as ioaddr is likely to be a non-zero pointer to the ioaddr array.
You might want ioaddr > 0 instead.
Always returning MAX_CHAN for the channel counts will explain why the EXTRA_SETUP fails.
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
Less
More
- Posts: 229
- Thank you received: 3
25 Mar 2013 21:42 #31851
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
Here is my new EXTRA_SETUP:
and the error messages from dmesg:
Any ideas? I am not sure what you ment with change it to ioaddr > 0, where?
EXTRA_SETUP(){
if (ioaddr[extra_arg] > 0) {
base_addr = ioaddr[extra_arg];
rtapi_print("Loading EPP custom board driver at base addr %X\n", base_addr);
outb(4,base_addr+2);
rtapi_print("made it past EPP setup\n");
return 0;
}
rtapi_print("Seems we are returning -EINVAL\n");
return -EINVAL;
}
int get_count(void){
int i;
for (i=0; ioaddr > 0 && i < MAX_CHAN; i++){}
rtapi_print("down here in get count, i = %X\n", i);
return i;
}
and the error messages from dmesg:
[ 529.285281] RTAI[math]: loaded.
[ 549.441699] down here in get count, i = 8
[ 549.441719] Loading EPP custom board driver at base addr 378
[ 549.441728] made it past EPP setup
[ 549.442084] Seems we are returning -EINVAL
[ 549.442091] Seems we are returning -EINVAL
[ 549.442096] Seems we are returning -EINVAL
[ 549.442102] Seems we are returning -EINVAL
[ 549.442107] Seems we are returning -EINVAL
[ 549.442112] Seems we are returning -EINVAL
[ 549.442120] Seems we are returning -EINVAL
[ 563.704436] RTAI[math]: unloaded.
[ 563.748774] SCHED releases registered named ALIEN RTGLBH
[ 563.808594] RTAI[malloc]: unloaded.
[ 563.908032] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[ 563.913767] I-pipe: Domain RTAI unregistered.
[ 563.913940] RTAI[hal]: unmounted.
Any ideas? I am not sure what you ment with change it to ioaddr > 0, where?
Please Log in or Create an account to join the conversation.
- btvpimill
- Offline
- Elite Member
Less
More
- Posts: 229
- Thank you received: 3
25 Mar 2013 22:20 #31855
by btvpimill
Replied by btvpimill on topic developing drivers for custom boards
I set option count_function to no, and now all seems to work. so moving forward but still would like to know why it does not work
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23559
- Thank you received: 4858
25 Mar 2013 23:28 #31861
by andypugh
You have a count function, you probably ought to use it.
However, the count function isn't right. It keeps counting as long as there is an ioaddr array, not as long as the elements of the ioaddr array are valid.
swapforand set option cont function back to yes.
This is assuming that the ioaddr modparam actually exists and is what is being used.
Replied by andypugh on topic developing drivers for custom boards
I set option count_function to no, and now all seems to work. so moving forward but still would like to know why it does not work
You have a count function, you probably ought to use it.
However, the count function isn't right. It keeps counting as long as there is an ioaddr array, not as long as the elements of the ioaddr array are valid.
swap
for (i=0; ioaddr > 0 && i < MAX_CHAN; i++){}
for (i=0; ioaddr[i] > 0 && i < MAX_CHAN; i++){}
This is assuming that the ioaddr modparam actually exists and is what is being used.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23559
- Thank you received: 4858
25 Mar 2013 23:30 - 25 Mar 2013 23:30 #31863
by andypugh
That was rendered unclear by the forum formatting eating my index. It probably ate yours too.
Replied by andypugh on topic developing drivers for custom boards
Any ideas? I am not sure what you ment with change it to ioaddr > 0, where?
That was rendered unclear by the forum formatting eating my index. It probably ate yours too.
Last edit: 25 Mar 2013 23:30 by andypugh.
Please Log in or Create an account to join the conversation.
Moderators: PCW, jmelson
Time to create page: 0.126 seconds