Hm2_eth driver question

More
18 Jan 2018 14:58 - 18 Jan 2018 15:08 #104668 by Tady
Hm2_eth driver question was created by Tady
Hello!
I am new to this forum so I hope tis is the correct topic to open this thread :)

Anyway I am an hobby electronic and i'm keen on making electronic project.
In the past I successfully made a simple arduino (Teensy board actually) controller for my RPi3 running machinekit...

Now I'm trying to play with LinuxCNC and I was thinking of making a hobby board to drive 3 servos via ethernet.
I was looking at hal files and realtime components of hm2_eth that is used for the mesa 7i92 abd simmilar boards.. Since I don't have one of those boards it is very difficult do see what the component is sending out and what is it expecting to get back and how much time does it wait for the reply...
The driver does detect my board and gets its mac address but then it stops...
So can domeone here tell me how this communication works.. I know its UDP and I do get some hex commands at startup

I know meas boards are far superior than some board made at home.. Its the learning and challanges that get me going;)
Thank you!
Last edit: 18 Jan 2018 15:08 by Tady.

Please Log in or Create an account to join the conversation.

More
18 Jan 2018 16:59 #104674 by PCW
Replied by PCW on topic Hm2_eth driver question
If you want to use the hm2_eth driver as-is you need to emulate the register access protocol that the mesa cards use.
This is fully documented in the 7iXX Ethernet card manuals. You also have the hm2_eth source to look through.

Another option is to use tcpdump to see what the driver is asking for (you will have to decode the LBP16 commands)

Please Log in or Create an account to join the conversation.

More
18 Jan 2018 17:36 #104678 by Tady
Replied by Tady on topic Hm2_eth driver question
Can you give me some links of the manuals?
How do i runt cpdump?

Please Log in or Create an account to join the conversation.

More
18 Jan 2018 17:39 #104679 by PCW
Replied by PCW on topic Hm2_eth driver question
1. google 7i92man
2. man tcpdump

Please Log in or Create an account to join the conversation.

More
21 Jan 2018 11:02 #104768 by Tady
Replied by Tady on topic Hm2_eth driver question
Hmm... This was too complicated for me... I had some luck with my little project... I used an example from c programming how to connect to my ethernet board and send and receive some data... But since I don't understand how linuxcnc internals work in detail I'm havling trouble how to pass signals between the hal component and realtime module... Can you point me to an example?:)
Thank you

Please Log in or Create an account to join the conversation.

More
21 Jan 2018 11:06 #104769 by Tady
Replied by Tady on topic Hm2_eth driver question
I saw this in one of the Diy sources.. Its from picncV2 source.. And messa uses simmilar code but I don't quite ynderstand it how it works
for (n=0; n<NUMAXES; n++) {
		retval = hal_pin_float_newf(HAL_IN, &(data->position_cmd[n]),
		        comp_id, "%s.axis.%01d.position-cmd", prefix, n);
		if (retval < 0) goto error;
		*(data->position_cmd[n]) = 0.0;

		retval = hal_pin_float_newf(HAL_OUT, &(data->position_fb[n]),
		        comp_id, "%s.axis.%01d.position-fb", prefix, n);
		if (retval < 0) goto error;
		*(data->position_fb[n]) = 0.0;

		retval = hal_param_float_newf(HAL_RW, &(data->scale[n]),
		        comp_id, "%s.axis.%01d.scale", prefix, n);
		if (retval < 0) goto error;
		data->scale[n] = 1.0;

		retval = hal_param_float_newf(HAL_RW, &(data->maxaccel[n]),
		        comp_id, "%s.axis.%01d.maxaccel", prefix, n);
		if (retval < 0) goto error;
		data->maxaccel[n] = 1.0;

		retval = hal_pin_bit_newf(HAL_OUT, &(data->pin_input[n]), 
			comp_id, "%s.axis.%01d.home", prefix, n);
		if (retval < 0) goto error;
		*(data->pin_input[n]) = 0;
	}

	retval = hal_pin_bit_newf(HAL_OUT, &(data->pin_input[STOP]), 
		comp_id, "%s.in.stop", prefix);
	if (retval < 0) goto error;
	*(data->pin_input[STOP]) = 0;

	retval = hal_pin_bit_newf(HAL_IN, &(data->pin_output[OUTPUT]),
		comp_id, "%s.out.enable", prefix);
	if (retval < 0) goto error;
	*(data->pin_output[OUTPUT]) = 0;

	retval = hal_pin_bit_newf(HAL_IN, &(data->pin_output[SPINDLE]),
		comp_id, "%s.spindle.enable", prefix);
	if (retval < 0) goto error;
	*(data->pin_output[SPINDLE]) = 0;

	retval = hal_param_bit_newf(HAL_RW, &(data->pwm_enable[SPINDLE]), 
		comp_id, "%s.spindle.pwm.enable", prefix);
	if (retval < 0) goto error;
	data->pwm_enable[SPINDLE] = 0;

	retval = hal_pin_float_newf(HAL_IN, &(data->pwm_duty[SPINDLE]),
		comp_id, "%s.spindle.pwm.duty", prefix, n);
	if (retval < 0) goto error;
	*(data->pwm_duty[SPINDLE]) = 0.0;

	retval = hal_param_float_newf(HAL_RW, &(data->pwm_scale[SPINDLE]),
		comp_id,"%s.spindle.pwm.scale", prefix);
	if (retval < 0) goto error;
	data->pwm_scale[SPINDLE] = 1.0;

	retval = hal_pin_bit_newf(HAL_IN, &(data->pin_output[MIST]),
		comp_id, "%s.mist.enable", prefix);
	if (retval < 0) goto error;
	*(data->pin_output[MIST]) = 0;

	retval = hal_param_bit_newf(HAL_RW, &(data->pwm_enable[MIST]),
		comp_id, "%s.mist.pwm.enable", prefix);
	if (retval < 0) goto error;
	data->pwm_enable[MIST] = 0;

	retval = hal_pin_float_newf(HAL_IN, &(data->pwm_duty[MIST]),
		comp_id, "%s.mist.pwm.duty", prefix, n);
	if (retval < 0) goto error;
	*(data->pwm_duty[MIST]) = 0.0;

	retval = hal_param_float_newf(HAL_RW, &(data->pwm_scale[MIST]),
		comp_id,"%s.mist.pwm.scale", prefix);
	if (retval < 0) goto error;
	data->pwm_scale[MIST] = 1.0;

	retval = hal_pin_bit_newf(HAL_IN, &(data->pin_output[FLOOD]),
		comp_id, "%s.flood.enable", prefix);
	if (retval < 0) goto error;
	*(data->pin_output[FLOOD]) = 0;

	retval = hal_param_bit_newf(HAL_RW, &(data->pwm_enable[FLOOD]),
		comp_id, "%s.flood.pwm.enable", prefix);
	if (retval < 0) goto error;
	data->pwm_enable[FLOOD] = 0;

	retval = hal_pin_float_newf(HAL_IN, &(data->pwm_duty[FLOOD]),
		comp_id, "%s.flood.pwm.duty", prefix, n);
	if (retval < 0) goto error;
	*(data->pwm_duty[FLOOD]) = 0.0;

	retval = hal_param_float_newf(HAL_RW, &(data->pwm_scale[FLOOD]),
		comp_id,"%s.flood.pwm.scale", prefix);
	if (retval < 0) goto error;
	data->pwm_scale[FLOOD] = 1.0;

	retval = hal_pin_bit_newf(HAL_OUT, &(data->ready), comp_id,
	        "%s.ready", prefix);
	if (retval < 0) goto error;
	*(data->ready) = 0;

	retval = hal_pin_bit_newf(HAL_IO, &(data->spi_fault), comp_id,
	        "%s.spi_fault", prefix);
	if (retval < 0) goto error;
	*(data->spi_fault) = 0;

error:
	if (retval < 0) {
		rtapi_print_msg(RTAPI_MSG_ERR,
		        "%s: ERROR: pin export failed with err=%i\n",
		        modname, retval);
		hal_exit(comp_id);
		return -1;
	}

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.102 seconds
Powered by Kunena Forum