Mesa 5i23 HAL pins confusing
29 Apr 2021 12:28 #207364
by Hatilima
Mesa 5i23 HAL pins confusing was created by Hatilima
I am using a Mesa 5i23 PCI FPGA board to learn about LinuxCNC and HAL. For starters, I want to control the speed of a dc motor from LinuxCNC halrun. So I plugged my Mesa 5i23 into my LinuxCNC computer, created .hal and .ini using PNCconf Wizard, edited the two files so as to only have one PWM channel, zero encoders nor stepgen. From my understanding, the 72 physical pins on 5i23 have specific functions such that
setp hm2_5i23.0.pwmgen.00.output-type 1
setp hm2_5i23.0.pwmgen.00.scale 10
creates PWM on physical GPIO 007 and DIR on physical GPIO 009
Then I create a signal that will be sending PWM command to the PWM component through a hal pin of PWM component named "value" pin as:
net motor-command => hm2_5i23.0.pwmgen.00.value
With the above(once PWM is enabled through pwm hal pin hm2_5i23.0.pwmgen.00.enable), I can see a good PWM signal on physical GPIO 007 using an oscilloscope. I can also see the direction singal changing from zero to 5V and vice-versa (once I send negative and positive motor-commands to PWM hal pin "*.pwmgen.00.value").
Two main questions:
1. The mapping from hal pin/parameters hm2_5i23.0.pwmgen.00.* to physical gpio pin 007(PWM) and 009 (direction), is this done in the FPGA BIT file?
2. Since I am using an H-Bridge motor driver, I need not just one DIRECTION signal but two...DIR1 and DIR2, whose values will determine if it is CW, CCW or stop, but the PWM hal component just outputs PWM and DIR on physical pins. How can I get a compliment of DIR when there are no hal pins of these PWM signals (PWM and DIR)? I only see PWM and DIR signals manifesting on phyisical pins 007 and 009 and no hal equivalents of them... If there was a hal pin that I can access and it is connected to DIR (gpio 009), I would create a signal for it, invert it, then use "net" to connect it to some hal pin that represents a physical GPIO pin (say 20)...then I would have DIR1 on gpio 009 and DIR2 on gpio 020.
With all this information, kindly advise on how I can achieve the desired PWM, DIR1 and DIR2...or alternatively, advise on how I can access whatever part of hal that is generating PWM and DIR so that I can get this DIR and do inversion with it.
For the Mesa 5i23, I am using hm2_pci firmware SV12.BIT.
setp hm2_5i23.0.pwmgen.00.output-type 1
setp hm2_5i23.0.pwmgen.00.scale 10
creates PWM on physical GPIO 007 and DIR on physical GPIO 009
Then I create a signal that will be sending PWM command to the PWM component through a hal pin of PWM component named "value" pin as:
net motor-command => hm2_5i23.0.pwmgen.00.value
With the above(once PWM is enabled through pwm hal pin hm2_5i23.0.pwmgen.00.enable), I can see a good PWM signal on physical GPIO 007 using an oscilloscope. I can also see the direction singal changing from zero to 5V and vice-versa (once I send negative and positive motor-commands to PWM hal pin "*.pwmgen.00.value").
Two main questions:
1. The mapping from hal pin/parameters hm2_5i23.0.pwmgen.00.* to physical gpio pin 007(PWM) and 009 (direction), is this done in the FPGA BIT file?
2. Since I am using an H-Bridge motor driver, I need not just one DIRECTION signal but two...DIR1 and DIR2, whose values will determine if it is CW, CCW or stop, but the PWM hal component just outputs PWM and DIR on physical pins. How can I get a compliment of DIR when there are no hal pins of these PWM signals (PWM and DIR)? I only see PWM and DIR signals manifesting on phyisical pins 007 and 009 and no hal equivalents of them... If there was a hal pin that I can access and it is connected to DIR (gpio 009), I would create a signal for it, invert it, then use "net" to connect it to some hal pin that represents a physical GPIO pin (say 20)...then I would have DIR1 on gpio 009 and DIR2 on gpio 020.
With all this information, kindly advise on how I can achieve the desired PWM, DIR1 and DIR2...or alternatively, advise on how I can access whatever part of hal that is generating PWM and DIR so that I can get this DIR and do inversion with it.
For the Mesa 5i23, I am using hm2_pci firmware SV12.BIT.
Please Log in or Create an account to join the conversation.
29 Apr 2021 13:43 #207372
by PCW
Replied by PCW on topic Mesa 5i23 HAL pins confusing
1. Yes, the pinout is compiled into the bitfile
2. Probably the easiest thing would be to use an external inverter for direction
though some chips may work with the up/down PWM mode
2. Probably the easiest thing would be to use an external inverter for direction
though some chips may work with the up/down PWM mode
Please Log in or Create an account to join the conversation.
01 May 2021 21:33 #207575
by andypugh
Replied by andypugh on topic Mesa 5i23 HAL pins confusing
I wonder if there is a way to use the 3ppwm Hostmot2 component to drive a 2-phase H-bridge? It wastes a few pins, but I see no reason that it wouldn't work.
Otherwise I think one would set the pwmgen to up/down output mode and generate the other two drivers using HAL logic. This would require some care to ensure that there can be no situations where a short-circuit is generated in the H-bridge.
linuxcnc.org/docs/2.8/html/man/man9/hostmot2.9.html#pwmgen
Otherwise I think one would set the pwmgen to up/down output mode and generate the other two drivers using HAL logic. This would require some care to ensure that there can be no situations where a short-circuit is generated in the H-bridge.
linuxcnc.org/docs/2.8/html/man/man9/hostmot2.9.html#pwmgen
Please Log in or Create an account to join the conversation.
Time to create page: 0.097 seconds