MESA PWM

More
11 Aug 2013 21:04 #37562 by eslavko
Replied by eslavko on topic MESA PWM
Ahh... I didn't know that pin function (step/dir/pwm....) doesn't set pin type (in/out/opendrain) and has to be done separatly. Today I'm tryed to run motors (not in machine yet) and steppers works. Thus I got error (joint folowing error) when I try to crank up the speed. And seems that ferror and min_ferror doesnt change anything. I will try to catch what goes on. ...it's thing for new topic.

For now just THANK'S PCW for (working) bitfile.

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

More
11 Aug 2013 22:03 - 11 Aug 2013 22:04 #37564 by PCW
Replied by PCW on topic MESA PWM
Well pin type does set output _if_ you enable the function
for example of you have 4 stepgens in a configuration and enable 2,
the enabled stepgens will automatically have their outputs enabled
(and the 2 unused stepgens will stay as GPIO)

If you get joint following errors with the hardware stepgen, its often because of the following:

1. Step length and step space settings wont allow the requested speed
2. The stepgen maxaccel parameter is not set to about 25% higher than
the machines maxaccel for that axis
3. The stepgens max speed setting wont allow the requested speed
Last edit: 11 Aug 2013 22:04 by PCW. Reason: can't count

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

More
12 Aug 2013 02:13 #37569 by eslavko
Replied by eslavko on topic MESA PWM
When I looking that hal file created with pncconf I found lines like these

setp hm2_7i43.0.gpio.024.is_output true


And I know that pin 24 is control for 1'st motor. I was (wrong) thinking that assigning pin for step or dir automaticaly set is as output. (well pncconf do that, but can be changed in hall - for example adding line for open drain output.)

Seems that I got following errors as I set pulse length to 25us instead 2.5us... just stripping one zerro solve the problem.
Now I need to customise taht config files to suit real machine.... Till now I just playing with 3 axis setup as demo...

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

More
12 Aug 2013 03:49 #37571 by PCW
Replied by PCW on topic MESA PWM
you _DO NOT_ need to specifically enable outputs driven by enabled stepgens,PWMgens etc, In fact you will not even have access to the
GPIO output pin on the pin. If pncconf does this, it is a mistake

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

More
12 Aug 2013 04:17 #37572 by cmorley
Replied by cmorley on topic MESA PWM
Pncconf does not do this. the only thing it may do is invert the direction pin which require inverting the corresponding GPIO pin.

Without more info I can not tell how you made that conclusion.

Chris M

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

More
12 Aug 2013 06:30 #37575 by PCW
Replied by PCW on topic MESA PWM
Yes, I don't think the "is-output" parameter is even available for
pins used by enabled secondary functions.

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

More
12 Aug 2013 13:11 - 12 Aug 2013 13:12 #37579 by eslavko
Replied by eslavko on topic MESA PWM
Uff I don't know from where line like
setp hm2_7i43.0.gpio.039.is_output true
come.

Now I tested in real. And it's not needed. But at least in my configuration doesn't show error.
Now I tested the real output. And output swing from pin is only from 0 to 3.3V. The setp opendrain doesn't work too.
So I have little current in my photocouplers even when pin is high. This in not good. I'd like to avoid that. But I have luck that I was added external LED to see pin state,serial to photocoupler. So remaining 1.7V was spread around two LED (one external and one in photocoupler). I just measure the voltage over current limiting resistor to calculate current trought. It's 7mA and 0.12mA, and output of photocoupler is stable. I Added another resistor to double the current just to check low current. Is it rising to 0.2mA but stil doesn't trigger output. So I can declare 0.12mA as safe off.
Last edit: 12 Aug 2013 13:12 by eslavko. Reason: type mistage

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

More
12 Aug 2013 14:24 - 12 Aug 2013 14:26 #37582 by cmorley
Replied by cmorley on topic MESA PWM
Eslvko

I am sure you can set the stepper output pins as opendrain not sure if you did this or not from your message.
Pncconf doesn't do it for you but you can do it yourself just as you tried to do above with is_output.
We are saying you can't set is_output on a stepper pin.
You can invert it or set it as an open_drain.

You must figure out which GPIO number corresponds to the stepper output pin.
If you have the PIN file it is relatively easy.
here is a sample:
IO Connections for P3
    Pin#    I/O     Pri. func    Sec. func    Chan      Pin func        Pin Dir

     1        0     IOPort       StepGen       0        Dir/Table2      (Out)
    14        1     IOPort       StepGen       0        Step/Table1     (Out)
     2        2     IOPort       StepGen       1        Dir/Table2      (Out)
    15        3     IOPort       StepGen       1        Step/Table1     (Out)
     3        4     IOPort       StepGen       2        Dir/Table2      (Out)


You can see Stepgen 0 's dir pin corresponds to I/O # 0
stepgen 1 dir = I/O #2

The I/O number is the GPIO number.
So you would:
setp hm2_7i43.0.gpio.000.is_opendrain true
setp hm2_7i43.0.gpio.002.is_opendrain true

to set those pins as open drain.

Chris M
Last edit: 12 Aug 2013 14:26 by cmorley.

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

More
13 Feb 2014 20:38 #43824 by kostas
Replied by kostas on topic MESA PWM
Can the PWM/DIR outputs become active low?
I'm also driving optocouplers with 5V and PWM pin configured as open drain, but have the problem that for the brief time the hm2 driver loads till I invert the PWM outputs from HAL, I'm getting a pulse that would drive the motor on for a few ms.
I have an LED connected and I see it flash instantly.

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

More
13 Feb 2014 22:45 #43827 by PCW
Replied by PCW on topic MESA PWM
The PWM outputs are active high so will be enabled (low) by the driver at startup
This is a consequence of the fact that the driver enables special outputs (PWM/DIR STEP/DIR TXDATA etc)
when the driver is loaded. For PWM its is intended that the active low ENA pin enable the PWM driven hardware.

That said, Its probably possible to make a bitfile with inverted PWM output with some minor VHDL hacking

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

Moderators: cmorley
Time to create page: 0.169 seconds
Powered by Kunena Forum